InertiaSDK

Loading...
Searching...
No Matches
PowerManagementSettings.h
1#pragma once
2
3#include "data/config/SensorSpecificSettings.h"
4
5 namespace inertia
6{
7
8 struct PowerManagementConfig;
9 struct PowerManagementCapability;
10 typedef std::shared_ptr<PowerManagementConfig> PowerManagementConfigPtr;
11 typedef std::shared_ptr<PowerManagementCapability> PowerManagementCapabilityPtr;
12
13
14 enum PowerManagementDescriptorID : uint8_t {
15 PM_UNIPOLAR_SUPPLY = 0,
16 PM_BIPOLAR_SUPPLY = 1,
17 PM_CHARGING = 2,
18 PM_DESCR_LAST
19};
20
21
22 struct INERTIA_API PowerManagementSettings
23 : SpecificSensorSettings
24{
25 std::vector<PowerManagementConfigPtr> pmConfigs;
26
27 PowerManagementSettings();
28 PowerManagementSettings(uint8_t const* in, const unsigned offset, const unsigned _length);
29 PowerManagementSettings(std::wstring const& argString);
30
31#ifdef WITH_BOOST_PROGRAM_OPTIONS
32 static const po::options_description GetOptionDescription();
33#endif
34
35 void GetBytes(std::vector<uint8_t>& out, const size_t bitfieldOffset) const override;
36 const std::wstring ToString() const override;
37 const std::wstring ToSimpleString() const;
38};
39
40
41 struct INERTIA_API PowerManagementConfig
42{
43 private:
44 uint8_t descrLength;
45 PowerManagementDescriptorID descrID;
46
47 public:
48 uint8_t instance;
49
50 PowerManagementConfig(PowerManagementDescriptorID const _descrID);
51 PowerManagementConfig(uint8_t const* in, const unsigned _length);
52 PowerManagementConfig(std::wstring const& argString);
53
54#ifdef WITH_BOOST_PROGRAM_OPTIONS
55 static const po::options_description GetOptionDescription();
56#endif
57
58 PowerManagementDescriptorID GetDescrID() const;
59
60 virtual unsigned GetLength() const;
61 virtual void GetBytes(std::vector<uint8_t>& out) const;
62 virtual const std::wstring ToString() const;
63};
64
65
66 struct INERTIA_API PowerManagementConfigUniPolar
67 : PowerManagementConfig
68{
69 bool enableSupply;
70 bool useSupplyOnDemand;
71
72 uint8_t dropoutVoltage;
73
74 float outputVoltage;
75
76 PowerManagementConfigUniPolar();
77 PowerManagementConfigUniPolar(uint8_t const* in, const unsigned _length);
78 PowerManagementConfigUniPolar(std::wstring const& argString);
79
80#ifdef WITH_BOOST_PROGRAM_OPTIONS
81 static const po::options_description GetOptionDescription();
82#endif
83
84 unsigned GetLength() const override;
85 void GetBytes(std::vector<uint8_t>& out) const override;
86 const std::wstring ToString() const override;
87};
88
89
90 struct INERTIA_API PowerManagementConfigBiPolar
91 : PowerManagementConfig
92{
93 bool enableSupply;
94 bool useSupplyOnDemand;
95
96 uint8_t dropoutVoltage;
97
98 float posOutputVoltage;
99 float negOutputVoltage;
100
101 PowerManagementConfigBiPolar();
102 PowerManagementConfigBiPolar(uint8_t const* in, const unsigned _length);
103 PowerManagementConfigBiPolar(std::wstring const& argString);
104
105#ifdef WITH_BOOST_PROGRAM_OPTIONS
106 static const po::options_description GetOptionDescription();
107#endif
108
109 unsigned GetLength() const override;
110 void GetBytes(std::vector<uint8_t>& out) const override;
111 const std::wstring ToString() const override;
112};
113
114
115 struct INERTIA_API PowerManagementConfigCharging
116 : PowerManagementConfig
117{
118 bool enableCharger;
119 bool enableTemperatureCompensation;
120
121 uint16_t chargeCurrentLimit;
122
123 std::vector<uint8_t> applicationData;
124
125 PowerManagementConfigCharging();
126 PowerManagementConfigCharging(uint8_t const* in, const unsigned _length);
127 PowerManagementConfigCharging(std::wstring const& argString);
128
129#ifdef WITH_BOOST_PROGRAM_OPTIONS
130 static const po::options_description GetOptionDescription();
131#endif
132
133 unsigned GetLength() const override;
134 void GetBytes(std::vector<uint8_t>& out) const override;
135 const std::wstring ToString() const override;
136};
137
138
139// ------------- capabilities -------------
140
141
142 struct INERTIA_API PowerManagementCapabilities
143 : SpecificSensorSettings
144{
145 std::vector<PowerManagementCapabilityPtr> pmCapabilities;
146
147 PowerManagementCapabilities();
148 PowerManagementCapabilities(uint8_t const* in, const unsigned offset, const unsigned _length);
149 PowerManagementCapabilities(std::wstring const& argString);
150
151#ifdef WITH_BOOST_PROGRAM_OPTIONS
152 static const po::options_description GetOptionDescription();
153#endif
154
155 void GetBytes(std::vector<uint8_t>& out, const size_t bitfieldOffset) const override;
156 const std::wstring ToString() const override;
157 const std::wstring ToSimpleString() const;
158};
159
160
161 struct INERTIA_API PowerManagementCapability
162{
163 private:
164 uint8_t descrLength;
165 PowerManagementDescriptorID descrID;
166
167 public:
168 uint8_t instance;
169
170 PowerManagementCapability(PowerManagementDescriptorID const _descrID);
171 PowerManagementCapability(uint8_t const* in, const unsigned _length);
172 PowerManagementCapability(std::wstring const& argString);
173
174#ifdef WITH_BOOST_PROGRAM_OPTIONS
175 static const po::options_description GetOptionDescription();
176#endif
177
178 PowerManagementDescriptorID GetDescrID() const;
179
180 virtual unsigned GetLength() const;
181 virtual void GetBytes(std::vector<uint8_t>& out) const;
182 virtual const std::wstring ToString() const;
183};
184
185
186 struct INERTIA_API PowerManagementCapabilityUniPolar
187 : PowerManagementCapability
188{
189 uint8_t hardwareID;
190 uint8_t bitfield;
191 uint8_t applicationID;
192
193 PowerManagementCapabilityUniPolar();
194 PowerManagementCapabilityUniPolar(uint8_t const* in, const unsigned _length);
195 PowerManagementCapabilityUniPolar(std::wstring const& argString);
196
197#ifdef WITH_BOOST_PROGRAM_OPTIONS
198 static const po::options_description GetOptionDescription();
199#endif
200
201 unsigned GetLength() const override;
202 void GetBytes(std::vector<uint8_t>& out) const override;
203 const std::wstring ToString() const override;
204};
205
206
207 struct INERTIA_API PowerManagementCapabilityBiPolar
208 : PowerManagementCapability
209{
210 uint8_t hardwareID;
211 uint8_t bitfield;
212 uint8_t applicationID;
213
214 PowerManagementCapabilityBiPolar();
215 PowerManagementCapabilityBiPolar(uint8_t const* in, const unsigned _length);
216 PowerManagementCapabilityBiPolar(std::wstring const& argString);
217
218#ifdef WITH_BOOST_PROGRAM_OPTIONS
219 static const po::options_description GetOptionDescription();
220#endif
221
222 unsigned GetLength() const override;
223 void GetBytes(std::vector<uint8_t>& out) const override;
224 const std::wstring ToString() const override;
225};
226
227
228 struct INERTIA_API PowerManagementCapabilityCharging
229 : PowerManagementCapability
230{
231 uint8_t hardwareID;
232 uint16_t maxChargeCurrent;
233
234 std::vector<uint8_t> applicationData;
235
236 PowerManagementCapabilityCharging();
237 PowerManagementCapabilityCharging(uint8_t const* in, const unsigned _length);
238 PowerManagementCapabilityCharging(std::wstring const& argString);
239
240#ifdef WITH_BOOST_PROGRAM_OPTIONS
241 static const po::options_description GetOptionDescription();
242#endif
243
244 unsigned GetLength() const override;
245 void GetBytes(std::vector<uint8_t>& out) const override;
246 const std::wstring ToString() const override;
247};
248
249}
inertia
Definition FlashCommands.h:6
inertia::PowerManagementCapability
Definition PowerManagementSettings.h:162
inertia::PowerManagementConfig
Definition PowerManagementSettings.h:42