#include <FieldDatabase.hh>
|
| FieldDatabase () |
|
virtual | ~FieldDatabase () |
|
void | addByteField (char const *label, u_int8_t value, int isSigned) |
|
void | add2ByteField (char const *label, u_int16_t value, int isSigned) |
|
void | add2ByteDateField (char const *label, u_int16_t value) |
|
void | add4ByteField (char const *label, u_int32_t value, int isSigned) |
|
void | add4ByteVersionField (char const *label, u_int32_t value) |
|
void | addFloatField (char const *label, float value) |
|
void | addDoubleField (char const *label, double value) |
|
void | add8ByteTimestampField (char const *label, u_int64_t value, int isInMilliseconds) |
|
void | addStringField (char const *label, char const *str) |
|
void | outputField (char const *label, unsigned numFractionalDigits=0) |
|
void | outputFieldAsBoolean (char const *label) |
|
void | outputFieldInterpreted (char const *label, char const *interpretedLabel) |
|
Definition at line 76 of file FieldDatabase.hh.
◆ FieldDatabase()
FieldDatabase::FieldDatabase |
( |
| ) |
|
◆ ~FieldDatabase()
FieldDatabase::~FieldDatabase |
( |
| ) |
|
|
virtual |
Definition at line 52 of file FieldDatabase.cpp.
56 std::unordered_map<char const*, FieldValue*>::iterator itr;
57 for (itr =
fUMap.begin(); itr !=
fUMap.end(); itr++) {
63 std::unordered_map<char const*, InterpretationTable*>::iterator itr;
std::unordered_map< char const *, FieldValue * > fUMap
std::unordered_map< char const *, InterpretationTable * > fInterpretationTableMap
References fInterpretationTableMap, and fUMap.
◆ add2ByteDateField()
void FieldDatabase::add2ByteDateField |
( |
char const * |
label, |
|
|
u_int16_t |
value |
|
) |
| |
◆ add2ByteField()
void FieldDatabase::add2ByteField |
( |
char const * |
label, |
|
|
u_int16_t |
value, |
|
|
int |
isSigned |
|
) |
| |
◆ add4ByteField()
void FieldDatabase::add4ByteField |
( |
char const * |
label, |
|
|
u_int32_t |
value, |
|
|
int |
isSigned |
|
) |
| |
◆ add4ByteVersionField()
void FieldDatabase::add4ByteVersionField |
( |
char const * |
label, |
|
|
u_int32_t |
value |
|
) |
| |
◆ add8ByteTimestampField()
void FieldDatabase::add8ByteTimestampField |
( |
char const * |
label, |
|
|
u_int64_t |
value, |
|
|
int |
isInMilliseconds |
|
) |
| |
◆ addByteField()
void FieldDatabase::addByteField |
( |
char const * |
label, |
|
|
u_int8_t |
value, |
|
|
int |
isSigned |
|
) |
| |
◆ addDoubleField()
void FieldDatabase::addDoubleField |
( |
char const * |
label, |
|
|
double |
value |
|
) |
| |
◆ addFieldValue()
void FieldDatabase::addFieldValue |
( |
char const * |
label, |
|
|
FieldValue * |
fieldValue |
|
) |
| |
|
private |
◆ addFloatField()
void FieldDatabase::addFloatField |
( |
char const * |
label, |
|
|
float |
value |
|
) |
| |
◆ addStringField()
void FieldDatabase::addStringField |
( |
char const * |
label, |
|
|
char const * |
str |
|
) |
| |
◆ initializeInterpretationTables()
void FieldDatabase::initializeInterpretationTables |
( |
| ) |
|
|
private |
Definition at line 29 of file interpretationTables.cpp.
36 it->
add(2,
"Atti_CL");
37 it->
add(3,
"Atti_Hover");
39 it->
add(5,
"GPS_Blake");
40 it->
add(6,
"GPS_Atti");
42 it->
add(8,
"GPS_HomeLock");
43 it->
add(9,
"GPS_HotPoint");
44 it->
add(10,
"AssistedTakeoff");
45 it->
add(11,
"AutoTakeoff");
46 it->
add(12,
"AutoLanding");
47 it->
add(13,
"AttiLanding");
48 it->
add(14,
"NaviGo");
49 it->
add(15,
"GoHome");
50 it->
add(16,
"ClickGo");
51 it->
add(17,
"Joystick");
52 it->
add(18,
"GPS_Atti_Wristband");
53 it->
add(19,
"Cinematic");
54 it->
add(23,
"Atti_Limited");
55 it->
add(24,
"GPS_Atti_Limited");
56 it->
add(25,
"NaviMissionFollow");
57 it->
add(26,
"NaviSubMode_Tracking");
58 it->
add(27,
"NaviSubMode_Pointing");
60 it->
add(29,
"Farming");
63 it->
add(32,
"Novice");
64 it->
add(33,
"ForceLanding");
65 it->
add(35,
"TerrainTracking");
66 it->
add(36,
"NaviAdvGoHome");
67 it->
add(37,
"NaviAdvLanding");
68 it->
add(38,
"TripodGPS");
69 it->
add(39,
"TrackHeadlock");
70 it->
add(41,
"EngineStart");
71 it->
add(43,
"GentleGPS");
75 it->
add(1,
"AutoFly");
76 it->
add(2,
"AutoLanding");
77 it->
add(3,
"HomePointNow");
78 it->
add(4,
"HomePointHot");
79 it->
add(5,
"HomePointLock");
81 it->
add(7,
"StartMotor");
82 it->
add(8,
"StopMotor");
83 it->
add(9,
"Calibration");
84 it->
add(10,
"DeformProtecClose");
85 it->
add(11,
"DeformProtecOpen");
86 it->
add(12,
"DropGoHome");
87 it->
add(13,
"DropTakeOff");
88 it->
add(14,
"DropLanding");
89 it->
add(15,
"DynamicHomePointOpen");
90 it->
add(16,
"DynamicHomePointClose");
91 it->
add(17,
"FollowFunctionOpen");
92 it->
add(18,
"FollowFunctionClose");
93 it->
add(19,
"IOCOpen");
94 it->
add(20,
"IOCClose");
95 it->
add(21,
"DropCalibration");
96 it->
add(22,
"PackMode");
97 it->
add(23,
"UnPackMode");
98 it->
add(24,
"EnterManualMode");
99 it->
add(25,
"StopDeform");
100 it->
add(28,
"DownDeform");
101 it->
add(29,
"UpDeform");
102 it->
add(30,
"ForceLanding");
103 it->
add(31,
"ForceLanding2");
107 it->
add(0,
"Ground");
108 it->
add(1,
"Ground");
114 it->
add(0,
"Standby");
115 it->
add(1,
"Preascending");
117 it->
add(3,
"Ascending");
118 it->
add(4,
"Cruise");
119 it->
add(5,
"Braking");
120 it->
add(6,
"Bypassing");
124 it->
add(1,
"NonSmart");
130 it->
add(1,
"WarningPowerGoHome");
131 it->
add(2,
"WarningPowerLanding");
132 it->
add(3,
"SmartPowerGoHome");
133 it->
add(4,
"SmartPowerLanding");
134 it->
add(5,
"LowVoltageLanding");
135 it->
add(6,
"LowVoltageGoHome");
136 it->
add(7,
"SeriousLowVoltageLanding");
137 it->
add(8,
"RC_OnekeyGoHome");
138 it->
add(9,
"RC_AssistantTakeoff");
139 it->
add(10,
"RC_AutoTakeoff");
140 it->
add(11,
"RC_AutoLanding");
141 it->
add(12,
"AppAutoGoHome");
142 it->
add(13,
"AppAutoLanding");
143 it->
add(14,
"AppAutoTakeoff");
144 it->
add(15,
"OutOfControlGoHome");
145 it->
add(16,
"ApiAutoTakeoff");
146 it->
add(17,
"ApiAutoLanding");
147 it->
add(18,
"ApiAutoGoHome");
148 it->
add(19,
"AvoidGroundLanding");
149 it->
add(20,
"AirportAvoidLanding");
150 it->
add(21,
"TooCloseGoHomeLanding");
151 it->
add(22,
"TooFarGoHomeLanding");
152 it->
add(23,
"App_WP_Mission");
153 it->
add(24,
"WP_AutoTakeoff");
154 it->
add(25,
"GoHomeAvoid");
155 it->
add(26,
"pGoHomeFinish");
156 it->
add(27,
"VertLowLimitLanding");
157 it->
add(28,
"BatteryForceLanding");
158 it->
add(29,
"MC_ProtectGoHome");
159 it->
add(30,
"MotorblockLanding");
160 it->
add(31,
"AppRequestForceLanding");
161 it->
add(32,
"FakeBatteryLanding");
162 it->
add(33,
"RTH_ComingObstacleLanding");
163 it->
add(34,
"IMUErrorRTH");
168 it->
add(1,
"CompassError");
169 it->
add(2,
"AssistantProtected");
170 it->
add(3,
"DeviceLocked");
171 it->
add(4,
"DistanceLimit");
172 it->
add(5,
"IMUNeedCalibration");
173 it->
add(6,
"IMUSNError");
174 it->
add(7,
"IMUWarning");
175 it->
add(8,
"CompassCalibrating");
176 it->
add(9,
"AttiError");
177 it->
add(10,
"NoviceProtected");
178 it->
add(11,
"BatteryCellError");
179 it->
add(12,
"BatteryCommuniteError");
180 it->
add(13,
"SeriousLowVoltage");
181 it->
add(14,
"SeriousLowPower");
182 it->
add(15,
"LowVoltage");
183 it->
add(16,
"TempureVolLow");
184 it->
add(17,
"SmartLowToLand");
185 it->
add(18,
"BatteryNotReady");
186 it->
add(19,
"SimulatorMode");
187 it->
add(20,
"PackMode");
188 it->
add(21,
"AttitudeAbnormal");
189 it->
add(22,
"UnActive");
190 it->
add(23,
"FlyForbiddenError");
191 it->
add(24,
"BiasError");
192 it->
add(25,
"EscError");
193 it->
add(26,
"ImuInitError");
194 it->
add(27,
"SystemUpgrade");
195 it->
add(28,
"SimulatorStarted");
196 it->
add(29,
"ImuingError");
197 it->
add(30,
"AttiAngleOver");
198 it->
add(31,
"GyroscopeError");
199 it->
add(32,
"AcceleratorError");
200 it->
add(33,
"CompassFailed");
201 it->
add(34,
"BarometerError");
202 it->
add(35,
"BarometerNegative");
203 it->
add(36,
"CompassBig");
204 it->
add(37,
"GyroscopeBiasBig");
205 it->
add(38,
"AcceleratorBiasBig");
206 it->
add(39,
"CompassNoiseBig");
207 it->
add(40,
"BarometerNoiseBig");
208 it->
add(41,
"InvalidSn");
209 it->
add(44,
"FlashOperating");
210 it->
add(45,
"GPSdisconnect");
211 it->
add(47,
"SDCardException");
212 it->
add(61,
"IMUNoconnection");
213 it->
add(62,
"RCCalibration");
214 it->
add(63,
"RCCalibrationException");
215 it->
add(64,
"RCCalibrationUnfinished");
216 it->
add(65,
"RCCalibrationException2");
217 it->
add(66,
"RCCalibrationException3");
218 it->
add(67,
"AircraftTypeMismatch");
219 it->
add(68,
"FoundUnfinishedModule");
220 it->
add(70,
"CyroAbnormal");
221 it->
add(71,
"BaroAbnormal");
222 it->
add(72,
"CompassAbnormal");
223 it->
add(73,
"GPS_Abnormal");
224 it->
add(74,
"NS_Abnormal");
225 it->
add(75,
"TopologyAbnormal");
226 it->
add(76,
"RC_NeedCali");
227 it->
add(77,
"InvalidFloat");
228 it->
add(78,
"M600_BAT_TOO_LITTLE");
229 it->
add(79,
"M600_BAT_AUTH_ERR");
230 it->
add(80,
"M600_BAT_COMM_ERR");
231 it->
add(81,
"M600_BAT_DIF_VOLT_LARGE_1");
232 it->
add(82,
"M600_BAT_DIF_VOLT_LARGE_2");
233 it->
add(83,
"InvalidVersion");
234 it->
add(84,
"GimbalGyroAbnormal");
235 it->
add(85,
"GimbalESC_PitchNonData");
236 it->
add(86,
"GimbalESC_RollNonData");
237 it->
add(87,
"GimbalESC_YawNonData");
238 it->
add(88,
"GimbalFirmwIsUpdating");
239 it->
add(89,
"GimbalDisorder");
240 it->
add(90,
"GimbalPitchShock");
241 it->
add(91,
"GimbalRollShock");
242 it->
add(92,
"GimbalYawShock");
243 it->
add(93,
"IMUcCalibrationFinished");
244 it->
add(101,
"BattVersionError");
245 it->
add(102,
"RTK_BadSignal");
246 it->
add(103,
"RTK_DeviationError");
247 it->
add(112,
"ESC_Calibrating");
248 it->
add(113,
"GPS_SignInvalid");
249 it->
add(114,
"GimbalIsCalibrating");
250 it->
add(115,
"LockByApp");
251 it->
add(116,
"StartFlyHeightError");
252 it->
add(117,
"ESC_VersionNotMatch");
253 it->
add(118,
"IMU_ORI_NotMatch");
254 it->
add(119,
"StopByApp");
255 it->
add(120,
"CompassIMU_ORI_NotMatch");
256 it->
add(122,
"CompassIMU_ORI_NotMatch");
257 it->
add(123,
"BatteryOverTemperature");
258 it->
add(124,
"BatteryInstallError");
259 it->
add(125,
"BeImpact");
263 it->
add(0,
"Already");
264 it->
add(1,
"Forbid");
265 it->
add(2,
"GpsNumNonEnough");
266 it->
add(3,
"GpsHdopLarge");
267 it->
add(4,
"GpsPositionNonMatch");
268 it->
add(5,
"SpeedErrorLarge");
269 it->
add(6,
"YawErrorLarge");
270 it->
add(7,
"CompassErrorLarge");
274 it->
add(1,
"Inspire 1");
275 it->
add(2,
"P3 Advanced");
276 it->
add(3,
"P3 Professional");
277 it->
add(4,
"P3 Standard");
278 it->
add(5,
"OpenFrame");
279 it->
add(6,
"AceOne");
285 it->
add(14,
"Matrice 600");
286 it->
add(15,
"P3 4K");
287 it->
add(16,
"Mavic");
288 it->
add(17,
"Inspire 2");
289 it->
add(18,
"P4 Professional");
291 it->
add(21,
"Spark");
292 it->
add(23,
"Matrice 600 Pro");
293 it->
add(24,
"Mavic Air");
294 it->
add(25,
"Matrice 200");
295 it->
add(27,
"P4 Advanced");
296 it->
add(28,
"Matrice 210");
298 it->
add(30,
"Matrice 210MTK");
299 it->
add(58,
"Mavic Air 2");
303 it->
add(0,
"MonitorError");
304 it->
add(1,
"CollectingData");
305 it->
add(3,
"AcceDead");
306 it->
add(4,
"CompassDead");
307 it->
add(5,
"BarometerDead");
308 it->
add(6,
"BarometerNegative");
309 it->
add(7,
"CompassModTooLarge");
310 it->
add(8,
"GyroBiasTooLarge");
311 it->
add(9,
"AcceBiasTooLarge");
312 it->
add(10,
"CompassNoiseTooLarge");
313 it->
add(11,
"BarometerNoiseTooLarge");
314 it->
add(12,
"WaitingMcStationary");
315 it->
add(13,
"AcceMoveTooLarge");
316 it->
add(14,
"McHeaderMoved");
317 it->
add(15,
"McVibrated");
321 it->
add(94,
"TakeoffException");
322 it->
add(95,
"ESC_StallNearGround");
323 it->
add(96,
"ESC_UnbalanceOnGround");
324 it->
add(97,
"ESC_PART_EMPTYOnGround");
325 it->
add(98,
"EngineStartFailed");
326 it->
add(99,
"AutoTakeoffLaunchFailed");
327 it->
add(100,
"RollOverOnGround");
333 it->
add(2,
"OnboardDevice");
334 it->
add(3,
"Camera");
338 it->
add(0,
"YawNoFollow");
340 it->
add(2,
"YawFollow");
348 it->
add(0,
"NonGoHome");
349 it->
add(1,
"GoHome");
350 it->
add(2,
"GoHomeAlready");
354 it->
add(1,
"FoldComplete");
355 it->
add(2,
"Folding");
356 it->
add(3,
"StretchComplete");
357 it->
add(4,
"Stretching");
358 it->
add(5,
"StopDeformation");
363 it->
add(1,
"Protect");
364 it->
add(2,
"Normal");
368 it->
add(1,
"CourseLock");
369 it->
add(2,
"HomeLock");
370 it->
add(3,
"HotspotSurround");
374 it->
add(1,
"Inspire 1");
375 it->
add(2,
"P3 Standard");
376 it->
add(3,
"P3 Advanced");
377 it->
add(4,
"P3 Professional");
379 it->
add(6,
"Matrice 100");
382 it->
add(9,
"Inspire 1 Pro");
384 it->
add(11,
"Matrice 600");
385 it->
add(12,
"P3 4K");
386 it->
add(13,
"Mavic Pro");
387 it->
add(14,
"Zenmuse XT");
388 it->
add(15,
"Inspire 1 RAW");
390 it->
add(17,
"Inspire 2");
391 it->
add(18,
"OSMO Pro");
392 it->
add(19,
"OSMO Raw");
394 it->
add(21,
"Mavic");
395 it->
add(22,
"OSMO Mobile");
396 it->
add(23,
"OrangeCV600");
397 it->
add(24,
"P4 Professional");
398 it->
add(25,
"N3 FC");
399 it->
add(26,
"Spark");
400 it->
add(27,
"Matrice 600 Pro");
401 it->
add(28,
"P4 Advanced");
402 it->
add(30,
"AG405");
403 it->
add(31,
"Matrice 200");
404 it->
add(33,
"Matrice 210");
405 it->
add(34,
"Matrice 210RTK");
406 it->
add(38,
"Mavic Air");
407 it->
add(59,
"Mavic Mini");
408 it->
add(67,
"Mavic Air 2");
414 it->
add(2,
"Android");
422 it->
add(2,
"Android");
InterpretationTable * newInterpretationTable(char const *interpretedLabel, char const *defaultResultString)
void add(u_int32_t intValue, char const *strValue)
References InterpretationTable::add(), and newInterpretationTable().
Referenced by FieldDatabase().
◆ lookupFieldValue()
FieldValue const * FieldDatabase::lookupFieldValue |
( |
char const * |
label | ) |
|
|
private |
◆ newInterpretationTable()
InterpretationTable * FieldDatabase::newInterpretationTable |
( |
char const * |
interpretedLabel, |
|
|
char const * |
defaultResultString |
|
) |
| |
|
private |
◆ outputField()
void FieldDatabase::outputField |
( |
char const * |
label, |
|
|
unsigned |
numFractionalDigits = 0 |
|
) |
| |
Definition at line 30 of file fieldOutput.cpp.
32 if (fieldValue == NULL)
return;
34 int timeIsInMilliseconds = 0;
36 switch (fieldValue->
fType) {
38 printf(
"%u", fieldValue->
fByte);
42 printf(
"%d", (int8_t)(fieldValue->
fByte));
46 printf(
"%u", fieldValue->
fBytes2);
50 printf(
"%d", (int16_t)(fieldValue->
fBytes2));
55 printf(
"%u/%02u/%02u",
56 ((fieldValue->
fBytes2&0xFE00)>>9) + 1980,
57 (fieldValue->
fBytes2&0x01E0)>>5,
63 printf(
"%u", fieldValue->
fBytes4);
67 printf(
"%d", (int32_t)(fieldValue->
fBytes4));
72 u_int32_t v = fieldValue->
fBytes4;
73 printf(
"%u.%u.%u", (v>>24)&0xFF, (v>>16)&0xFF, (v>>8)&0xFF);
77 printf(
"%.*f", numFractionalDigits, fieldValue->
fFloat);
81 printf(
"%.*f", numFractionalDigits, fieldValue->
fDouble);
85 timeIsInMilliseconds = 1;
89 u_int64_t time = fieldValue->
fBytes8;
90 u_int64_t timeInSeconds;
91 unsigned milliseconds;
93 if (timeIsInMilliseconds) {
94 timeInSeconds = time/1000;
95 milliseconds = time%1000;
101 struct tm* convertedTime = gmtime((time_t*)&timeInSeconds);
102 if (convertedTime == NULL) {
103 fprintf(stderr,
"outputField(8-byte timestamp): gmtime(%llu) failed!\n", timeInSeconds);
106 printf(
"%u/%02u/%02u %02u:%02u:%02u",
107 convertedTime->tm_year + 1900, convertedTime->tm_mon + 1, convertedTime->tm_mday,
108 convertedTime->tm_hour, convertedTime->tm_min, convertedTime->tm_sec);
109 if (timeIsInMilliseconds) {
110 printf(
".%03u", milliseconds);
115 printf(
"%s", fieldValue->
fStr);
FieldValue const * lookupFieldValue(char const *label)
References Date2Byte, Double, FieldValue::fByte, FieldValue::fBytes2, FieldValue::fBytes4, FieldValue::fBytes8, FieldValue::fDouble, FieldValue::fFloat, Float, FieldValue::fStr, FieldValue::fType, Integer2ByteSigned, Integer2ByteUnsigned, Integer4ByteSigned, Integer4ByteUnsigned, IntegerByteSigned, IntegerByteUnsigned, lookupFieldValue(), String, Timestamp8ByteInMilliseconds, Timestamp8ByteInSeconds, and Version4Byte.
◆ outputFieldAsBoolean()
void FieldDatabase::outputFieldAsBoolean |
( |
char const * |
label | ) |
|
Definition at line 121 of file fieldOutput.cpp.
123 if (fieldValue == NULL)
return;
125 int booleanValue = 0;
127 switch (fieldValue->
fType) {
130 booleanValue = fieldValue->
fByte != 0;
135 booleanValue = fieldValue->
fBytes2 != 0;
140 booleanValue = fieldValue->
fBytes4 != 0;
148 printf(booleanValue ?
"True" :
"False");
FieldValue const * lookupFieldValue(char const *label)
References FieldValue::fByte, FieldValue::fBytes2, FieldValue::fBytes4, FieldValue::fType, Integer2ByteSigned, Integer2ByteUnsigned, Integer4ByteSigned, Integer4ByteUnsigned, IntegerByteSigned, IntegerByteUnsigned, and lookupFieldValue().
◆ outputFieldInterpreted()
void FieldDatabase::outputFieldInterpreted |
( |
char const * |
label, |
|
|
char const * |
interpretedLabel |
|
) |
| |
Definition at line 151 of file fieldOutput.cpp.
154 if (fieldValue == NULL)
return;
158 switch (fieldValue->
fType) {
160 intValue = (u_int32_t)(fieldValue->
fByte);
164 intValue = (u_int32_t)(fieldValue->
fBytes2);
168 intValue = fieldValue->
fBytes4;;
178 if (interpretationTable == NULL)
return;
181 printf(
"%s", interpretationTable->
lookup(intValue));
std::unordered_map< char const *, InterpretationTable * > fInterpretationTableMap
char const * lookup(u_int32_t intValue)
FieldValue const * lookupFieldValue(char const *label)
References FieldValue::fByte, FieldValue::fBytes2, FieldValue::fBytes4, fInterpretationTableMap, FieldValue::fType, Integer2ByteUnsigned, Integer4ByteUnsigned, IntegerByteUnsigned, InterpretationTable::lookup(), and lookupFieldValue().
◆ fInterpretationTableMap
◆ fUMap
std::unordered_map<char const*, FieldValue*> FieldDatabase::fUMap |
|
private |
The documentation for this class was generated from the following files: