summaryrefslogtreecommitdiffstats
path: root/uca-net-protocol.h
blob: be59973231a33b404a71b4865123d043e32bc991 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#ifndef PROTOCOL_H
#define PROTOCOL_H

#include <gio/gio.h>

#define UCA_NET_MAX_ENUM_LENGTH         32
#define UCA_NET_MAX_ENUM_NAME_LENGTH    128

typedef enum {
    UCA_NET_MESSAGE_INVALID = 0,
    UCA_NET_MESSAGE_GET_PROPERTIES,
    UCA_NET_MESSAGE_GET_PROPERTY,
    UCA_NET_MESSAGE_SET_PROPERTY,
    UCA_NET_MESSAGE_START_RECORDING,
    UCA_NET_MESSAGE_STOP_RECORDING,
    UCA_NET_MESSAGE_START_READOUT,
    UCA_NET_MESSAGE_STOP_READOUT,
    UCA_NET_MESSAGE_TRIGGER,
    UCA_NET_MESSAGE_GRAB,
    UCA_NET_MESSAGE_WRITE,
} UcaNetMessageType;

typedef struct {
    gboolean occurred;
    gchar domain[64];
    gint code;
    gchar message[512];
} UcaNetErrorReply;

typedef struct {
    UcaNetMessageType type;
    UcaNetErrorReply error;
} UcaNetDefaultReply;

typedef struct {
    UcaNetMessageType type;
} UcaNetMessageDefault;

typedef struct {
    UcaNetMessageType type;
    gchar property_name[128];
} UcaNetMessageGetPropertyRequest;

typedef struct {
    UcaNetMessageType type;
    gchar property_value[128];
} UcaNetMessageGetPropertyReply;

typedef struct {
    UcaNetMessageType type;
    gchar property_name[128];
    gchar property_value[128];
} UcaNetMessageSetPropertyRequest;

typedef struct {
    UcaNetMessageType type;
    gsize size;
} UcaNetMessageGrabRequest;

typedef struct {
    UcaNetMessageType type;
    gsize size;
    gchar name[128];
} UcaNetMessageWriteRequest;

typedef struct {
    UcaNetMessageType type;
    guint num_properties;
} UcaNetMessageGetPropertiesReply;

#define NUMERIC_STRUCT(type) \
    struct { \
        type minimum; \
        type maximum; \
        type default_value; \
    } type;

typedef struct {
    GType value_type;
    GParamFlags flags;
    gchar name[128];
    gchar nick[128];
    gchar blurb[128];
    gboolean valid;

    union {
        struct {
            gboolean default_value;
        } gboolean;
        struct {
            gchar default_value[128];
        } gstring;
        struct {
            gint default_value;
            gint minimum;
            gint maximum;
            guint n_values;
            gint values[UCA_NET_MAX_ENUM_LENGTH];
            gchar value_names[UCA_NET_MAX_ENUM_LENGTH][UCA_NET_MAX_ENUM_NAME_LENGTH];
            gchar value_nicks[UCA_NET_MAX_ENUM_LENGTH][UCA_NET_MAX_ENUM_NAME_LENGTH];
        } genum;
        NUMERIC_STRUCT (gint)
        NUMERIC_STRUCT (gint64)
        NUMERIC_STRUCT (guint)
        NUMERIC_STRUCT (guint64)
        NUMERIC_STRUCT (gfloat)
        NUMERIC_STRUCT (gdouble)
    } spec;
} UcaNetMessageProperty;

#undef NUMERIC_STRUCT

#endif