InertiaSDK

Loading...
Searching...
No Matches
InertiaService.h
1#pragma once
2
3 namespace inertia
4{
5
7 enum ServiceVersion : unsigned {
8 SACP_V0 = 0,
9 SACP_V1 = 1
10};
11
13 enum ServiceV0ID : unsigned {
14 SERVICE_0_ECHO_REQUEST = 10,
15 SERVICE_0_ECHO_RESPONSE = 11,
16 SERVICE_0_ECHO_ERROR = 12,
17 SERVICE_0_ADDRESS_ASSIGN = 20,
18 SERVICE_0_ADDRESS_ANNOUNCE = 21,
19 SERVICE_0_ADDRESS_SERIAL = 26,
20 SERVICE_0_ADDRESS_VERSION = 27,
21 SERVICE_0_LIST_INTERFACE = 30,
22 SERVICE_0_LIST_ARP = 34,
23 SERVICE_0_ADD_ARP = 35,
24 SERVICE_0_REMOVE_ARP = 36,
25 SERVICE_0_CLEAR_ARP = 37,
26 SERVICE_0_LIST_FORWARDERS = 40,
27 SERVICE_0_ADD_FORWARDER = 41,
28 SERVICE_0_REMOVE_FORWARDER = 42,
29 SERVICE_0_LIST_CONNECTORS = 44,
30 SERVICE_0_ADD_CONNECTOR = 45,
31 SERVICE_0_REMOVE_CONNECTOR = 46,
32 SERVICE_0_MAC_SLOT_SET = 48,
33 SERVICE_0_MAC_SLOT_GET = 49,
34 SERVICE_0_RADIO_CHANNEL_SET = 50,
35 SERVICE_0_RADIO_CHANNEL_GET = 51,
36 SERVICE_0_MAC_SLOT_COUNT_SET = 52,
37 SERVICE_0_MAC_SLOT_COUNT_GET = 53,
38 SERVICE_0_MAC_SLOT_FREQ_SET = 54,
39 SERVICE_0_MAC_SLOT_FREQ_GET = 55,
40 SERVICE_0_RADIO_CONFIG_SET = 56,
41 SERVICE_0_RADIO_CONFIG_GET = 57,
42 SERVICE_0_RADIO_ENABLE_SET = 58,
43 SERVICE_0_RADIO_ENABLE_GET = 59
44};
45
47 enum ServiceGroup : unsigned {
48 SERVICE_GROUP_GENERAL = 0,
49 SERVICE_GROUP_DEVICE = 1,
50 SERVICE_GROUP_INTERFACE = 2,
51 SERVICE_GROUP_ARP = 3,
52 SERVICE_GROUP_FORWARDER = 4,
53 SERVICE_GROUP_CONNECTOR = 5,
54 SERVICE_GROUP_RADIO = 16,
55 SERVICE_GROUP_FASTMAC = 17,
56 SERVICE_GROUP_RRP = 999
57};
58
60 enum ServiceGeneral : uint8_t {
61 SERVICE_GENERAL_ECHO_REQUEST = 0,
62 SERVICE_GENERAL_RESPONSE = 1,
63 SERVICE_GENERAL_ERROR = 2,
64 SERVICE_GENERAL_NETINFO = 3
65};
66
68 enum ServiceDevice : uint8_t {
69 SERVICE_DEVICE_ADDRESS_ASSIGN = 0,
70 SERVICE_DEVICE_ADDRESS_ANNOUNCE = 1,
71 SERVICE_DEVICE_SERIAL_GET = 2,
72 SERVICE_DEVICE_VERSION_INFO_GET = 3,
73 SERVICE_DEVICE_PROCESS_STATS_GET = 4
74};
75
77 enum ServiceInterface : uint8_t {
78 SERVICE_INTERFACE_LIST = 0
79};
80
82 enum ServiceARP : uint8_t {
83 SERVICE_ARP_LIST = 0,
84 SERVICE_ARP_ADD = 1,
85 SERVICE_ARP_REMOVE = 2,
86 SERVICE_ARP_CLEAR = 3
87};
88
90 enum ServiceForwarder : uint8_t {
91 SERVICE_FORWARDER_LIST = 0,
92 SERVICE_FORWARDER_ADD = 1,
93 SERVICE_FORWARDER_REMOVE = 2
94};
95
97 enum ServiceConnector : uint8_t {
98 SERVICE_CONNECTOR_LIST = 0,
99 SERVICE_CONNECTOR_ADD = 1,
100 SERVICE_CONNECTOR_REMOVE = 2
101};
102
104 enum ServiceRadio : uint8_t {
105 SERVICE_RADIO_CONF_SET = 0,
106 SERVICE_RADIO_CONF_GET = 1,
107 SERVICE_RADIO_ENABLE_SET = 2,
108 SERVICE_RADIO_ENABLE_GET = 3
109};
110
112 enum ServiceFastMac : uint8_t {
113 SERVICE_FASTMAC_SLOT_SET = 0,
114 SERVICE_FASTMAC_SLOT_GET = 1,
115 SERVICE_FASTMAC_CHANNEL_SET = 2,
116 SERVICE_FASTMAC_CHANNEL_GET = 3,
117 SERVICE_FASTMAC_SLOT_COUNT_SET = 4,
118 SERVICE_FASTMAC_SLOT_COUNT_GET = 5,
119 SERVICE_FASTMAC_FREQ_SET = 6,
120 SERVICE_FASTMAC_FREQ_GET = 7
121};
122
124 enum ServiceRRP : uint8_t {
125 SERVICE_RRP_RESPONSE = 0,
126 SERVICE_RRP_PROGRESS = 1
127};
128
130 enum ServiceHardwareTypeID : uint32_t {
131 HW_NONE = 0x00,
132 HW_PROMOVE_GW = 0x04,
133 HW_PROMOVE_3D = 0x06,
134 HW_IDLER_NODE = 0x08,
135 HW_IDLER_GW = 0x09,
136 HW_VMON4000_NODE = 0x0A,
137 HW_VMON4000_GW = 0x2A,
138 HW_PROMOVE_MINI_IRM = 0x0B,
139 HW_INERTIA_GW_ADV = 0x0C,
140 HW_INERTIA_GW_BSC = 0x0D,
141 HW_PROMOVE_MINI_BT = 0x0E,
142 HW_PROMOVE_MINI_IRM_GPS = 0x0F,
143 HW_PROMOVE_MINI_BT_GPS = 0x10,
144 HW_PROMOVE_MINI_BTLE = 0x11,
145 HW_NEXODAQ = 0x20,
146 HW_EQUI_PRO_GW_BSC = 0x30,
147 HW_EQUI_PRO_GW_ADC = 0x31,
148 HW_EQUI_PRO_GW_STICK = 0x32,
149 HW_PROMOVE_V_HG_BARO_IRM = 0x40,
150 HW_PROMOVE_V_HG_BARO_IRM_GNSS = 0x41,
151 HW_PROMOVE_V_HG_IRM = 0x42,
152 HW_PROMOVE_V_HG_IRM_GNSS = 0x43,
153 HW_PROMOVE_V_HG_BARO_BLE = 0x50,
154 HW_PROMOVE_V_HG_BARO_BLE_GNSS = 0x51,
155 HW_PROMOVE_V_HG_BLE = 0x52,
156 HW_PROMOVE_V_HG_BLE_GNSS = 0x53,
157 HW_INERTIA_GW_STICK = 0x60
158};
159
161 enum ServiceFirmwareTypeID : uint8_t {
162 FW_PM_MINI_BT = 0x02,
163 FW_PM_MINI_GPS = 0xF0,
164 FW_VMON4000_GW = 0x06
165};
166
168 enum ServiceRevisionTypeID : uint8_t {
169 REVISION_NONE = 0,
170 REVISION_A = 1,
171 REVISION_B = 2,
172 REVISION_C = 3,
173 REVISION_D = 4,
174 REVISION_E = 5,
175 REVISION_F = 6,
176 REVISION_G = 7
177};
178
180 enum ServiceFirmwareEntryType : unsigned {
181 FW_MAIN_APPLICATION = 0,
182 FW_MODULE_PACKAGE = 1,
183 FW_EXTERNAL_TOOL = 2,
184 FW_SUB_PCA = 3,
185 FW_SUB_PCA_FW = 4
186};
187
188
189 struct INERTIA_API ServiceResponseGetVersionExtended
190{
191 ServiceFirmwareEntryType entryType;
192 uint8_t fwMajor;
193 uint8_t fwMinor;
194 uint8_t fwHotfix;
195 std::wstring nameSuffix;
196 std::wstring versionSuffix;
197 std::wstring optionSuffix;
198
199 ServiceResponseGetVersionExtended();
200 const std::wstring ToString() const;
201 const std::wstring GetEntryTypeString() const;
202};
203
204
205 struct INERTIA_API ServiceResponseProcessStats
206{
207 std::wstring name;
208 uint8_t state;
209 uint16_t flags;
210 uint8_t stack;
211
212 ServiceResponseProcessStats();
213 const std::wstring ToString() const;
214};
215
216
217 struct INERTIA_API ServiceARPentry
218{
219 uint8_t interfaceID;
220 uint8_t flags;
221 uint16_t address;
222 int8_t age;
223 uint8_t linkType;
224 uint8_t linkAddress;
225
226 ServiceARPentry();
227 const std::wstring ToString() const;
228};
229
230
231 struct INERTIA_API ServiceForwarderEntry
232{
233 uint8_t interfaceID;
234 uint8_t protocolID;
235 int8_t minLevel;
236 int8_t maxLevel;
237 std::vector<std::pair<uint8_t, uint8_t> > destinations;
238
239 ServiceForwarderEntry();
240 const std::wstring ToString() const;
241};
242
243
244 struct INERTIA_API ServiceConnectorEntry
245{
246 uint8_t protocolID;
247 int8_t minLevel;
248 int8_t maxLevel;
249
250 ServiceConnectorEntry();
251 const std::wstring ToString() const;
252};
253
254
255 struct INERTIA_API ServiceMessage
256{
257 private:
258 ServiceGroup msgGroup;
259 uint8_t msgType;
260
261 public:
262 ServiceMessage(ServiceGroup const& group, uint8_t const& type);
263 virtual ~ServiceMessage();
264 ServiceMessage(ServiceMessage const&) = default;
265 ServiceMessage& operator = (ServiceMessage const&) = default;
266
267 static ServiceV0ID ServiceV1toV0(ServiceGroup, uint8_t msg);
268 static const std::pair<ServiceGroup, uint8_t> ServiceV0toV1(ServiceV0ID msg);
269 virtual const std::wstring ToString() const;
270
271 virtual ServiceGroup GetGroup() const;
272 virtual uint8_t GetType() const;
273};
274
275
276 struct INERTIA_API ServiceResponse
277 : ServiceMessage
278{
279 ServiceResponse(ServiceGroup const& group, uint8_t const& type);
280 const std::wstring ToString() const override;
281};
282
283
284 struct INERTIA_API ServiceResponseEcho
285 : ServiceResponse
286{
287 ServiceVersion version;
288 uint32_t mtuLength;
289
290 ServiceResponseEcho(const uint8_t* in, const unsigned _offset, const unsigned _length);
291 const std::wstring ToString() const override;
292};
293
294
295 struct INERTIA_API ServiceResponseNetInfo
296 : ServiceResponse
297{
298 uint16_t netPrefix;
299 uint8_t netMask;
300
301 ServiceResponseNetInfo(const uint8_t* in, const unsigned _offset, const unsigned _length);
302 const std::wstring ToString() const override;
303};
304
305
306 struct INERTIA_API ServiceResponseGetVersion
307 : ServiceResponse
308{
309 private:
310 std::vector<uint8_t> rawData;
311
312 public:
313 ServiceHardwareTypeID hardwareID;
314 ServiceRevisionTypeID hardwareRevisionID;
315 uint8_t hardwareOptionCode;
316 uint32_t hardwarePCANumber;
317
318 uint8_t firmwareID;
319 uint8_t fwMajor;
320 uint8_t fwMinor;
321 uint8_t fwHotfix;
322 std::vector<ServiceResponseGetVersionExtended> extendedInfo;
323
324 ServiceResponseGetVersion();
325 ServiceResponseGetVersion(const ServiceHardwareTypeID _hardwareID, const ServiceRevisionTypeID _revisionID);
326 ServiceResponseGetVersion(const uint8_t* in, const unsigned _offset, const unsigned _length);
327 const std::wstring ToString() const override;
328 const std::wstring GetHardwareString() const;
329 const std::wstring GetRevisionString() const;
330 const std::wstring GetVersionString() const;
331 static const std::wstring ToHardwareString(ServiceHardwareTypeID _hardwareID);
332
333 std::vector<uint8_t> GetRawData() const;
334};
335
336
337 struct INERTIA_API ServiceResponseGetSerialNr
338 : ServiceResponse
339{
340 private:
341 std::vector<uint8_t> rawData;
342
343 public:
344 uint64_t serialNr;
345
346 ServiceResponseGetSerialNr();
347 ServiceResponseGetSerialNr(const uint8_t* in, const unsigned _offset, const unsigned _length);
348 const std::wstring GetHexString() const;
349 const std::wstring ToString() const override;
350
351 std::vector<uint8_t> GetRawData() const;
352};
353
354
355 struct INERTIA_API ServiceResponseGetProcessStats
356 : ServiceResponse
357{
358 std::vector<ServiceResponseProcessStats> processInfo;
359
360 ServiceResponseGetProcessStats(const uint8_t* in, const unsigned _offset, const unsigned _length);
361 const std::wstring ToString() const override;
362};
363
364
365 struct INERTIA_API ServiceResponseListInterfaces
366 : ServiceResponse
367{
368 std::vector<uint8_t> interfaceIDs;
369
370 ServiceResponseListInterfaces(const uint8_t* in, const unsigned _offset, const unsigned _length);
371 const std::wstring ToString() const override;
372};
373
374
375 struct INERTIA_API ServiceResponseListARPs
376 : ServiceResponse
377{
378 std::vector<ServiceARPentry> ARPentries;
379
380 ServiceResponseListARPs(const uint8_t* in, const unsigned _offset, const unsigned _length);
381 const std::wstring ToString() const override;
382};
383
384
385 struct INERTIA_API ServiceResponseListForwarders
386 : ServiceResponse
387{
388 std::vector<ServiceForwarderEntry> forwarderEntries;
389
390 ServiceResponseListForwarders(const uint8_t* in, const unsigned _offset, const unsigned _length);
391 const std::wstring ToString() const override;
392};
393
394
395 struct INERTIA_API ServiceResponseListConnectors
396 : ServiceResponse
397{
398 std::vector<ServiceConnectorEntry> connectorEntries;
399
400 ServiceResponseListConnectors(const uint8_t* in, const unsigned _offset, const unsigned _length);
401 const std::wstring ToString() const override;
402};
403
404
405 struct INERTIA_API ServiceResponseError
406 : ServiceResponse
407{
408 uint8_t errorCode;
409
410 ServiceResponseError(const uint8_t* in, const unsigned _offset, const unsigned _length);
411 const std::wstring ToString() const override;
412};
413
414
415 struct INERTIA_API ServiceRequest
416 : ServiceMessage
417{
418 ServiceVersion version;
419 std::vector<uint8_t> payload;
420
421 ServiceRequest(ServiceGroup const& _msgGroup, uint8_t const& _msgType, ServiceVersion const& _version, std::vector<uint8_t> const& payload = std::vector<uint8_t>());
422 const std::wstring ToString() const override;
423};
424
425
426 struct INERTIA_API RRPResponse
427 : ServiceResponse
428{
429 bool success;
430 int responseCode;
431
432 RRPResponse(const bool _success, int _responseCode = -1);
433 const std::wstring ToString() const override;
434};
435
436
438 enum RRPInfoType : unsigned
439{
440 RRP_INFO_START = 0,
441 RRP_INFO_BUSY,
442 RRP_INFO_FWU_VERSION,
443 RRP_INFO_FWU_FACTORY_DEFAULTS,
444 RRP_INFO_DEVICE_HW,
445 RRP_INFO_DEVICE_FW,
446 RRP_INFO_DEVICE_REV,
447 RRP_INFO_DEVICE_VERSION,
448 RRP_INFO_FILE_HW,
449 RRP_INFO_FILE_FW,
450 RRP_INFO_FILE_REV,
451 RRP_INFO_FILE_VERSION,
452 RRP_INFO_COMPONENTS,
453 RRP_INFO_VALIDATE,
454 RRP_INFO_UPLOAD,
455 RRP_INFO_REPROGRAM,
456 RRP_INFO_TIMEOUT,
457 RRP_INFO_RESET_DEFAULTS
458};
459
460
461 struct INERTIA_API RRPProgress
462 : ServiceResponse
463{
464 bool success;
465 RRPInfoType type;
466 std::wstring message;
467
468 RRPProgress(const bool _success, const RRPInfoType type, std::wstring const& message);
469 const std::wstring ToString() const override;
470};
471
472}
inertia
Definition FlashCommands.h:6
inertia::ServiceGroup
ServiceGroup
Definition InertiaService.h:47
inertia::ServiceFastMac
ServiceFastMac
Definition InertiaService.h:112
inertia::ServiceConnector
ServiceConnector
Definition InertiaService.h:97
inertia::RRPInfoType
RRPInfoType
Definition InertiaService.h:439
inertia::ServiceRRP
ServiceRRP
Definition InertiaService.h:124
inertia::ServiceARP
ServiceARP
Definition InertiaService.h:82
inertia::ServiceFirmwareEntryType
ServiceFirmwareEntryType
Definition InertiaService.h:180
inertia::ServiceFirmwareTypeID
ServiceFirmwareTypeID
Definition InertiaService.h:161
inertia::ServiceDevice
ServiceDevice
Definition InertiaService.h:68
inertia::ServiceRadio
ServiceRadio
Definition InertiaService.h:104
inertia::ServiceRevisionTypeID
ServiceRevisionTypeID
Definition InertiaService.h:168
inertia::ServiceVersion
ServiceVersion
Definition InertiaService.h:7
inertia::ServiceGeneral
ServiceGeneral
Definition InertiaService.h:60
inertia::ServiceInterface
ServiceInterface
Definition InertiaService.h:77
inertia::ServiceForwarder
ServiceForwarder
Definition InertiaService.h:90
inertia::ServiceHardwareTypeID
ServiceHardwareTypeID
Definition InertiaService.h:130
inertia::ServiceV0ID
ServiceV0ID
Definition InertiaService.h:13