InertiaSDK

Loading...
Searching...
No Matches
AxisConfig.h
Go to the documentation of this file.
1
2#pragma once
3
4#include "data/config/AbstractConfig.h"
5
6 namespace inertia
7{
8
10 enum AxisConfigDescriptorType {
11 AXIS_DESCRIPTOR_CONFIGURATION = 0,
12 AXIS_DESCRIPTOR_CAPABILITIES = 1,
13 AXIS_DESCRIPTOR_TYPE_LAST = 2
14};
15
16
17 struct INERTIA_API AxisConfig
18{
19 public:
20 uint8_t GetHeaderRevision() const;
21 uint8_t GetSensorRevision() const;
22 uint8_t GetSensorID() const;
23 unsigned GetHeaderSize() const;
24 unsigned GetLength() const;
25 AxisConfigDescriptorType GetDescriptorType() const;
26 virtual unsigned GetInstanceMask() const = 0;
27
28 virtual void GetBytes(std::vector<uint8_t>& out) const = 0;
29 virtual const std::wstring ToString() const = 0;
30 virtual const std::wstring ToSimpleString(uint16_t const globalRate) const = 0;
31
32 static std::vector<std::pair<ConfigType, uint8_t> > GetConfigsWithCapabilities();
33 static bool HasDescriptorType(ConfigType const config, uint8_t const _sensorID);
34
35 protected:
36 ConfigType configType;
37 AxisConfigDescriptorType descriptorType;
38
39 uint8_t headerRevision;
40 uint8_t sensorRevision;
41 uint8_t sensorID;
42 unsigned length;
43 std::vector<uint8_t> unparsedData;
44
45 AxisConfig(ConfigType const config, AxisConfigDescriptorType const _descriptorType, uint8_t const _sensorID, uint8_t const _headerRevision, uint8_t const _sensorRevision);
46 AxisConfig(ConfigType const config, uint8_t const* in, const unsigned _length);
47 AxisConfig(ConfigType const config, std::wstring const& argString);
48 virtual ~AxisConfig();
49 AxisConfig(AxisConfig const&) = default;
50 AxisConfig& operator = (AxisConfig const&) = default;
51
52#ifdef WITH_BOOST_PROGRAM_OPTIONS
53 static const po::options_description GetOptionDescription();
54#endif
55
56 void SetLength(std::vector<uint8_t>& out, size_t const offset, size_t const cfgLen) const;
57};
58
59
60 struct INERTIA_API AxisConfigHeader
61 : AxisConfig
62{
63 AxisConfigHeader(ConfigType const config, uint8_t const* in, const unsigned _length);
64
65 void GetBytes(std::vector<uint8_t>& out) const override;
66 const std::wstring ToString() const override;
67 const std::wstring ToSimpleString(uint16_t const globalRate) const override;
68 unsigned GetInstanceMask() const override;
69};
70
71
72 typedef std::shared_ptr<AxisConfig> AxisConfigPtr;
73
74}
inertia
Definition FlashCommands.h:6
inertia::AxisConfigDescriptorType
AxisConfigDescriptorType
Definition AxisConfig.h:10
inertia::AxisConfigPtr
std::shared_ptr< AxisConfig > AxisConfigPtr
Pointer to an AxisConfig.
Definition AxisConfig.h:72
inertia::ConfigType
ConfigType
Definition ConfigChannel.h:7