InertiaSDK

Loading...
Searching...
No Matches
GccCommands.h
1#pragma once
2
3#include "data/command/InertiaCommand.h"
4#include "data/config/NexoDAQSettings.h"
5
6 namespace inertia
7{
8 enum ConfigType : unsigned;
9 enum NexoDAQDescriptorID : uint8_t;
10
11 enum GCCCommandID : uint8_t {
12 GCC_COMMAND_NEXO_WAKEUP_GET_TRIGGER_TIME = 0,
13 GCC_COMMAND_NEXO_WAKEUP_LOG_TRIGGER_TIME = 1,
14 GCC_COMMAND_NEXO_WAKEUP_LOG_TRIGGER_TIME_EVENT = 2,
15 GCC_COMMAND_NEXO_GPIO_GET = 0,
16 GCC_COMMAND_NEXO_GPIO_SET = 1,
17 GCC_COMMAND_NEXO_GPIO_TOGGLE = 2,
18 GCC_COMMAND_NEXO_GPIO_GET_TRIGGER_TIME = 3,
19 GCC_COMMAND_NEXO_USER_CALIBRATION_GET_ALL = 0,
20 GCC_COMMAND_NEXO_USER_CALIBRATION_GET_CURRENT = 1,
21 GCC_COMMAND_NEXO_USER_CALIBRATION_ADD = 2,
22 GCC_COMMAND_NEXO_USER_CALIBRATION_REMOVE = 3,
23 GCC_COMMAND_NEXO_USER_CALIBRATION_CLEAR_ALL = 4,
24 GCC_COMMAND_NEXO_TEDS_SET_MODE = 0,
25 GCC_COMMAND_NEXO_TEDS_WRITE = 1,
26 GCC_COMMAND_NEXO_TEDS_READ = 2,
27};
28
29
30 struct INERTIA_API GCCCommand
31 : InertiaCommand
32{
33 uint8_t gccDescriptorTypeID;
34 ConfigType gccConfigTypeID;
35
36 protected:
37 GCCCommand(uint8_t const& _gccDescriptorTypeID, ConfigType const& _gccConfigTypeID);
38 GCCCommand(const uint8_t* packet, const unsigned max_size);
39 GCCCommand(std::wstring const& argString);
40
41 void GetBytes(std::vector<uint8_t>& out) const override;
42 const std::wstring ToString() const override;
43
44#ifdef WITH_BOOST_PROGRAM_OPTIONS
45 static const po::options_description GetOptionDescription();
46#endif
47
48 public:
49 InertiaCommandGroups GetGroup() const override;
50 uint8_t GetType() const override;
51
52 static InertiaCommandPtr Parse(const uint8_t* in, unsigned const packetSize);
53 static InertiaCommandPtr Parse(std::wstring const& argString);
54};
55
56
57 struct INERTIA_API GCCCommandNexo
58 : GCCCommand
59{
60 uint8_t channelMask;
61 uint8_t channelDescriptorID;
62 uint8_t commandID;
63
64 protected:
65 GCCCommandNexo(uint8_t const& _channelMask, uint8_t const& _channelDescriptorID, uint8_t const& _commandID);
66 GCCCommandNexo(const uint8_t* packet, const unsigned max_size);
67 GCCCommandNexo(std::wstring const& argString);
68
69 void GetBytes(std::vector<uint8_t>& out) const override;
70 const std::wstring ToString() const override;
71
72 public:
73#ifdef WITH_BOOST_PROGRAM_OPTIONS
74 static const po::options_description GetOptionDescription();
75#endif
76};
77
78
79 struct INERTIA_API GCCCommandNexoWakeupGetTriggerTimeRequest
80 : GCCCommandNexo
81{
82 GCCCommandNexoWakeupGetTriggerTimeRequest(uint8_t const& channelMask);
83 GCCCommandNexoWakeupGetTriggerTimeRequest(const uint8_t* packet, const unsigned max_size);
84 GCCCommandNexoWakeupGetTriggerTimeRequest(std::wstring const& argString);
85
86 void GetBytes(std::vector<uint8_t>& out) const override;
87 const std::wstring ToString() const override;
88
89#ifdef WITH_BOOST_PROGRAM_OPTIONS
90 static const po::options_description GetOptionDescription();
91#endif
92
93 bool IsResponse() const override;
94};
95
96
97 struct INERTIA_API GCCCommandNexoWakeupGetTriggerTimeResponse
98 : GCCCommandNexo
99{
100 uint32_t sampleCounter;
101
102 GCCCommandNexoWakeupGetTriggerTimeResponse(const uint8_t* packet, const unsigned max_size);
103 GCCCommandNexoWakeupGetTriggerTimeResponse(std::wstring const& argString);
104
105 void GetBytes(std::vector<uint8_t>& out) const override;
106 const std::wstring ToString() const override;
107
108#ifdef WITH_BOOST_PROGRAM_OPTIONS
109 static const po::options_description GetOptionDescription();
110#endif
111
112 bool IsResponse() const override;
113};
114
115
116 struct INERTIA_API GCCCommandNexoWakeupLogTriggerTimeRequest
117 : GCCCommandNexo
118{
119 GCCCommandNexoWakeupLogTriggerTimeRequest(uint8_t const& channelMask);
120 GCCCommandNexoWakeupLogTriggerTimeRequest(const uint8_t* packet, const unsigned max_size);
121 GCCCommandNexoWakeupLogTriggerTimeRequest(std::wstring const& argString);
122
123 void GetBytes(std::vector<uint8_t>& out) const override;
124 const std::wstring ToString() const override;
125
126#ifdef WITH_BOOST_PROGRAM_OPTIONS
127 static const po::options_description GetOptionDescription();
128#endif
129
130 bool IsResponse() const override;
131};
132
133
134 struct INERTIA_API GCCCommandNexoWakeupLogTriggerTimeResponse
135 : GCCCommandNexo
136 , BoolValue
137{
138
139 GCCCommandNexoWakeupLogTriggerTimeResponse(const uint8_t* packet, const unsigned max_size);
140 GCCCommandNexoWakeupLogTriggerTimeResponse(std::wstring const& argString);
141
142 void GetBytes(std::vector<uint8_t>& out) const override;
143 const std::wstring ToString() const override;
144
145#ifdef WITH_BOOST_PROGRAM_OPTIONS
146 static const po::options_description GetOptionDescription();
147#endif
148
149 bool IsResponse() const override;
150};
151
152
153 struct INERTIA_API GCCCommandNexoWakeupLogTriggerTimeEvent
154 : GCCCommandNexo
155{
156 uint32_t sampleCounter;
157
158 GCCCommandNexoWakeupLogTriggerTimeEvent(const uint8_t* packet, const unsigned max_size);
159 GCCCommandNexoWakeupLogTriggerTimeEvent(std::wstring const& argString);
160
161 void GetBytes(std::vector<uint8_t>& out) const override;
162 const std::wstring ToString() const override;
163
164#ifdef WITH_BOOST_PROGRAM_OPTIONS
165 static const po::options_description GetOptionDescription();
166#endif
167
168 bool IsResponse() const override;
169};
170
171
172 struct INERTIA_API GCCCommandNexoGPIOGetRequest
173 : GCCCommandNexo
174{
175 GCCCommandNexoGPIOGetRequest(uint8_t const& channelMask);
176 GCCCommandNexoGPIOGetRequest(const uint8_t* packet, const unsigned max_size);
177 GCCCommandNexoGPIOGetRequest(std::wstring const& argString);
178
179 void GetBytes(std::vector<uint8_t>& out) const override;
180 const std::wstring ToString() const override;
181
182#ifdef WITH_BOOST_PROGRAM_OPTIONS
183 static const po::options_description GetOptionDescription();
184#endif
185
186 bool IsResponse() const override;
187};
188
189
190 struct INERTIA_API GCCCommandNexoGPIOGetResponse
191 : GCCCommandNexo
192{
193 uint16_t value;
194
195 GCCCommandNexoGPIOGetResponse(const uint8_t* packet, const unsigned max_size);
196 GCCCommandNexoGPIOGetResponse(std::wstring const& argString);
197
198 void GetBytes(std::vector<uint8_t>& out) const override;
199 const std::wstring ToString() const override;
200
201#ifdef WITH_BOOST_PROGRAM_OPTIONS
202 static const po::options_description GetOptionDescription();
203#endif
204
205 bool IsResponse() const override;
206};
207
208
209 struct INERTIA_API GCCCommandNexoGPIOSetRequest
210 : GCCCommandNexo
211{
212 uint16_t value;
213
214 GCCCommandNexoGPIOSetRequest(uint8_t const& channelMask, uint16_t const& _value);
215 GCCCommandNexoGPIOSetRequest(const uint8_t* packet, const unsigned max_size);
216 GCCCommandNexoGPIOSetRequest(std::wstring const& argString);
217
218 void GetBytes(std::vector<uint8_t>& out) const override;
219 const std::wstring ToString() const override;
220
221#ifdef WITH_BOOST_PROGRAM_OPTIONS
222 static const po::options_description GetOptionDescription();
223#endif
224
225 bool IsResponse() const override;
226};
227
228
229 struct INERTIA_API GCCCommandNexoGPIOSetResponse
230 : GCCCommandNexo
231 , BoolValue
232{
233
234 GCCCommandNexoGPIOSetResponse(const uint8_t* packet, const unsigned max_size);
235 GCCCommandNexoGPIOSetResponse(std::wstring const& argString);
236
237 void GetBytes(std::vector<uint8_t>& out) const override;
238 const std::wstring ToString() const override;
239
240#ifdef WITH_BOOST_PROGRAM_OPTIONS
241 static const po::options_description GetOptionDescription();
242#endif
243
244 bool IsResponse() const override;
245};
246
247
248 struct INERTIA_API GCCCommandNexoGPIOToggleRequest
249 : GCCCommandNexo
250{
251 GCCCommandNexoGPIOToggleRequest(uint8_t const& channelMask);
252 GCCCommandNexoGPIOToggleRequest(const uint8_t* packet, const unsigned max_size);
253 GCCCommandNexoGPIOToggleRequest(std::wstring const& argString);
254
255 void GetBytes(std::vector<uint8_t>& out) const override;
256 const std::wstring ToString() const override;
257
258#ifdef WITH_BOOST_PROGRAM_OPTIONS
259 static const po::options_description GetOptionDescription();
260#endif
261
262 bool IsResponse() const override;
263};
264
265
266 struct INERTIA_API GCCCommandNexoGPIOToggleResponse
267 : GCCCommandNexo
268 , BoolValue
269{
270
271 GCCCommandNexoGPIOToggleResponse(const uint8_t* packet, const unsigned max_size);
272 GCCCommandNexoGPIOToggleResponse(std::wstring const& argString);
273
274 void GetBytes(std::vector<uint8_t>& out) const override;
275 const std::wstring ToString() const override;
276
277#ifdef WITH_BOOST_PROGRAM_OPTIONS
278 static const po::options_description GetOptionDescription();
279#endif
280
281 bool IsResponse() const override;
282};
283
284
285 struct INERTIA_API GCCCommandNexoGPIOGetTriggerTimeRequest
286 : GCCCommandNexo
287{
288 GCCCommandNexoGPIOGetTriggerTimeRequest(uint8_t const& channelMask);
289 GCCCommandNexoGPIOGetTriggerTimeRequest(const uint8_t* packet, const unsigned max_size);
290 GCCCommandNexoGPIOGetTriggerTimeRequest(std::wstring const& argString);
291
292 void GetBytes(std::vector<uint8_t>& out) const override;
293 const std::wstring ToString() const override;
294
295#ifdef WITH_BOOST_PROGRAM_OPTIONS
296 static const po::options_description GetOptionDescription();
297#endif
298
299 bool IsResponse() const override;
300};
301
302
303 struct INERTIA_API GCCCommandNexoGPIOGetTriggerTimeResponse
304 : GCCCommandNexo
305{
306 uint32_t sampleCounter;
307
308 GCCCommandNexoGPIOGetTriggerTimeResponse(const uint8_t* packet, const unsigned max_size);
309 GCCCommandNexoGPIOGetTriggerTimeResponse(std::wstring const& argString);
310
311 void GetBytes(std::vector<uint8_t>& out) const override;
312 const std::wstring ToString() const override;
313
314#ifdef WITH_BOOST_PROGRAM_OPTIONS
315 static const po::options_description GetOptionDescription();
316#endif
317
318 bool IsResponse() const override;
319};
320
321
322 struct INERTIA_API GCCCommandNexoUserCalibrationEntry
323{
324 float offset;
325 float gain;
326 std::vector<NexoDAQDescriptorID> descriptors;
327
328 GCCCommandNexoUserCalibrationEntry();
329 GCCCommandNexoUserCalibrationEntry(float const& _offset, float const& _gain, std::vector<NexoDAQDescriptorID> const& _descriptors);
330 GCCCommandNexoUserCalibrationEntry(std::wstring const& argString);
331
332 const std::wstring ToString() const;
333
334#ifdef WITH_BOOST_PROGRAM_OPTIONS
335 static const po::options_description GetOptionDescription();
336#endif
337};
338
339
340 struct INERTIA_API GCCCommandNexoUserCalibrationGetAllRequest
341 : GCCCommandNexo
342{
343 GCCCommandNexoUserCalibrationGetAllRequest(uint8_t const& channelMask);
344 GCCCommandNexoUserCalibrationGetAllRequest(const uint8_t* packet, const unsigned max_size);
345 GCCCommandNexoUserCalibrationGetAllRequest(std::wstring const& argString);
346
347 void GetBytes(std::vector<uint8_t>& out) const override;
348 const std::wstring ToString() const override;
349
350#ifdef WITH_BOOST_PROGRAM_OPTIONS
351 static const po::options_description GetOptionDescription();
352#endif
353
354 bool IsResponse() const override;
355};
356
357
358 struct INERTIA_API GCCCommandNexoUserCalibrationGetAllResponse
359 : GCCCommandNexo
360{
361 std::vector<uint8_t> rawdata;
362 std::vector<GCCCommandNexoUserCalibrationEntry> entries;
363
364 GCCCommandNexoUserCalibrationGetAllResponse(const uint8_t* packet, const unsigned max_size);
365 GCCCommandNexoUserCalibrationGetAllResponse(std::wstring const& argString);
366
367 void GetBytes(std::vector<uint8_t>& out) const override;
368 const std::wstring ToString() const override;
369
370#ifdef WITH_BOOST_PROGRAM_OPTIONS
371 static const po::options_description GetOptionDescription();
372#endif
373
374 bool IsResponse() const override;
375};
376
377
378 struct INERTIA_API GCCCommandNexoUserCalibrationGetCurrentRequest
379 : GCCCommandNexo
380{
381 GCCCommandNexoUserCalibrationGetCurrentRequest(uint8_t const& channelMask);
382 GCCCommandNexoUserCalibrationGetCurrentRequest(const uint8_t* packet, const unsigned max_size);
383 GCCCommandNexoUserCalibrationGetCurrentRequest(std::wstring const& argString);
384
385 void GetBytes(std::vector<uint8_t>& out) const override;
386 const std::wstring ToString() const override;
387
388#ifdef WITH_BOOST_PROGRAM_OPTIONS
389 static const po::options_description GetOptionDescription();
390#endif
391
392 bool IsResponse() const override;
393};
394
395
396 struct INERTIA_API GCCCommandNexoUserCalibrationGetCurrentResponse
397 : GCCCommandNexo
398{
399 uint8_t tableIndex;
400 uint8_t rssDistance;
401
402 GCCCommandNexoUserCalibrationGetCurrentResponse(const uint8_t* packet, const unsigned max_size);
403 GCCCommandNexoUserCalibrationGetCurrentResponse(std::wstring const& argString);
404
405 void GetBytes(std::vector<uint8_t>& out) const override;
406 const std::wstring ToString() const override;
407
408#ifdef WITH_BOOST_PROGRAM_OPTIONS
409 static const po::options_description GetOptionDescription();
410#endif
411
412 bool IsResponse() const override;
413};
414
415
416 struct INERTIA_API GCCCommandNexoUserCalibrationAddRequest
417 : GCCCommandNexo
418{
419 float offset;
420 float gain;
421
422 GCCCommandNexoUserCalibrationAddRequest(uint8_t const& channelMask, float const& _offset, float const& _gain);
423 GCCCommandNexoUserCalibrationAddRequest(const uint8_t* packet, const unsigned max_size);
424 GCCCommandNexoUserCalibrationAddRequest(std::wstring const& argString);
425
426 void GetBytes(std::vector<uint8_t>& out) const override;
427 const std::wstring ToString() const override;
428
429#ifdef WITH_BOOST_PROGRAM_OPTIONS
430 static const po::options_description GetOptionDescription();
431#endif
432
433 bool IsResponse() const override;
434};
435
436
437 struct INERTIA_API GCCCommandNexoUserCalibrationAddResponse
438 : GCCCommandNexo
439 , BoolValue
440{
441 GCCCommandNexoUserCalibrationAddResponse(const uint8_t* packet, const unsigned max_size);
442 GCCCommandNexoUserCalibrationAddResponse(std::wstring const& argString);
443
444 void GetBytes(std::vector<uint8_t>& out) const override;
445 const std::wstring ToString() const override;
446
447#ifdef WITH_BOOST_PROGRAM_OPTIONS
448 static const po::options_description GetOptionDescription();
449#endif
450
451 bool IsResponse() const override;
452};
453
454
455 struct INERTIA_API GCCCommandNexoUserCalibrationRemoveRequest
456 : GCCCommandNexo
457{
458 uint8_t tableIndex;
459
460 GCCCommandNexoUserCalibrationRemoveRequest(uint8_t const& channelMask, uint8_t const& _tableIndex);
461 GCCCommandNexoUserCalibrationRemoveRequest(const uint8_t* packet, const unsigned max_size);
462 GCCCommandNexoUserCalibrationRemoveRequest(std::wstring const& argString);
463
464 void GetBytes(std::vector<uint8_t>& out) const override;
465 const std::wstring ToString() const override;
466
467#ifdef WITH_BOOST_PROGRAM_OPTIONS
468 static const po::options_description GetOptionDescription();
469#endif
470
471 bool IsResponse() const override;
472};
473
474
475 struct INERTIA_API GCCCommandNexoUserCalibrationRemoveResponse
476 : GCCCommandNexo
477 , BoolValue
478{
479 GCCCommandNexoUserCalibrationRemoveResponse(const uint8_t* packet, const unsigned max_size);
480 GCCCommandNexoUserCalibrationRemoveResponse(std::wstring const& argString);
481
482 void GetBytes(std::vector<uint8_t>& out) const override;
483 const std::wstring ToString() const override;
484
485#ifdef WITH_BOOST_PROGRAM_OPTIONS
486 static const po::options_description GetOptionDescription();
487#endif
488
489 bool IsResponse() const override;
490};
491
492
493 struct INERTIA_API GCCCommandNexoUserCalibrationClearAllRequest
494 : GCCCommandNexo
495{
496 GCCCommandNexoUserCalibrationClearAllRequest(uint8_t const& channelMask);
497 GCCCommandNexoUserCalibrationClearAllRequest(const uint8_t* packet, const unsigned max_size);
498 GCCCommandNexoUserCalibrationClearAllRequest(std::wstring const& argString);
499
500 void GetBytes(std::vector<uint8_t>& out) const override;
501 const std::wstring ToString() const override;
502
503#ifdef WITH_BOOST_PROGRAM_OPTIONS
504 static const po::options_description GetOptionDescription();
505#endif
506
507 bool IsResponse() const override;
508};
509
510
511 struct INERTIA_API GCCCommandNexoUserCalibrationClearAllResponse
512 : GCCCommandNexo
513 , BoolValue
514{
515 GCCCommandNexoUserCalibrationClearAllResponse(const uint8_t* packet, const unsigned max_size);
516 GCCCommandNexoUserCalibrationClearAllResponse(std::wstring const& argString);
517
518 void GetBytes(std::vector<uint8_t>& out) const override;
519 const std::wstring ToString() const override;
520
521#ifdef WITH_BOOST_PROGRAM_OPTIONS
522 static const po::options_description GetOptionDescription();
523#endif
524
525 bool IsResponse() const override;
526};
527
528
529 struct INERTIA_API GCCCommandNexoTEDSSetModeRequest
530 : GCCCommandNexo
531{
532 NexoDAQTEDSMode mode;
533
534 GCCCommandNexoTEDSSetModeRequest(uint8_t const& channelMask, NexoDAQTEDSMode const& _mode);
535 GCCCommandNexoTEDSSetModeRequest(const uint8_t* packet, const unsigned max_size);
536 GCCCommandNexoTEDSSetModeRequest(std::wstring const& argString);
537
538 void GetBytes(std::vector<uint8_t>& out) const override;
539 const std::wstring ToString() const override;
540
541#ifdef WITH_BOOST_PROGRAM_OPTIONS
542 static const po::options_description GetOptionDescription();
543#endif
544
545 bool IsResponse() const override;
546};
547
548
549 struct INERTIA_API GCCCommandNexoTEDSSetModeResponse
550 : GCCCommandNexo
551 , BoolValue
552{
553 GCCCommandNexoTEDSSetModeResponse(const uint8_t* packet, const unsigned max_size);
554 GCCCommandNexoTEDSSetModeResponse(std::wstring const& argString);
555
556 void GetBytes(std::vector<uint8_t>& out) const override;
557 const std::wstring ToString() const override;
558
559#ifdef WITH_BOOST_PROGRAM_OPTIONS
560 static const po::options_description GetOptionDescription();
561#endif
562
563 bool IsResponse() const override;
564};
565
566
567 struct INERTIA_API GCCCommandNexoTEDSWriteRequest
568 : GCCCommandNexo
569{
570 std::vector<uint8_t> inbound;
571
572 GCCCommandNexoTEDSWriteRequest(uint8_t const& channelMask, const std::vector<uint8_t>& _inbound);
573 GCCCommandNexoTEDSWriteRequest(const uint8_t* packet, const unsigned max_size);
574 GCCCommandNexoTEDSWriteRequest(std::wstring const& argString);
575
576 void GetBytes(std::vector<uint8_t>& out) const override;
577 const std::wstring ToString() const override;
578
579#ifdef WITH_BOOST_PROGRAM_OPTIONS
580 static const po::options_description GetOptionDescription();
581#endif
582
583 bool IsResponse() const override;
584};
585
586
587 struct INERTIA_API GCCCommandNexoTEDSWriteResponse
588 : GCCCommandNexo
589 , BoolValue
590{
591 GCCCommandNexoTEDSWriteResponse(const uint8_t* packet, const unsigned max_size);
592 GCCCommandNexoTEDSWriteResponse(std::wstring const& argString);
593
594 void GetBytes(std::vector<uint8_t>& out) const override;
595 const std::wstring ToString() const override;
596
597#ifdef WITH_BOOST_PROGRAM_OPTIONS
598 static const po::options_description GetOptionDescription();
599#endif
600
601 bool IsResponse() const override;
602};
603
604
605 struct INERTIA_API GCCCommandNexoTEDSReadRequest
606 : GCCCommandNexo
607{
608 GCCCommandNexoTEDSReadRequest(uint8_t const& channelMask);
609 GCCCommandNexoTEDSReadRequest(const uint8_t* packet, const unsigned max_size);
610 GCCCommandNexoTEDSReadRequest(std::wstring const& argString);
611
612 void GetBytes(std::vector<uint8_t>& out) const override;
613 const std::wstring ToString() const override;
614
615#ifdef WITH_BOOST_PROGRAM_OPTIONS
616 static const po::options_description GetOptionDescription();
617#endif
618
619 bool IsResponse() const override;
620};
621
622
623 struct INERTIA_API GCCCommandNexoTEDSReadResponse
624 : GCCCommandNexo
625{
626 std::vector<uint8_t> outbound;
627
628 GCCCommandNexoTEDSReadResponse(const uint8_t* packet, const unsigned max_size);
629 GCCCommandNexoTEDSReadResponse(std::wstring const& argString);
630
631 void GetBytes(std::vector<uint8_t>& out) const override;
632 const std::wstring ToString() const override;
633
634#ifdef WITH_BOOST_PROGRAM_OPTIONS
635 static const po::options_description GetOptionDescription();
636#endif
637
638 bool IsResponse() const override;
639};
640
641}
inertia
Definition FlashCommands.h:6
inertia::ConfigType
ConfigType
Definition ConfigChannel.h:7
inertia::InertiaCommandPtr
std::shared_ptr< InertiaCommand > InertiaCommandPtr
Pointer to an InertiaCommand.
Definition platform.h:52
inertia::InertiaCommandGroups
InertiaCommandGroups
Definition InertiaCommand.h:7