summaryrefslogtreecommitdiff
path: root/src/data.pb.h
blob: cc271a34b2df85a5f060e69f2534a1b8a4ced6ff (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.2-dev */

#ifndef PB_DATA_PB_H_INCLUDED
#define PB_DATA_PB_H_INCLUDED
#include <pb.h>

#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* Struct definitions */
typedef struct _s2m_data {
    pb_callback_t datapoints;
} s2m_data;

typedef struct __datapoint {
    uint32_t entity_id;
    double data;
    bool has_channel_id;
    uint32_t channel_id;
    bool has_unit_id;
    uint32_t unit_id;
    bool has_timestamp;
    int32_t timestamp;
} _datapoint;

typedef struct _m2s_CTS {
    uint32_t timeout;
} m2s_CTS;

typedef struct _m2s_SOR {
    uint32_t SOR_code;
    bool has_rx_length;
    uint32_t rx_length;
} m2s_SOR;

typedef struct _m2s_command {
    bool has_source_module_id;
    uint32_t source_module_id;
    bool has_source_i2c_address;
    uint32_t source_i2c_address;
    pb_callback_t cmd_bytes;
    pb_callback_t cmd_str;
} m2s_command;

typedef struct _s2m_DOC {
    uint32_t DOC_code;
    uint32_t tx_length;
} s2m_DOC;

typedef struct _s2m_command {
    bool has_dest_module_id;
    uint32_t dest_module_id;
    pb_callback_t dest_module_id_multicast;
    pb_callback_t cmd_bytes;
    pb_callback_t cmd_str;
} s2m_command;


/* Initializer values for message structs */
#define m2s_SOR_init_default                     {1u, false, 0}
#define s2m_DOC_init_default                     {1u, 0u}
#define m2s_CTS_init_default                     {0}
#define m2s_command_init_default                 {false, 1u, false, 1u, {{NULL}, NULL}, {{NULL}, NULL}}
#define s2m_command_init_default                 {false, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
#define _datapoint_init_default                  {0u, 0, false, 1u, false, 1u, false, 1}
#define s2m_data_init_default                    {{{NULL}, NULL}}
#define m2s_SOR_init_zero                        {0, false, 0}
#define s2m_DOC_init_zero                        {0, 0}
#define m2s_CTS_init_zero                        {0}
#define m2s_command_init_zero                    {false, 0, false, 0, {{NULL}, NULL}, {{NULL}, NULL}}
#define s2m_command_init_zero                    {false, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
#define _datapoint_init_zero                     {0, 0, false, 0, false, 0, false, 0}
#define s2m_data_init_zero                       {{{NULL}, NULL}}

/* Field tags (for use in manual encoding/decoding) */
#define s2m_data_datapoints_tag                  1
#define _datapoint_entity_id_tag                 1
#define _datapoint_data_tag                      2
#define _datapoint_channel_id_tag                3
#define _datapoint_unit_id_tag                   4
#define _datapoint_timestamp_tag                 5
#define m2s_CTS_timeout_tag                      1
#define m2s_SOR_SOR_code_tag                     1
#define m2s_SOR_rx_length_tag                    2
#define m2s_command_source_module_id_tag         1
#define m2s_command_source_i2c_address_tag       2
#define m2s_command_cmd_bytes_tag                3
#define m2s_command_cmd_str_tag                  4
#define s2m_DOC_DOC_code_tag                     1
#define s2m_DOC_tx_length_tag                    2
#define s2m_command_dest_module_id_tag           1
#define s2m_command_dest_module_id_multicast_tag 2
#define s2m_command_cmd_bytes_tag                3
#define s2m_command_cmd_str_tag                  4

/* Struct field encoding specification for nanopb */
#define m2s_SOR_FIELDLIST(X, a) \
X(a, STATIC,   REQUIRED, UINT32,   SOR_code,          1) \
X(a, STATIC,   OPTIONAL, UINT32,   rx_length,         2)
#define m2s_SOR_CALLBACK NULL
#define m2s_SOR_DEFAULT (const pb_byte_t*)"\x08\x01\x00"

#define s2m_DOC_FIELDLIST(X, a) \
X(a, STATIC,   REQUIRED, UINT32,   DOC_code,          1) \
X(a, STATIC,   REQUIRED, UINT32,   tx_length,         2)
#define s2m_DOC_CALLBACK NULL
#define s2m_DOC_DEFAULT (const pb_byte_t*)"\x08\x01\x10\x00\x00"

#define m2s_CTS_FIELDLIST(X, a) \
X(a, STATIC,   REQUIRED, UINT32,   timeout,           1)
#define m2s_CTS_CALLBACK NULL
#define m2s_CTS_DEFAULT NULL

#define m2s_command_FIELDLIST(X, a) \
X(a, STATIC,   OPTIONAL, UINT32,   source_module_id,   1) \
X(a, STATIC,   OPTIONAL, UINT32,   source_i2c_address,   2) \
X(a, CALLBACK, OPTIONAL, BYTES,    cmd_bytes,         3) \
X(a, CALLBACK, OPTIONAL, STRING,   cmd_str,           4)
#define m2s_command_CALLBACK pb_default_field_callback
#define m2s_command_DEFAULT (const pb_byte_t*)"\x08\x01\x10\x01\x00"

#define s2m_command_FIELDLIST(X, a) \
X(a, STATIC,   OPTIONAL, UINT32,   dest_module_id,    1) \
X(a, CALLBACK, REPEATED, UINT32,   dest_module_id_multicast,   2) \
X(a, CALLBACK, OPTIONAL, BYTES,    cmd_bytes,         3) \
X(a, CALLBACK, OPTIONAL, STRING,   cmd_str,           4)
#define s2m_command_CALLBACK pb_default_field_callback
#define s2m_command_DEFAULT NULL

#define _datapoint_FIELDLIST(X, a) \
X(a, STATIC,   REQUIRED, UINT32,   entity_id,         1) \
X(a, STATIC,   REQUIRED, DOUBLE,   data,              2) \
X(a, STATIC,   OPTIONAL, UINT32,   channel_id,        3) \
X(a, STATIC,   OPTIONAL, UINT32,   unit_id,           4) \
X(a, STATIC,   OPTIONAL, INT32,    timestamp,         5)
#define _datapoint_CALLBACK NULL
#define _datapoint_DEFAULT (const pb_byte_t*)"\x08\x00\x11\x00\x00\x00\x00\x00\x00\x00\x00\x18\x01\x20\x01\x28\x01\x00"

#define s2m_data_FIELDLIST(X, a) \
X(a, CALLBACK, REPEATED, MESSAGE,  datapoints,        1)
#define s2m_data_CALLBACK pb_default_field_callback
#define s2m_data_DEFAULT NULL
#define s2m_data_datapoints_MSGTYPE _datapoint

extern const pb_msgdesc_t m2s_SOR_msg;
extern const pb_msgdesc_t s2m_DOC_msg;
extern const pb_msgdesc_t m2s_CTS_msg;
extern const pb_msgdesc_t m2s_command_msg;
extern const pb_msgdesc_t s2m_command_msg;
extern const pb_msgdesc_t _datapoint_msg;
extern const pb_msgdesc_t s2m_data_msg;

/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define m2s_SOR_fields &m2s_SOR_msg
#define s2m_DOC_fields &s2m_DOC_msg
#define m2s_CTS_fields &m2s_CTS_msg
#define m2s_command_fields &m2s_command_msg
#define s2m_command_fields &s2m_command_msg
#define _datapoint_fields &_datapoint_msg
#define s2m_data_fields &s2m_data_msg

/* Maximum encoded size of messages (where known) */
#define m2s_SOR_size                             12
#define s2m_DOC_size                             12
#define m2s_CTS_size                             6
/* m2s_command_size depends on runtime parameters */
/* s2m_command_size depends on runtime parameters */
#define _datapoint_size                          38
/* s2m_data_size depends on runtime parameters */

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif