InertiaSDK

Loading...
Searching...
No Matches
IOConfigSettings.h
1#pragma once
2
3#include "data/config/SensorSpecificSettings.h"
4
5 namespace inertia
6{
7
8 struct IOCommonDescriptor;
9 struct IOModeDescriptor;
10 struct IOConfigurationDescriptor;
11 struct IOCapabilityDescriptor;
12 typedef std::shared_ptr<IOCommonDescriptor> IOCommonDescriptorPtr;
13 typedef std::shared_ptr<IOModeDescriptor> IOModeDescriptorPtr;
14 typedef std::shared_ptr<IOConfigurationDescriptor> IOConfigurationDescriptorPtr;
15 typedef std::shared_ptr<IOCapabilityDescriptor> IOCapabilityDescriptorPtr;
16
17
19 enum IOModeID {
20 IO_MODE_ADC = 0,
21 IO_MODE_DAC = 1,
22 IO_MODE_SYNC = 2,
23 IO_MODE_TRIGGER_INPUT = 3,
24 IO_MODE_TRIGGER_OUTPUT = 4,
25 IO_MODE_INPUT = 5,
26 IO_MODE_OUTPUT = 6,
27 IO_MODE_LAST = 7
28};
29
31 enum IOMessageID {
32 IO_MESSAGE_TRIGGER_INPUT_EVENT = 1,
33 IO_MESSAGE_TRIGGER_OUTPUT_FORCE = 0,
34 IO_MESSAGE_TRIGGER_OUTPUT_EVENT = 1,
35 IO_MESSAGE_INPUT_READ = 0,
36 IO_MESSAGE_OUTPUT_WRITE = 0,
37 IO_MESSAGE_LAST = 255
38};
39
41 enum IOCommonModeID {
42 IO_COMMON_MODE_SYNC = 0,
43 IO_COMMON_MODE_LAST = 1
44};
45
47 enum IOCommonMessageID {
48 IO_COMMON_MESSAGE_LAST = 255
49};
50
52 enum IOModeTriggerOutputType {
53 IO_MODE_TRIGGER_OUTPUT_NONE = -1,
54 IO_MODE_TRIGGER_OUTPUT_PULSE = 0,
55 IO_MODE_TRIGGER_OUTPUT_LEVEL = 1,
56 IO_MODE_TRIGGRE_OUTPUT_TOGGLE = 2
57};
58
60 enum IOModeTriggerInputType {
61 IO_MODE_TRIGGER_INPUT_NONE = -1,
62 IO_MODE_TRIGGER_INPUT_EDGE = 0,
63 IO_MODE_TRIGGER_INPUT_LEVEL = 1
64};
65
67 enum IOConfigurationDescriptorType {
68 IO_CONFIG_DESCRIPTOR_SPECIFIC = 0,
69 IO_CONFIG_DESCRIPTOR_COMMON = 1,
70 IO_CONFIG_DESCRIPTOR_LAST = 2
71};
72
73
74 struct INERTIA_API IOCommonDescriptor
75{
76 private:
77 IOCommonModeID commonID;
78 unsigned descrLength; // not part of specification
79
80 void SetDescrLength(IOCommonModeID _modeID);
81
82 public:
83 IOCommonDescriptor(IOCommonModeID _commonID);
84 IOCommonDescriptor(uint8_t const* in, const unsigned _ioLength);
85 IOCommonDescriptor(std::wstring const& argString);
86
87#ifdef WITH_BOOST_PROGRAM_OPTIONS
88 static const po::options_description GetOptionDescription();
89#endif
90
91 virtual void GetBytes(std::vector<uint8_t>& out) const;
92 virtual const std::wstring ToString() const;
93
94 IOCommonModeID GetCommonModeID() const;
95 unsigned GetDescrLength() const;
96};
97
98
99 struct INERTIA_API IOCommonDescriptorAdvGWSync
100 : IOCommonDescriptor
101{
102 uint8_t commonSyncRevision;
103 uint8_t commonSyncReserved;
104
105 //bitfield options
106 bool select6v6Over5v;
107
108 IOCommonDescriptorAdvGWSync();
109 IOCommonDescriptorAdvGWSync(uint8_t const* in, const unsigned _descrLength);
110 IOCommonDescriptorAdvGWSync(std::wstring const& argString);
111
112#ifdef WITH_BOOST_PROGRAM_OPTIONS
113 static const po::options_description GetOptionDescription();
114#endif
115
116 void GetBytes(std::vector<uint8_t>& out) const override;
117 const std::wstring ToString() const override;
118};
119
120
121 struct INERTIA_API IOModeDescriptor
122{
123 private:
124 IOModeID modeID;
125 unsigned descrLength; // not part of specification
126
127 void SetDescrLength(IOModeID _modeID);
128
129 public:
130 IOModeDescriptor(IOModeID _modeID);
131 IOModeDescriptor(uint8_t const* in, const unsigned _ioLength);
132 IOModeDescriptor(std::wstring const& argString);
133
134#ifdef WITH_BOOST_PROGRAM_OPTIONS
135 static const po::options_description GetOptionDescription();
136#endif
137
138 virtual void GetBytes(std::vector<uint8_t>& out) const;
139 virtual const std::wstring ToString() const;
140 virtual const std::wstring ToSimpleString() const;
141
142 IOModeID GetModeID() const;
143 unsigned GetDescrLength() const;
144};
145
146
147 struct INERTIA_API IOModeDescriptorADC
148 : IOModeDescriptor
149{
150 IOModeDescriptorADC();
151 IOModeDescriptorADC(uint8_t const* in, const unsigned _descrLength);
152 IOModeDescriptorADC(std::wstring const& argString);
153
154#ifdef WITH_BOOST_PROGRAM_OPTIONS
155 static const po::options_description GetOptionDescription();
156#endif
157
158 void GetBytes(std::vector<uint8_t>& out) const override;
159 const std::wstring ToString() const override;
160 const std::wstring ToSimpleString() const override;
161};
162
163
164 struct INERTIA_API IOModeDescriptorDAC
165 : IOModeDescriptor
166{
167 IOModeDescriptorDAC();
168 IOModeDescriptorDAC(uint8_t const* in, const unsigned _descrLength);
169 IOModeDescriptorDAC(std::wstring const& argString);
170
171#ifdef WITH_BOOST_PROGRAM_OPTIONS
172 static const po::options_description GetOptionDescription();
173#endif
174
175 void GetBytes(std::vector<uint8_t>& out) const override;
176 const std::wstring ToString() const override;
177 const std::wstring ToSimpleString() const override;
178};
179
180
181 struct INERTIA_API IOModeDescriptorSync
182 : IOModeDescriptor
183{
184 float syncFreq;
185 float phaseShift;
186
187 IOModeDescriptorSync();
188 IOModeDescriptorSync(uint8_t const* in, const unsigned _descrLength);
189 IOModeDescriptorSync(std::wstring const& argString);
190
191#ifdef WITH_BOOST_PROGRAM_OPTIONS
192 static const po::options_description GetOptionDescription();
193#endif
194
195 void GetBytes(std::vector<uint8_t>& out) const override;
196 const std::wstring ToString() const override;
197 const std::wstring ToSimpleString() const override;
198};
199
200
201 struct INERTIA_API IOModeDescriptorTriggerInput
202 : IOModeDescriptor
203{
204 IOModeTriggerInputType triggerType;
205 float holdOffTime;
206
207 // bitfield options
208 bool startLogging;
209 bool stopLogging;
210 bool resetFrameCounter;
211 bool sendTimestampMessage;
212
213 IOModeDescriptorTriggerInput();
214 IOModeDescriptorTriggerInput(uint8_t const* in, const unsigned _descrLength);
215 IOModeDescriptorTriggerInput(std::wstring const& argString);
216
217#ifdef WITH_BOOST_PROGRAM_OPTIONS
218 static const po::options_description GetOptionDescription();
219#endif
220
221 void GetBytes(std::vector<uint8_t>& out) const override;
222 const std::wstring ToString() const override;
223 const std::wstring ToSimpleString() const override;
224};
225
226
227 struct INERTIA_API IOModeDescriptorTriggerOutput
228 : IOModeDescriptor
229{
230 IOModeTriggerOutputType triggerType;
231 float pulseDuration;
232
233 // bitfield options
234 bool startLogging;
235 bool stopLogging;
236 bool resetFrameCounter;
237
238 bool levelResetStopLogging;
239 bool levelResetGPIOReset;
240
241 IOModeDescriptorTriggerOutput();
242 IOModeDescriptorTriggerOutput(uint8_t const* in, const unsigned _descrLength);
243 IOModeDescriptorTriggerOutput(std::wstring const& argString);
244
245#ifdef WITH_BOOST_PROGRAM_OPTIONS
246 static const po::options_description GetOptionDescription();
247#endif
248
249 void GetBytes(std::vector<uint8_t>& out) const override;
250 const std::wstring ToString() const override;
251 const std::wstring ToSimpleString() const override;
252};
253
254
255 struct INERTIA_API IOModeDescriptorInput
256 : IOModeDescriptor
257{
258 int16_t lowLevelThreshold;
259 int16_t highLevelThreshold;
260
261 // bitfield options
262 bool invertPolarity;
263 bool setLowLevelThreshold;
264 bool setHighLevelThreshold;
265 bool enable50OhmImp;
266
267 IOModeDescriptorInput();
268 IOModeDescriptorInput(uint8_t const* in, const unsigned _descrLength);
269 IOModeDescriptorInput(std::wstring const& argString);
270
271#ifdef WITH_BOOST_PROGRAM_OPTIONS
272 static const po::options_description GetOptionDescription();
273#endif
274
275 void GetBytes(std::vector<uint8_t>& out) const override;
276 const std::wstring ToString() const override;
277 const std::wstring ToSimpleString() const override;
278};
279
280
281 struct INERTIA_API IOModeDescriptorOutput
282 : IOModeDescriptor
283{
284 int16_t lowLevelVoltage;
285 int16_t highlevelVoltage;
286
287 // bitfield options
288 bool invertPolarity;
289 bool setLowLevelVoltage;
290 bool setHighLevelVoltage;
291 bool enable50OhmImp;
292
293 IOModeDescriptorOutput();
294 IOModeDescriptorOutput(uint8_t const* in, const unsigned _descrLength);
295 IOModeDescriptorOutput(std::wstring const& argString);
296
297#ifdef WITH_BOOST_PROGRAM_OPTIONS
298 static const po::options_description GetOptionDescription();
299#endif
300
301 void GetBytes(std::vector<uint8_t>& out) const override;
302 const std::wstring ToString() const override;
303 const std::wstring ToSimpleString() const override;
304};
305
306
307 struct INERTIA_API IOConfigurationDescriptor
308{
309 private:
310 IOConfigurationDescriptorType confDescriptorType;
311 uint8_t ioLength;
312
313 public:
314 IOConfigurationDescriptor(IOConfigurationDescriptorType _confDescriptorType);
315 IOConfigurationDescriptor(uint8_t const* in, const unsigned _ioLength);
316 IOConfigurationDescriptor(std::wstring const& argString);
317
318#ifdef WITH_BOOST_PROGRAM_OPTIONS
319 static const po::options_description GetOptionDescription();
320#endif
321
322 virtual void GetBytes(std::vector<uint8_t>& out) const;
323 virtual const std::wstring ToString() const;
324 virtual const std::wstring ToSimpleString() const;
325
326 IOConfigurationDescriptorType GetConfDescriptorType() const;
327 uint8_t GetIOLength() const;
328};
329
330
331 struct INERTIA_API IOConfigurationDescriptorCommon
332 : IOConfigurationDescriptor
333{
334 IOCommonDescriptorPtr ioCommonDescriptor;
335
336 IOConfigurationDescriptorCommon();
337 IOConfigurationDescriptorCommon(uint8_t const* in, const unsigned _ioLength);
338 IOConfigurationDescriptorCommon(std::wstring const& argString);
339
340#ifdef WITH_BOOST_PROGRAM_OPTIONS
341 static const po::options_description GetOptionDescription();
342#endif
343
344 void GetBytes(std::vector<uint8_t>& out) const override;
345 const std::wstring ToString() const override;
346};
347
348
349 struct INERTIA_API IOConfigurationDescriptorSpecific
350 : IOConfigurationDescriptor
351{
352 uint8_t ioID;
353 std::vector<IOModeDescriptorPtr> ioModeDescriptors;
354
355 IOConfigurationDescriptorSpecific(uint8_t _ioID);
356 IOConfigurationDescriptorSpecific(uint8_t const* in, const unsigned _ioLength);
357 IOConfigurationDescriptorSpecific(std::wstring const& argString);
358
359#ifdef WITH_BOOST_PROGRAM_OPTIONS
360 static const po::options_description GetOptionDescription();
361#endif
362
363 void GetBytes(std::vector<uint8_t>& out) const override;
364 const std::wstring ToString() const override;
365 const std::wstring ToSimpleString() const override;
366};
367
368
369 struct INERTIA_API IOCapabilityDescriptor
370{
371 uint8_t ioLength;
372 uint8_t ioID;
373
374 // bitfield options
375 bool capADC;
376 bool capDAC;
377 bool capOutput10v;
378 bool capOutput6v6;
379 bool capOutput5v;
380 bool capOutput5v50imp;
381 bool capOutput3v3;
382 bool capOutput3v350imp;
383 bool capOutputNeg5v50imp;
384 bool capOutputNeg10v;
385 bool capOutputPolarityInverse;
386
387 bool capInputLowThreshold;
388 bool capInputHighThreshold;
389 bool capInputPolarityInverse;
390 bool capInput50imp;
391 bool capSyncInput;
392 bool capSyncOutput;
393
394 bool capTriggerInputStartLog;
395 bool capTriggerInputStopLog;
396 bool capTriggerInputResetFrameCounter;
397 bool capTriggerInputSendTimestamp;
398 bool capTriggerInputEdge;
399 bool capTriggerInputLevel;
400 bool capTriggerInputHoldOff;
401 bool capTriggerOutputPulse;
402 bool capTriggerOutputLevel;
403 bool capTriggerOutputToggle;
404 bool capTriggerOutputStartLog;
405 bool capTriggerOutputStopLog;
406 bool capTriggerOutputResetFrameCounter;
407
408 IOCapabilityDescriptor();
409 IOCapabilityDescriptor(uint8_t const* in, const unsigned _ioLength);
410 IOCapabilityDescriptor(std::wstring const& argString);
411
412#ifdef WITH_BOOST_PROGRAM_OPTIONS
413 static const po::options_description GetOptionDescription();
414#endif
415
416 void GetBytes(std::vector<uint8_t>& out) const;
417 const std::wstring ToString() const;
418};
419
420
421 struct INERTIA_API IOConfiguration
422 : SpecificSensorSettings
423{
424 std::vector<IOConfigurationDescriptorPtr> ioConfigs;
425
426 IOConfiguration();
427 IOConfiguration(uint8_t const* in, const unsigned offset, const unsigned _length);
428 IOConfiguration(std::wstring const& argString);
429
430#ifdef WITH_BOOST_PROGRAM_OPTIONS
431 static const po::options_description GetOptionDescription();
432#endif
433
434 void GetBytes(std::vector<uint8_t>& out, const size_t bitfieldOffset) const override;
435 const std::wstring ToString() const override;
436 const std::wstring ToSimpleString() const;
437};
438
439
440 struct INERTIA_API IOCapability
441 : SpecificSensorSettings
442{
443 std::vector<IOCapabilityDescriptorPtr> ioCapabilities;
444
445 IOCapability();
446 IOCapability(uint8_t const* in, const unsigned offset, const unsigned _length);
447 IOCapability(std::wstring const& argString);
448
449#ifdef WITH_BOOST_PROGRAM_OPTIONS
450 static const po::options_description GetOptionDescription();
451#endif
452
453 void GetBytes(std::vector<uint8_t>& out, const size_t bitfieldOffset) const override;
454 const std::wstring ToString() const override;
455 const std::wstring ToSimpleString() const;
456};
457
458}
inertia
Definition FlashCommands.h:6
inertia::IOCommonDescriptorPtr
std::shared_ptr< IOCommonDescriptor > IOCommonDescriptorPtr
Pointer to an IOCommonDescriptor.
Definition IOConfigSettings.h:12
inertia::IOConfigurationDescriptorType
IOConfigurationDescriptorType
Definition IOConfigSettings.h:67
inertia::IOMessageID
IOMessageID
Definition IOConfigSettings.h:31
inertia::IOModeID
IOModeID
Definition IOConfigSettings.h:19
inertia::IOCommonMessageID
IOCommonMessageID
Definition IOConfigSettings.h:47
inertia::IOModeTriggerOutputType
IOModeTriggerOutputType
Definition IOConfigSettings.h:52
inertia::IOModeTriggerInputType
IOModeTriggerInputType
Definition IOConfigSettings.h:60
inertia::IOConfigurationDescriptorPtr
std::shared_ptr< IOConfigurationDescriptor > IOConfigurationDescriptorPtr
Pointer to an IOConfigurationDescriptor.
Definition IOConfigSettings.h:14
inertia::IOModeDescriptorPtr
std::shared_ptr< IOModeDescriptor > IOModeDescriptorPtr
Pointer to an IOModeDescriptor.
Definition IOConfigSettings.h:13
inertia::IOCapabilityDescriptorPtr
std::shared_ptr< IOCapabilityDescriptor > IOCapabilityDescriptorPtr
Pointer to an IOCapabilityDescriptor.
Definition IOConfigSettings.h:15
inertia::IOCommonModeID
IOCommonModeID
Definition IOConfigSettings.h:41
inertia::IOCapabilityDescriptor
Definition IOConfigSettings.h:370
inertia::IOCommonDescriptor
Definition IOConfigSettings.h:75
inertia::IOConfigurationDescriptor
Definition IOConfigSettings.h:308
inertia::IOModeDescriptor
Definition IOConfigSettings.h:122