djiparsetxt
RecordAndDetailsParser.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  Parsing records (and the 'details' section) within DJI ".txt" files.
23  Implementation.
24 */
25 
27 #include <stdio.h>
28 
30  return new RecordAndDetailsParser;
31 }
32 
34 
36  : count(0), minLength(~0), maxLength(0) {
37 }
38 
40 
42  : fNumRecords(0), fMaxNumRecordsForOneType(0), fFieldDatabase(new FieldDatabase) {
43 #ifdef DEBUG_RECORD_PARSING
44  // Initialize "fRecordTypeName":
45  for (unsigned i = 0; i < 256; ++i) {
46  fRecordTypeName[i] = NULL;
47  }
48  fRecordTypeName[0x01] = "OSD";
49  fRecordTypeName[0x02] = "HOME";
50  fRecordTypeName[0x03] = "GIMBAL";
51  fRecordTypeName[0x04] = "RC";
52  fRecordTypeName[0x05] = "CUSTOM";
53  fRecordTypeName[0x06] = "DEFORM";
54  fRecordTypeName[0x07] = "CENTER_BATTERY";
55  fRecordTypeName[0x08] = "SMART_BATTERY";
56  fRecordTypeName[0x09] = "APP_TIP";
57  fRecordTypeName[0x0A] = "APP_WARN";
58  fRecordTypeName[0x0B] = "RC_GPS";
59  fRecordTypeName[0x0C] = "RC_DEBUG";
60  fRecordTypeName[0x0D] = "RECOVER";
61  fRecordTypeName[0x0E] = "APP_GPS";
62  fRecordTypeName[0x0F] = "FIRMWARE";
63  fRecordTypeName[0x10] = "OFDM_DEBUG";
64  fRecordTypeName[0x11] = "VISION_GROUP";
65  fRecordTypeName[0x12] = "VISION_WARN";
66  fRecordTypeName[0x13] = "MC_PARAM";
67  fRecordTypeName[0x14] = "APP_OPERATION";
68  // What is record type 0x16? #####
69  fRecordTypeName[0x18] = "APP_SER_WARN";
70  // What is record type 0x19? #####
71  // What is record type 0x1a? #####
72  // What is record type 0x1e? #####
73  // What is record type 0x28? #####
74  fRecordTypeName[0x39] = "JPEG";
75  fRecordTypeName[0xFE] = "OTHER";
76 #endif
77 }
78 
80  delete fFieldDatabase;
81 }
static DJITxtParser * createNew()