djiparsetxt
parseRecord_RECOVER.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 2019-02-08
18 
19  Copyright (c) 2019 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 RECOVER records within DJI ".txt" files.
23  Implementation.
24 */
25 
27 
28 void RecordAndDetailsParser::parseRecord_RECOVER(u_int8_t const*& ptr, u_int8_t const* limit) {
29  // RECOVER.droneType.RAW: 1 byte unsigned:
30  noteByteField("RECOVER.droneType.RAW", ptr, limit);
31 
32  // RECOVER.appType.RAW: 1 byte unsigned:
33  noteByteField("RECOVER.appType.RAW", ptr, limit);
34 
35  // RECOVER.appVersion: 3 bytes;
36  note3ByteVersionField("RECOVER.appVersion", ptr, limit);
37 
38  // RECOVER.aircraftSn: string (length 10):
39  noteStringField("RECOVER.aircraftSn", ptr, 10, limit);
40 
41  // RECOVER.aircraftName: string (length 24):
42  noteStringField("RECOVER.aircraftName", ptr, 24, limit);
43 
44  // unknown (8 bytes)
45  ptr += 8;
46 
47  // RECOVER.activeTimestamp: 8 bytes little-endian, in Unix time format:
48  extern u_int32_t fileVersionNumber;
49  if ((fileVersionNumber&0x0000FF00) < 0x00000800) {
50  note8ByteTimestampField("RECOVER.activeTimestamp", ptr, limit);
51  } else {
52  // This timestamp is formatted differently (how?) in newer versions of the .txt file. #####
53  if ((fileVersionNumber&0x0000FF00) > 0x00000800) {
54  ptr += 8; // skip over 8-byte timestamp
55  } else {
56  ptr += 6+8; // skip over 6 bytes (unknown) + 8-byte timestamp
57  }
58  }
59 
60  // RECOVER.cameraSn: string (length 10):
61  noteStringField("RECOVER.cameraSn", ptr, 10, limit);
62 
63  // RECOVER.rcSn: string (length 10):
64  noteStringField("RECOVER.rcSn", ptr, 10, limit);
65 
66  // RECOVER.batterySn: string (length 10):
67  noteStringField("RECOVER.batterySn", ptr, 10, limit);
68 }
void parseRecord_RECOVER(u_int8_t const *&ptr, u_int8_t const *limit)
u_int32_t fileVersionNumber
Definition: djiparsetxt.cpp:34
void note8ByteTimestampField(char const *label, u_int8_t const *&ptr, u_int8_t const *limit, int isInMilliseconds=0)
void note3ByteVersionField(char const *label, u_int8_t const *&ptr, u_int8_t const *limit)
void noteStringField(char const *label, u_int8_t const *&ptr, unsigned stringLength, u_int8_t const *limit)
void noteByteField(char const *label, u_int8_t const *&ptr, u_int8_t const *limit, float divisor=0.0, int isSigned=0)