Logbokk fligth type

This commit is contained in:
Kilian Hofmann 2022-09-25 22:31:05 +02:00
parent a50d89f4aa
commit 52da1262b0
5 changed files with 13 additions and 87 deletions

View File

@ -1,80 +0,0 @@
VARIABLE STRING (>=3)
*********************
0 1 | 2 ... |
------+-------+
LEN |STRING |
UINT16|CHAR* |
LOGBOOK HEADER (28)
***********************************************************************************************************************************************
0 1 2 3 4 | 5 | 6 7 | 8 9 10 11 | 12 13 14 15 | 16 17 18 19 | 20 21 22 23 | 24 25 26 27 |
------------------+-------+-------------+---------------------+-------------------+-------------------+-------------------+-------------------+
IDENT |VERSION|TOTAL FLIGHTS|TOTAL TIME |TOTAL PTS |TOTAL FUEL |TOTAL DIST |RATE |
CHAR[5] |UINT8 |UINT16 |FLOAT32, Decimal, min|FLOAT32 |FLOAT32, kgs |FLOAT32, nm |FLOAT32, ft/min |
FLIGHT PREAMBLE (24)
**********************************************************************************************************************
0 1 2 3 4 5 6 7 8 9 | 10 11 12 13 | 14 15 16 17 | 18 19 20 21 22 23 |
--------------------------------------+----------------------------+-------------------+-----------------------------+
DATE |FLIGHT NUMBER |AIRCRAFT TYPE |AIRCRAFT REGISTRATION |
CHAR, DD.MM.YYYY |CHAR[4],[0-9][0-9A-z\0]{0,3}|CHAR[4], ICAO code |CHAR[6], D-[A-Z]{4} |
TIMES (24)
**************************************************************************************************************
0 1 2 3 4 | 5 6 7 8 9 | 10 11 12 13 14 | 15 16 17 18 19 | 20 21 22 23 |
------------------+-------------------+------------------------+------------------------+--------------------+
OFF BLOCK |TAKEOFF (OUT) |LANDING (ON) |ON BLOCK (IN) |TOTAL |
CHAR[5], HH:MM |CHAR[5], HH:MM |CHAR[5], HH:MM |CHAR[5], HH:MM |FLOAT32, Decimal min|
FUELS (16)
*********************************************************************
0 1 2 3 | 4 5 6 7 | 8 9 10 11 | 12 13 14 15 |
--------------+---------------+-----------------+-------------------+
TAXI OUT |IN FLIGHT |TAXI IN |TOTAL |
FLOAT32, kgs |FLOAT32, kgs |FLOAT32, kgs |FLOAT32, kgs |
DISTANCES (16)
*********************************************************************
0 1 2 3 | 4 5 6 7 | 8 9 10 11 | 12 13 14 15 |
--------------+---------------+-----------------+-------------------+
TAXI OUT |IN FLIGHT |TAXI IN |TOTAL |
FLOAT32, nm |FLOAT32, nm |FLOAT32, nm |FLOAT32, nm |
LANDING (9)
*******************************************
0 1 2 3 | 4 | 5 6 7 8 |
---------------+----------+---------------+
MAX RATE |TOUCHDOWNS|MAX G-FORCE |
FLOAT32, ft/min|CHAR |FLOAT32, g |
FLIGHT POSTAMBLE (5)
*********************
0 1 2 3 | 5 |
--------------+---------+
POINTS |FLAGS |
FLOAT32 |BITFIELD |
FLAGS BITFIELD
**********************************
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---+---+---+---+---+---+---+-----+
NIL|NIL|NIL|NIL|NIL|NIL|NIL|FILED|
LOGBOOK FILE:
LOGBOOK HEADER
[
FLIGHT PREAMBLE
VARIABLE STRING (DEPARTURE AIRPORT NAME AND CODE)
VARIABLE STRING (DEPARTURE GATE NAME)
VARIABLE STRING (DEPARTURE RUNWAY DESIGNATOR)
VARIABLE STRING (ARRIVAL AIRPORT NAME AND CODE)
VARIABLE STRING (ARRIVAL GATE NAME)
VARIABLE STRING (ARRIVAL RUNWAY DESIGNATOR)
TIMES
FUELS
DISTANCES
LANDING
VARIABLE STRING (RECORDING FILE NAME)
FLIGHT POSTAMBLE
VARIABLE STRING (FLIGHT RECORDING PATH RELATIVE TO LOGBOOK)
]0..n

View File

