djiparsetxt
interpretationTables.cpp
Go to the documentation of this file.
1 /**********
2 This program is free software: you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation, either version 3 of the License, or
5 (at your option) any later version.
6 
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11 
12 You should have received a copy of the GNU General Public License
13 along with this program. If not, see <http://www.gnu.org/licenses/>.
14 **********/
15 /*
16  A C++ program to parse DJI's ".txt" log files (recorded by the "DJI Go 4" app).
17  Version 2021-05-20
18 
19  Copyright (c) 2021 Live Networks, Inc. All rights reserved.
20  For the latest version of this program (and more information), visit http://djilogs.live555.com
21  For the latest version of this program (and more information), visit http://djilogs.live555.com
22 
23  Setting up our 'interpretation tables', each mapping integers to strings.
24  Implementation.
25 */
26 
27 #include "FieldDatabase.hh"
28 
31 
33  it = newInterpretationTable("OSD.flycState", "Other");
34  it->add(0, "Manual");
35  it->add(1, "Atti");
36  it->add(2, "Atti_CL");
37  it->add(3, "Atti_Hover");
38  it->add(4, "Hover");
39  it->add(5, "GPS_Blake");
40  it->add(6, "GPS_Atti");
41  it->add(7, "GPS_CL");
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");
59  it->add(28, "PANO");
60  it->add(29, "Farming");
61  it->add(30, "FPV");
62  it->add(31, "Sport");
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");
72 
74  it = newInterpretationTable("OSD.flycCommand", "Other");
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");
80  it->add(6, "GoHome");
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");
104 
106  it = newInterpretationTable("OSD.groundOrSky", "Unknown");
107  it->add(0, "Ground");
108  it->add(1, "Ground");
109  it->add(2, "Sky");
110  it->add(3, "Sky");
111 
113  it = newInterpretationTable("OSD.goHomeStatus", "Other");
114  it->add(0, "Standby");
115  it->add(1, "Preascending");
116  it->add(2, "Align");
117  it->add(3, "Ascending");
118  it->add(4, "Cruise");
119  it->add(5, "Braking");
120  it->add(6, "Bypassing");
121 
123  it = newInterpretationTable("OSD.batteryType", "Unknown");
124  it->add(1, "NonSmart");
125  it->add(2, "Smart");
126 
128  it = newInterpretationTable("OSD.flightAction", "Unknown");
129  it->add(0, "None");
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");
164 
166  it = newInterpretationTable("OSD.motorStartFailedCause", "Other");
167  it->add(0, "None");
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");
260 
262  it = newInterpretationTable("OSD.nonGPSCause", "Unknown");
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");
271 
273  it = newInterpretationTable("OSD.droneType", "Unknown");
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");
280  it->add(7, "WKM");
281  it->add(8, "Naza");
282  it->add(9, "A2");
283  it->add(10, "A3");
284  it->add(11, "P4");
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");
290  it->add(20, "N3");
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");
297  it->add(29, "P3SE");
298  it->add(30, "Matrice 210MTK");
299  it->add(58, "Mavic Air 2");
300 
302  it = newInterpretationTable("OSD.imuInitFailReason", "None");
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");
318 
320  it = newInterpretationTable("OSD.motorFailReason", "");
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");
328 
330  it = newInterpretationTable("OSD.ctrlDevice", "Other");
331  it->add(0, "RC");
332  it->add(1, "App");
333  it->add(2, "OnboardDevice");
334  it->add(3, "Camera");
335 
337  it = newInterpretationTable("GIMBAL.mode", "Other");
338  it->add(0, "YawNoFollow");
339  it->add(1, "FPV");
340  it->add(2, "YawFollow");
341 
343  it = newInterpretationTable("SMART_BATTERY.status", "???");
344  it->add(0, "None");
345 
347  it = newInterpretationTable("SMART_BATTERY.goHomeStatus", "Unknown");
348  it->add(0, "NonGoHome");
349  it->add(1, "GoHome");
350  it->add(2, "GoHomeAlready");
351 
353  it = newInterpretationTable("DEFORM.deformStatus", "Unknown");
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");
359 
361  it = newInterpretationTable("DEFORM.deformMode", "Other");
362  it->add(0, "Pack");
363  it->add(1, "Protect");
364  it->add(2, "Normal");
365 
367  it = newInterpretationTable("HOME.iocMode", "Other");
368  it->add(1, "CourseLock");
369  it->add(2, "HomeLock");
370  it->add(3, "HotspotSurround");
371 
373  it = newInterpretationTable("RECOVER.droneType", "Unknown");
374  it->add(1, "Inspire 1");
375  it->add(2, "P3 Standard");
376  it->add(3, "P3 Advanced");
377  it->add(4, "P3 Professional");
378  it->add(5, "OSMO");
379  it->add(6, "Matrice 100");
380  it->add(7, "P4");
381  it->add(8, "LB2");
382  it->add(9, "Inspire 1 Pro");
383  it->add(10, "A3");
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");
389  it->add(16, "A2");
390  it->add(17, "Inspire 2");
391  it->add(18, "OSMO Pro");
392  it->add(19, "OSMO Raw");
393  it->add(20, "SMO+");
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");
409 
411 
412  it = newInterpretationTable("RECOVER.appType", "Unknown");
413  it->add(1, "iOS");
414  it->add(2, "Android");
415  it->add(6, "Fly");
416 
417 
419 
420  it = newInterpretationTable("DETAILS.appType", "Unknown");
421  it->add(1, "iOS");
422  it->add(2, "Android");
423 }
void initializeInterpretationTables()
InterpretationTable * newInterpretationTable(char const *interpretedLabel, char const *defaultResultString)
void add(u_int32_t intValue, char const *strValue)