djiparsetxt
rowOutput.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 
22  Outputting a row of data from the table.
23  Implementation.
24 */
25 
27 #include <stdio.h>
28 
29 #define separator ","
30 #define o_(label,nFrac) if (outputColumnLabels) printf(label); else fFieldDatabase->outputField(label, nFrac)
31 #define oInterpreted_(label,interpretedLabel) if (outputColumnLabels) printf(interpretedLabel); else fFieldDatabase->outputFieldInterpreted(label, interpretedLabel)
32 #define oBoolean_(label) if (outputColumnLabels) printf(label); else fFieldDatabase->outputFieldAsBoolean(label)
33 #define oFirst(label) o_(label,0)
34 #define oFrac(label,nFrac) do { printf(separator); o_(label,nFrac); } while (0)
35 #define o(label) oFrac(label,0)
36 #define oInterpreted(label,interpretedLabel) do { printf(separator); oInterpreted_(label,interpretedLabel); } while (0)
37 #define oBoolean(label) do { printf(separator); oBoolean_(label); } while (0)
38 
39 void RecordAndDetailsParser::outputOneRow(int outputColumnLabels) {
40  oFirst("CUSTOM.updateTime");
41  oFrac("CUSTOM.hSpeed", 2);
42  oFrac("CUSTOM.distance", 2);
43  oFrac("OSD.latitude", 6);
44  oFrac("OSD.longitude", 6);
45  oFrac("OSD.height", 1);
46  oFrac("OSD.xSpeed", 1);
47  oFrac("OSD.ySpeed", 1);
48  oFrac("OSD.zSpeed", 1);
49  oFrac("OSD.pitch", 1);
50  oFrac("OSD.roll", 1);
51  oFrac("OSD.yaw", 1);
52  oInterpreted("OSD.flycState.RAW", "OSD.flycState");
53  oInterpreted("OSD.flycCommand.RAW", "OSD.flycCommand");
54  oBoolean("OSD.canIOCWork");
55  oInterpreted("OSD.groundOrSky.RAW", "OSD.groundOrSky");
56  oBoolean("OSD.isMotorUp");
57  oBoolean("OSD.isSwaveWork");
58  oInterpreted("OSD.goHomeStatus.RAW", "OSD.goHomeStatus");
59  oBoolean("OSD.isImuPreheated");
60  oBoolean("OSD.isVisionUsed");
61  o("OSD.voltageWarning");
62  o("OSD.modeChannel");
63  oBoolean("OSD.compassError");
64  oBoolean("OSD.waveError");
65  o("OSD.gpsLevel");
66  oInterpreted("OSD.batteryType.RAW", "OSD.batteryType");
67  oBoolean("OSD.isAcceletorOverRange");
68  oBoolean("OSD.isVibrating");
69  oBoolean("OSD.isBarometerDeadInAir");
70  oBoolean("OSD.isMotorBlocked");
71  oBoolean("OSD.isNotEnoughForce");
72  oBoolean("OSD.isPropellerCatapult");
73  oBoolean("OSD.isGoHomeHeightModified");
74  oBoolean("OSD.isOutOfLimit");
75  o("OSD.gpsNum");
76  o("OSD.flightAction");
77  oInterpreted("OSD.flightAction.RAW", "OSD.flightAction");
78  oInterpreted("OSD.motorStartFailedCause.RAW", "OSD.motorStartFailedCause");
79  oInterpreted("OSD.nonGPSCause.RAW", "OSD.nonGPSCause");
80  oBoolean("OSD.isQuickSpin");
81  o("OSD.battery");
82  oFrac("OSD.sWaveHeight", 1);
83  oFrac("OSD.flyTime", 1);
84  o("OSD.motorRevolution");
85  o("OSD.flycVersion");
86  oInterpreted("OSD.droneType.RAW", "OSD.droneType");
87  oInterpreted("OSD.imuInitFailReason.RAW", "OSD.imuInitFailReason");
88  oInterpreted("OSD.motorFailReason.RAW", "OSD.motorFailReason");
89  oInterpreted("OSD.ctrlDevice.RAW", "OSD.ctrlDevice");
90  oFrac("GIMBAL.pitch", 1);
91  oFrac("GIMBAL.roll", 1);
92  oFrac("GIMBAL.yaw", 1);
93  oInterpreted("GIMBAL.mode.RAW", "GIMBAL.mode");
94  oFrac("GIMBAL.rollAdjust", 1);
95  oFrac("GIMBAL.yawAngle", 1);
96  oBoolean("GIMBAL.isAutoCalibration");
97  o("GIMBAL.autoCalibrationResult");
98  oBoolean("GIMBAL.isPitchInLimit");
99  oBoolean("GIMBAL.isRollInLimit");
100  oBoolean("GIMBAL.isYawInLimit");
101  oBoolean("GIMBAL.isStuck");
102  o("GIMBAL.version");
103  oBoolean("GIMBAL.isSingleClick");
104  oBoolean("GIMBAL.isDoubleClick");
105  oBoolean("GIMBAL.isTripleClick");
106  o("RC.aileron");
107  o("RC.elevator");
108  o("RC.throttle");
109  o("RC.rudder");
110  o("RC.gimbal");
111  o("RC.goHome");
112  o("RC.mode");
113  o("RC.wheelOffset");
114  o("RC.record");
115  o("RC.shutter");
116  o("RC.playback");
117  o("RC.custom1");
118  o("RC.custom2");
119  o("CENTER_BATTERY.relativeCapacity");
120  o("CENTER_BATTERY.currentPV");
121  o("CENTER_BATTERY.currentCapacity");
122  o("CENTER_BATTERY.fullCapacity");
123  o("CENTER_BATTERY.life");
124  o("CENTER_BATTERY.loopNum");
125  o("CENTER_BATTERY.errorType");
126  o("CENTER_BATTERY.current");
127  o("CENTER_BATTERY.voltageCell1");
128  o("CENTER_BATTERY.voltageCell2");
129  o("CENTER_BATTERY.voltageCell3");
130  o("CENTER_BATTERY.voltageCell4");
131  o("CENTER_BATTERY.voltageCell5");
132  o("CENTER_BATTERY.voltageCell6");
133  o("CENTER_BATTERY.serialNo");
134  o("CENTER_BATTERY.productDate");
135  o("CENTER_BATTERY.temperature");
136  o("CENTER_BATTERY.connStatus");
137  o("CENTER_BATTERY.totalStudyCycle");
138  o("CENTER_BATTERY.lastStudyCycle");
139  o("CENTER_BATTERY.isNeedStudy");
140  o("CENTER_BATTERY.isBatteryOnCharge");
141  o("SMART_BATTERY.usefulTime");
142  o("SMART_BATTERY.goHomeTime");
143  o("SMART_BATTERY.landTime");
144  o("SMART_BATTERY.goHomeBattery");
145  o("SMART_BATTERY.landBattery");
146  o("SMART_BATTERY.safeFlyRadius");
147  o("SMART_BATTERY.volumeConsume");
148  oInterpreted("SMART_BATTERY.status.RAW", "SMART_BATTERY.status");
149  oInterpreted("SMART_BATTERY.goHomeStatus.RAW", "SMART_BATTERY.goHomeStatus");
150  o("SMART_BATTERY.goHomeCountdown");
151  o("SMART_BATTERY.voltage");
152  o("SMART_BATTERY.battery");
153  o("SMART_BATTERY.lowWarning");
154  o("SMART_BATTERY.lowWarningGoHome");
155  o("SMART_BATTERY.seriousLowWarning");
156  o("SMART_BATTERY.seriousLowWarningLanding");
157  o("SMART_BATTERY.voltagePercent");
158  o("DEFORM.isDeformProtected");
159  oInterpreted("DEFORM.deformStatus.RAW", "DEFORM.deformStatus");
160  oInterpreted("DEFORM.deformMode.RAW","DEFORM.deformMode");
161  oFrac("HOME.latitude", 6);
162  oFrac("HOME.longitude", 6);
163  oFrac("HOME.height", 2);
164  oBoolean("HOME.isHomeRecord");
165  o("HOME.goHomeMode");
166  o("HOME.aircraftHeadDirection");
167  oBoolean("HOME.isDynamicHomePointEnabled");
168  o("HOME.goHomeStatus");
169  oBoolean("HOME.hasGoHome");
170  o("HOME.compassCeleStatus");
171  oBoolean("HOME.isCompassCeleing");
172  oBoolean("HOME.isBeginnerMode");
173  oBoolean("HOME.isIOCEnabled");
174  oInterpreted("HOME.iocMode.RAW", "HOME.iocMode");
175  o("HOME.goHomeHeight");
176  oFrac("HOME.courseLockAngle", 1);
177  o("HOME.dataRecorderStatus");
178  o("HOME.dataRecorderRemainCapacity");
179  o("HOME.dataRecorderRemainTime");
180  o("HOME.dataRecorderFileIndex");
181  o("HOME.maxAllowedHeight");
182  oInterpreted("RECOVER.droneType.RAW", "RECOVER.droneType");
183  oInterpreted("RECOVER.appType.RAW", "RECOVER.appType");
184  o("RECOVER.appVersion");
185  o("RECOVER.aircraftSn");
186  o("RECOVER.aircraftName");
187  o("RECOVER.activeTimestamp");
188  o("RECOVER.cameraSn");
189  o("RECOVER.rcSn");
190  o("RECOVER.batterySn");
191  o("FIRMWARE.version");
192  o("COMPONENT.cameraSn");
193  o("COMPONENT.aircraftSn");
194  o("COMPONENT.rcSn");
195  o("COMPONENT.batterySn");
196  o("DETAILS.street");
197  o("DETAILS.citypart");
198  o("DETAILS.city");
199  o("DETAILS.area");
200  o("DETAILS.isFavorite");
201  o("DETAILS.isNew");
202  o("DETAILS.needUpload");
203  o("DETAILS.recordLineCount");
204  o("DETAILS.timestamp");
205  oFrac("DETAILS.latitude", 6);
206  oFrac("DETAILS.longitude", 6);
207  oFrac("DETAILS.totalDistance", 2);
208  oFrac("DETAILS.totalTime", 1);
209  oFrac("DETAILS.maxHeight", 1);
210  oFrac("DETAILS.maxHorizontalSpeed", 2);
211  oFrac("DETAILS.maxVerticalSpeed", 1);
212  o("DETAILS.photoNum");
213  o("DETAILS.videoTime");
214  o("DETAILS.activeTimestamp");
215  o("DETAILS.aircraftName");
216  o("DETAILS.aircraftSn");
217  o("DETAILS.cameraSn");
218  o("DETAILS.rcSn");
219  o("DETAILS.batterySn");
220  oInterpreted("DETAILS.appType.RAW", "DETAILS.appType");
221  o("DETAILS.appVersion");
222  oFrac("APP_GPS.latitude", 6);
223  oFrac("APP_GPS.longitude", 6);
224  o("APP_GPS.accuracy");
225  o("APP_TIP.tip");
226  o("APP_WARN.warn");
227  o("APP_SER_WARN.warn");
228  printf("\n");
229 }
#define o(label)
Definition: rowOutput.cpp:35
#define oInterpreted(label, interpretedLabel)
Definition: rowOutput.cpp:36
#define oFrac(label, nFrac)
Definition: rowOutput.cpp:34
#define oFirst(label)
Definition: rowOutput.cpp:33
virtual void outputOneRow(int outputColumnLabels)
Definition: rowOutput.cpp:39
#define oBoolean(label)
Definition: rowOutput.cpp:37