@ -35,6 +35,7 @@ namespace file
inline void readVersion1(std::ifstream &in) inline void readVersion1(std::ifstream &in)
{ {
std::string date = readString(in, 10); std::string date = readString(in, 10);
std::string flightType = readString(in, 1);
std::string flightNumber = readString(in, 4); std::string flightNumber = readString(in, 4);
std::string aircraftType = readString(in, 4); std::string aircraftType = readString(in, 4);
std::string aircraftRegistration = readString(in, 6); std::string aircraftRegistration = readString(in, 6);
@ -65,6 +66,7 @@ namespace file
std::uint8_t flags = read<std::uint8_t>(in); std::uint8_t flags = read<std::uint8_t>(in);
this->addEntry(date, this->addEntry(date,
flightType,
flightNumber, flightNumber,
aircraftType, aircraftType,
aircraftRegistration, aircraftRegistration,
@ -99,7 +101,7 @@ namespace file
{ {
std::ifstream in(BASE_DIRECTORY LOGBOOK, std::ifstream::binary); std::ifstream in(BASE_DIRECTORY LOGBOOK, std::ifstream::binary);
std::string ident = readString(in, 5); std::string ident = readString(in, 4);
if (ident.compare(LOGBOOK_HEADER) != 0) { if (ident.compare(LOGBOOK_HEADER) != 0) {
throw std::invalid_argument("Wrong file"); throw std::invalid_argument("Wrong file");
} }

View File

@ -15,10 +15,10 @@ namespace file
namespace logbook namespace logbook
{ {
/* /*
* Preamble (24) * Preamble (25)
* CHAR[10] | CHAR[4] | CHAR[4] | CHAR[6] * CHAR[10] | CHAR[1] | CHAR[4] | CHAR[4] | CHAR[6]
* ---------+---------------+----------+------------- * ---------+-------------+---------------+----------+-------------
* DATE | FLIGHT NUMBER | AIRCRAFT | REGISTRATION * DATE | FLIGHT TYPE | FLIGHT NUMBER | AIRCRAFT | REGISTRATION
* Departure Airport Name (1...257) * Departure Airport Name (1...257)
* UINT8 | CHAR[] * UINT8 | CHAR[]
@ -89,6 +89,7 @@ namespace file
{ {
private: private:
std::string date; std::string date;
std::string flightType;
std::string flightNumber; std::string flightNumber;
std::string aircraftType; std::string aircraftType;
std::string aircraftRegistration; std::string aircraftRegistration;
@ -120,6 +121,7 @@ namespace file
public: public:
inline LogbookEntry(std::string date, inline LogbookEntry(std::string date,
std::string flightType,
std::string flightNumber, std::string flightNumber,
std::string aircraftType, std::string aircraftType,
std::string aircraftRegistration, std::string aircraftRegistration,
@ -148,7 +150,7 @@ namespace file
std::string recordingFilename, std::string recordingFilename,
float points, float points,
std::uint8_t flags) std::uint8_t flags)
: date(date), flightNumber(flightNumber), : date(date), flightType(flightType), flightNumber(flightNumber),
aircraftType(aircraftType), aircraftType(aircraftType),
aircraftRegistration(aircraftRegistration), aircraftRegistration(aircraftRegistration),
departureAirport(departureAirport), departureGate(departureGate), departureAirport(departureAirport), departureGate(departureGate),
@ -170,6 +172,7 @@ namespace file
inline void toFile(std::ofstream &out) const inline void toFile(std::ofstream &out) const
{ {
writeString(out, this->date, 10); writeString(out, this->date, 10);
writeString(out, this->flightType, 1);
writeString(out, this->flightNumber, 4); writeString(out, this->flightNumber, 4);
writeString(out, this->aircraftType, 4); writeString(out, this->aircraftType, 4);
writeString(out, this->aircraftRegistration, 6); writeString(out, this->aircraftRegistration, 6);

View File

@ -88,7 +88,7 @@ namespace file
{ {
std::ifstream in(BASE_DIRECTORY SIMDATABASE, std::ifstream::binary); std::ifstream in(BASE_DIRECTORY SIMDATABASE, std::ifstream::binary);
std::string ident = readString(in, 5); std::string ident = readString(in, 4);
if (ident.compare(SIMDATABASE_HEADER) != 0) { if (ident.compare(SIMDATABASE_HEADER) != 0) {
throw std::invalid_argument("Wrong file"); throw std::invalid_argument("Wrong file");
} }

View File

@ -151,6 +151,7 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
toLog("Logbook Test"); toLog("Logbook Test");
germanairlinesva::file::logbook::Logbook logbook; germanairlinesva::file::logbook::Logbook logbook;
logbook.addEntry("08.09.2022", logbook.addEntry("08.09.2022",
"F",
"1000", "1000",
"L049", "L049",
"D-ALFA", "D-ALFA",