17
17
#include < stdint.h>
18
18
#include < stddef.h>
19
19
20
+ <<<<<<< HEAD
20
21
/* *****************************************************************************
21
22
* TYPEDEF
22
23
******************************************************************************/
23
24
24
25
enum CommandId : uint16_t {
26
+ =======
27
+ #if __cplusplus >= 201402L // Cpp14
28
+ #include < algorithm>
29
+ #endif // __cplusplus
30
+
31
+ /* *****************************************************************************
32
+ * DEFINE
33
+ ******************************************************************************/
34
+
35
+ #define THING_ID_SIZE 37
36
+ #define SHA256_SIZE 32
37
+ #define URL_SIZE 256
38
+ #define ID_SIZE 16
39
+ #define MAX_LIB_VERSION_SIZE 10
40
+
41
+ /* *****************************************************************************
42
+ TYPEDEF
43
+ ******************************************************************************/
44
+
45
+ enum CommandID: uint32_t {
46
+ >>>>>>> 9d4009fa (Extend Commands.h to include new Command protocol model)
25
47
26
48
/* Device commands */
27
49
DeviceBeginCmdId,
@@ -39,12 +61,112 @@ enum CommandId : uint16_t {
39
61
/* Generic commands */
40
62
ResetCmdId,
41
63
64
+ <<<<<<< HEAD
65
+ =======
66
+ /* OTA commands */
67
+ OtaBeginUpId,
68
+ OtaProgressCmdUpId,
69
+ OtaUpdateCmdDownId,
70
+
71
+ /* Timezone commands */
72
+ TimezoneCommandUpId,
73
+ TimezoneCommandDownId,
74
+
75
+ >>>>>>> 9d4009fa (Extend Commands.h to include new Command protocol model)
42
76
/* Unknown command id */
43
77
UnknownCmdId
44
78
};
45
79
46
80
struct Command {
81
+ <<<<<<< HEAD
47
82
CommandId id;
48
83
};
49
84
50
85
typedef Command Message;
86
+ =======
87
+ CommandID id;
88
+ };
89
+
90
+ typedef Command Message;
91
+
92
+ struct ThingGetIdCmdUp {
93
+ Command c;
94
+ struct {
95
+ char thing_id[THING_ID_SIZE];
96
+ } params;
97
+ };
98
+
99
+ struct ThingGetLastValueCmdUp {
100
+ Command c;
101
+ };
102
+
103
+ struct OtaBeginUp {
104
+ Command c;
105
+ struct {
106
+ uint8_t sha [SHA256_SIZE];
107
+ } params;
108
+ };
109
+
110
+ struct DeviceBeginCmdUp {
111
+ Command c;
112
+ struct {
113
+ char lib_version[MAX_LIB_VERSION_SIZE];
114
+ } params;
115
+ };
116
+
117
+ struct OtaProgressCmdUp {
118
+ Command c;
119
+ struct {
120
+ uint8_t id[ID_SIZE];
121
+ uint8_t state;
122
+ int32_t state_data;
123
+ uint64_t time;
124
+ } params;
125
+ };
126
+
127
+ struct TimezoneCommandUp {
128
+ Command c;
129
+ };
130
+
131
+ struct OtaUpdateCmdDown {
132
+ Command c;
133
+ struct {
134
+ uint8_t id[ID_SIZE];
135
+ char url[URL_SIZE];
136
+ uint8_t initialSha256[SHA256_SIZE];
137
+ uint8_t finalSha256[SHA256_SIZE];
138
+ } params;
139
+ };
140
+
141
+ struct ThingGetIdCmdDown {
142
+ Command c;
143
+ struct {
144
+ char thing_id[THING_ID_SIZE];
145
+ } params;
146
+ };
147
+
148
+ struct ThingGetLastValueCmdDown {
149
+ Command c;
150
+ struct {
151
+ uint8_t * last_values;
152
+ size_t length;
153
+ } params;
154
+ };
155
+
156
+ struct TimezoneCommandDown {
157
+ Command c;
158
+ struct {
159
+ int32_t offset;
160
+ uint32_t until;
161
+ } params;
162
+ };
163
+
164
+ union CommandDown {
165
+ struct Command c;
166
+ struct OtaUpdateCmdDown otaUpdateCmdDown;
167
+ struct ThingGetIdCmdDown thingGetIdCmdDown;
168
+ struct ThingGetLastValueCmdDown thingGetLastValueCmdDown;
169
+ struct TimezoneCommandDown timezoneCommandDown;
170
+ };
171
+
172
+ >>>>>>> 9d4009fa (Extend Commands.h to include new Command protocol model)
0 commit comments