Initial Logbook read and write
This commit is contained in:
parent
a5e23f4b43
commit
b050c23577
65
.vscode/settings.json
vendored
65
.vscode/settings.json
vendored
@ -1,3 +1,68 @@
|
|||||||
{
|
{
|
||||||
"cmake.generator": "Unix Makefiles",
|
"cmake.generator": "Unix Makefiles",
|
||||||
|
"files.associations": {
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bit": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"bitset": "cpp",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"chrono": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"codecvt": "cpp",
|
||||||
|
"condition_variable": "cpp",
|
||||||
|
"cstdarg": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"ctime": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"forward_list": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"map": "cpp",
|
||||||
|
"set": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"ratio": "cpp",
|
||||||
|
"regex": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"future": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"iomanip": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"iostream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"mutex": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"shared_mutex": "cpp",
|
||||||
|
"sstream": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"thread": "cpp",
|
||||||
|
"cinttypes": "cpp",
|
||||||
|
"typeinfo": "cpp",
|
||||||
|
"valarray": "cpp"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@ -65,8 +65,8 @@ pipeline {
|
|||||||
branch 'develop'
|
branch 'develop'
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
zip zipFile: 'Plugin Debug.zip', archive: true, dir: 'build/Plugin'
|
zip zipFile: 'X-Plane Debug.zip', archive: true, dir: 'build/X-Plane'
|
||||||
zip zipFile: 'FSConnect Debug.zip', archive: true, dir: 'build/FSConnect'
|
zip zipFile: 'ESP Debug.zip', archive: true, dir: 'build/ESP'
|
||||||
zip zipFile: 'Analysis.zip', archive: true, dir: 'build/Analysis'
|
zip zipFile: 'Analysis.zip', archive: true, dir: 'build/Analysis'
|
||||||
sh 'rm -rf build'
|
sh 'rm -rf build'
|
||||||
}
|
}
|
||||||
|
|||||||
11
build.sh
11
build.sh
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
mkdir -p Plugin/GAConnector/32
|
mkdir -p X-Plane/GAConnector/64
|
||||||
mkdir -p Plugin/GAConnector/64
|
mkdir -p X-Plane/GAConnector/recordings
|
||||||
|
mkdir -p ESP/GAConnector
|
||||||
|
mkdir -p ESP/GAConnector/recordings
|
||||||
rm -f CMakeCache.txt
|
rm -f CMakeCache.txt
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
@ -18,7 +20,8 @@ case $1 in
|
|||||||
;;
|
;;
|
||||||
"win64")
|
"win64")
|
||||||
cmake -DDEBUG=$DEBUG -DBIT=64 -DCMAKE_TOOLCHAIN_FILE=../toolchain-win-64.cmake ..
|
cmake -DDEBUG=$DEBUG -DBIT=64 -DCMAKE_TOOLCHAIN_FILE=../toolchain-win-64.cmake ..
|
||||||
\cp -rf ../openSSL/win64/*.dll Plugin/GAConnector/64/
|
\cp -rf ../openSSL/win64/*.dll X-Plane/GAConnector/64/
|
||||||
|
\cp -rf ../openSSL/win64/*.dll ESP/GAConnector/
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -31,7 +34,7 @@ fi
|
|||||||
|
|
||||||
if [ "$1" = "mac" ] && [ "$DEBUG" = "1" ]
|
if [ "$1" = "mac" ] && [ "$DEBUG" = "1" ]
|
||||||
then
|
then
|
||||||
/opt/osxcross/target/bin/osxcross-llvm-dsymutil Plugin/GAConnector/mac.xpl
|
/opt/osxcross/target/bin/osxcross-llvm-dsymutil X-Plane/GAConnector/mac.xpl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,10 +32,10 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
message("Building file for MacOSX Universal into ${PROJECT_BINARY_DIR}/${PLUGIN_NAME}")
|
message("Building file for MacOSX Universal into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}")
|
||||||
|
|
||||||
set_target_properties(file PROPERTIES
|
set_target_properties(file PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}"
|
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}"
|
||||||
BUILD_WITH_INSTALL_NAME_DIR TRUE
|
BUILD_WITH_INSTALL_NAME_DIR TRUE
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -49,10 +49,10 @@ if(APPLE)
|
|||||||
"-framework Security"
|
"-framework Security"
|
||||||
)
|
)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
message("Building file for Linux ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
|
message("Building file for Linux ${BIT} into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}")
|
||||||
|
|
||||||
set_target_properties(file PROPERTIES
|
set_target_properties(file PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}"
|
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(file PRIVATE
|
target_compile_options(file PRIVATE
|
||||||
@ -60,16 +60,16 @@ elseif(UNIX)
|
|||||||
)
|
)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
if (BIT STREQUAL "32")
|
if (BIT STREQUAL "32")
|
||||||
message("Building file for Windows ${BIT} into ${PROJECT_BINARY_DIR}/FSConnect")
|
message("Building file for Windows ${BIT} into ${PROJECT_BINARY_DIR}/ESP/${PLUGIN_NAME}")
|
||||||
|
|
||||||
set_target_properties(file PROPERTIES
|
set_target_properties(file PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/FSConnect"
|
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/ESP/${PLUGIN_NAME}"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
message("Building file for Windows ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
|
message("Building file for Windows ${BIT} into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}")
|
||||||
|
|
||||||
set_target_properties(file PROPERTIES
|
set_target_properties(file PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}"
|
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "constants.h"
|
||||||
#include "logbookEntry.h"
|
#include "logbookEntry.h"
|
||||||
|
#include "util.hpp"
|
||||||
|
|
||||||
namespace germanairlinesva_logbook
|
namespace germanairlinesva_logbook
|
||||||
{
|
{
|
||||||
@ -22,16 +24,15 @@ namespace germanairlinesva_logbook
|
|||||||
class Logbook
|
class Logbook
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::ifstream fileStream;
|
std::vector<std::uint8_t> file;
|
||||||
std::vector<std::uint8_t> file{'V', 'G', 'A', 'L', '\0', 1};
|
|
||||||
|
|
||||||
void fromFile();
|
void fromFile(const std::string &file);
|
||||||
void readVersion1();
|
void readVersion1(std::ifstream &in);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Logbook(std::ifstream &logbook);
|
Logbook();
|
||||||
void addEntry(LogbookEntry entry);
|
void addEntry(LogbookEntry entry);
|
||||||
void toFile(std::ofstream &logbook);
|
void toFile();
|
||||||
};
|
};
|
||||||
} // namespace germanairlinesva_logbook
|
} // namespace germanairlinesva_logbook
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef GERMANAIRLINESVA_GACONNECTOR_LOGBOOKENTRY_H
|
#ifndef GERMANAIRLINESVA_GACONNECTOR_LOGBOOKENTRY_H
|
||||||
#define GERMANAIRLINESVA_GACONNECTOR_LOHBOOKENTRY_H
|
#define GERMANAIRLINESVA_GACONNECTOR_LOGBOOKENTRY_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -91,7 +91,7 @@ namespace germanairlinesva_logbook
|
|||||||
std::string departureGate;
|
std::string departureGate;
|
||||||
std::string departureRunway;
|
std::string departureRunway;
|
||||||
std::string arrivalAirport;
|
std::string arrivalAirport;
|
||||||
std::string arrivaleGate;
|
std::string arrivalGate;
|
||||||
std::string arrivalRunway;
|
std::string arrivalRunway;
|
||||||
std::string offBlockTime;
|
std::string offBlockTime;
|
||||||
std::string outTime;
|
std::string outTime;
|
||||||
@ -123,7 +123,7 @@ namespace germanairlinesva_logbook
|
|||||||
std::string departureGate,
|
std::string departureGate,
|
||||||
std::string departureRunway,
|
std::string departureRunway,
|
||||||
std::string arrivalAirport,
|
std::string arrivalAirport,
|
||||||
std::string arrivaleGate,
|
std::string arrivalGate,
|
||||||
std::string arrivalRunway,
|
std::string arrivalRunway,
|
||||||
std::string offBlockTime,
|
std::string offBlockTime,
|
||||||
std::string outTime,
|
std::string outTime,
|
||||||
@ -143,8 +143,7 @@ namespace germanairlinesva_logbook
|
|||||||
float maxLandingGees,
|
float maxLandingGees,
|
||||||
std::string recordingFilename,
|
std::string recordingFilename,
|
||||||
float points,
|
float points,
|
||||||
std::uint8_t flags,
|
std::uint8_t flags);
|
||||||
std::vector<std::uint8_t> file);
|
|
||||||
|
|
||||||
inline std::uint8_t *getBinaryData() { return file.data(); }
|
inline std::uint8_t *getBinaryData() { return file.data(); }
|
||||||
inline std::size_t getBinaryLength() { return file.size(); }
|
inline std::size_t getBinaryLength() { return file.size(); }
|
||||||
|
|||||||
61
file/logbook.cpp
Normal file
61
file/logbook.cpp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#include "logbook.h"
|
||||||
|
|
||||||
|
namespace germanairlinesva_logbook
|
||||||
|
{
|
||||||
|
Logbook::Logbook()
|
||||||
|
{
|
||||||
|
if (germanairlinesva_util::fileExists(
|
||||||
|
XPLANE_PLUGIN_DIRECTORY LOGBOOK)) {
|
||||||
|
this->fromFile(XPLANE_PLUGIN_DIRECTORY LOGBOOK);
|
||||||
|
} else {
|
||||||
|
char header[] = {'V', 'G', 'A', 'L', '\0', 1};
|
||||||
|
this->file.resize(6);
|
||||||
|
std::memcpy(file.data(), &header, 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logbook::fromFile(const std::string &file)
|
||||||
|
{
|
||||||
|
std::ifstream in(file, std::ifstream::binary);
|
||||||
|
|
||||||
|
// File Header
|
||||||
|
char ident[5];
|
||||||
|
in.read(ident, 5);
|
||||||
|
if (strcmp(ident, "VGAL") != 0) {
|
||||||
|
throw std::invalid_argument("Wrong file");
|
||||||
|
}
|
||||||
|
std::uint8_t version;
|
||||||
|
in.read(reinterpret_cast<char *>(&version), 1);
|
||||||
|
|
||||||
|
if (version == 1) {
|
||||||
|
return this->readVersion1(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logbook::readVersion1(std::ifstream &in)
|
||||||
|
{
|
||||||
|
in.seekg(0, std::fstream::end);
|
||||||
|
std::streampos fileSize = in.tellg();
|
||||||
|
in.seekg(0, std::ios::beg);
|
||||||
|
|
||||||
|
this->file.resize(fileSize);
|
||||||
|
in.read(reinterpret_cast<char *>(this->file.data()), fileSize);
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logbook::addEntry(LogbookEntry entry)
|
||||||
|
{
|
||||||
|
std::size_t size = file.size();
|
||||||
|
file.resize(file.size() + entry.getBinaryLength());
|
||||||
|
std::uint8_t *bufPtr = file.data() + size;
|
||||||
|
std::memcpy(bufPtr, entry.getBinaryData(), entry.getBinaryLength());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logbook::toFile()
|
||||||
|
{
|
||||||
|
std::ofstream out(XPLANE_PLUGIN_DIRECTORY LOGBOOK,
|
||||||
|
std::fstream::binary);
|
||||||
|
out.write(reinterpret_cast<char *>(this->file.data()), this->file.size());
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
} // namespace germanairlinesva_logbook
|
||||||
191
file/logbookEntry.cpp
Normal file
191
file/logbookEntry.cpp
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
#include "logbookEntry.h"
|
||||||
|
|
||||||
|
namespace germanairlinesva_logbook
|
||||||
|
{
|
||||||
|
LogbookEntry::LogbookEntry(std::string date,
|
||||||
|
std::string flightNumber,
|
||||||
|
std::string aircraftType,
|
||||||
|
std::string aircraftRegistration,
|
||||||
|
std::string departureAirport,
|
||||||
|
std::string departureGate,
|
||||||
|
std::string departureRunway,
|
||||||
|
std::string arrivalAirport,
|
||||||
|
std::string arrivalGate,
|
||||||
|
std::string arrivalRunway,
|
||||||
|
std::string offBlockTime,
|
||||||
|
std::string outTime,
|
||||||
|
std::string inTime,
|
||||||
|
std::string onBlockTime,
|
||||||
|
float totalFlightTime,
|
||||||
|
float taxiOutFuel,
|
||||||
|
float inFlightFuel,
|
||||||
|
float taxiInFuel,
|
||||||
|
float totalFuel,
|
||||||
|
float taxiOutDistance,
|
||||||
|
float inFlightDistance,
|
||||||
|
float taxiInDistance,
|
||||||
|
float totalDistance,
|
||||||
|
float maxLandingRate,
|
||||||
|
std::uint8_t touchdowns,
|
||||||
|
float maxLandingGees,
|
||||||
|
std::string recordingFilename,
|
||||||
|
float points,
|
||||||
|
std::uint8_t flags)
|
||||||
|
{
|
||||||
|
this->date = date;
|
||||||
|
this->flightNumber = flightNumber;
|
||||||
|
this->aircraftType = aircraftType;
|
||||||
|
this->aircraftRegistration = aircraftRegistration;
|
||||||
|
this->departureAirport = departureAirport;
|
||||||
|
this->departureGate = departureGate;
|
||||||
|
this->departureRunway = departureRunway;
|
||||||
|
this->arrivalAirport = arrivalAirport;
|
||||||
|
this->arrivalGate = arrivalGate;
|
||||||
|
this->arrivalRunway = arrivalRunway;
|
||||||
|
this->offBlockTime = offBlockTime;
|
||||||
|
this->outTime = outTime;
|
||||||
|
this->inTime = inTime;
|
||||||
|
this->onBlockTime = onBlockTime;
|
||||||
|
this->totalFlightTime = totalFlightTime;
|
||||||
|
this->taxiOutFuel = taxiOutFuel;
|
||||||
|
this->inFlightFuel = inFlightFuel;
|
||||||
|
this->taxiInFuel = taxiInFuel;
|
||||||
|
this->totalFuel = totalFuel;
|
||||||
|
this->taxiOutDistance = taxiOutDistance;
|
||||||
|
this->inFlightDistance = inFlightDistance;
|
||||||
|
this->taxiInDistance = taxiInDistance;
|
||||||
|
this->totalDistance = totalDistance;
|
||||||
|
this->maxLandingRate = maxLandingRate;
|
||||||
|
this->touchdowns = touchdowns;
|
||||||
|
this->maxLandingGees = maxLandingGees;
|
||||||
|
this->recordingFilename = recordingFilename;
|
||||||
|
this->points = points;
|
||||||
|
this->flags = flags;
|
||||||
|
|
||||||
|
file = std::vector<std::uint8_t>(
|
||||||
|
this->date.length() + 1 + this->flightNumber.length() + 1 +
|
||||||
|
this->aircraftType.length() + 1 + this->aircraftRegistration.length() +
|
||||||
|
1 + 1 + this->departureAirport.length() + 1 + 1 +
|
||||||
|
this->departureGate.length() + 1 + 1 + this->departureRunway.length() +
|
||||||
|
1 + 1 + this->arrivalAirport.length() + 1 + 1 +
|
||||||
|
this->arrivalGate.length() + 1 + 1 + this->arrivalRunway.length() + 1 +
|
||||||
|
this->offBlockTime.length() + 1 + this->outTime.length() + 1 +
|
||||||
|
this->inTime.length() + 1 + this->onBlockTime.length() + 1 +
|
||||||
|
sizeof(this->totalFlightTime) + sizeof(this->taxiOutFuel) +
|
||||||
|
sizeof(this->inFlightFuel) + sizeof(this->taxiInFuel) +
|
||||||
|
sizeof(this->totalFuel) + sizeof(this->taxiOutDistance) +
|
||||||
|
sizeof(this->inFlightDistance) + sizeof(this->taxiInDistance) +
|
||||||
|
sizeof(this->totalDistance) + sizeof(this->maxLandingRate) +
|
||||||
|
sizeof(this->touchdowns) + sizeof(this->maxLandingGees) + 1 +
|
||||||
|
recordingFilename.length() + 1 + sizeof(this->points) +
|
||||||
|
sizeof(this->flags));
|
||||||
|
std::uint8_t *bufPtr = file.data();
|
||||||
|
std::memcpy(bufPtr, this->date.c_str(), this->date.length());
|
||||||
|
bufPtr += this->date.length() + 1;
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
this->flightNumber.c_str(),
|
||||||
|
this->flightNumber.length());
|
||||||
|
bufPtr += this->flightNumber.length() + 1;
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
this->aircraftType.c_str(),
|
||||||
|
this->aircraftType.length());
|
||||||
|
bufPtr += this->aircraftType.length() + 1;
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
this->aircraftRegistration.c_str(),
|
||||||
|
this->aircraftRegistration.length());
|
||||||
|
bufPtr += this->aircraftRegistration.length() + 1;
|
||||||
|
std::memset(bufPtr,
|
||||||
|
static_cast<std::uint8_t>(this->departureAirport.length()),
|
||||||
|
sizeof(std::uint8_t));
|
||||||
|
bufPtr++;
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
this->departureAirport.c_str(),
|
||||||
|
this->departureAirport.length());
|
||||||
|
bufPtr += this->departureAirport.length() + 1;
|
||||||
|
std::memset(bufPtr,
|
||||||
|
static_cast<std::uint8_t>(this->departureGate.length()),
|
||||||
|
sizeof(std::uint8_t));
|
||||||
|
bufPtr++;
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
this->departureGate.c_str(),
|
||||||
|
this->departureGate.length());
|
||||||
|
bufPtr += this->departureGate.length() + 1;
|
||||||
|
std::memset(bufPtr,
|
||||||
|
static_cast<std::uint8_t>(this->departureRunway.length()),
|
||||||
|
sizeof(std::uint8_t));
|
||||||
|
bufPtr++;
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
this->departureRunway.c_str(),
|
||||||
|
this->departureRunway.length());
|
||||||
|
bufPtr += this->departureRunway.length() + 1;
|
||||||
|
std::memset(bufPtr,
|
||||||
|
static_cast<std::uint8_t>(this->arrivalAirport.length()),
|
||||||
|
sizeof(std::uint8_t));
|
||||||
|
bufPtr++;
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
this->arrivalAirport.c_str(),
|
||||||
|
this->arrivalAirport.length());
|
||||||
|
bufPtr += this->arrivalAirport.length() + 1;
|
||||||
|
std::memset(bufPtr,
|
||||||
|
static_cast<std::uint8_t>(this->arrivalGate.length()),
|
||||||
|
sizeof(std::uint8_t));
|
||||||
|
bufPtr++;
|
||||||
|
std::memcpy(bufPtr, this->arrivalGate.c_str(), this->arrivalGate.length());
|
||||||
|
bufPtr += this->arrivalGate.length() + 1;
|
||||||
|
std::memset(bufPtr,
|
||||||
|
static_cast<std::uint8_t>(this->arrivalRunway.length()),
|
||||||
|
sizeof(std::uint8_t));
|
||||||
|
bufPtr++;
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
this->arrivalRunway.c_str(),
|
||||||
|
this->arrivalRunway.length());
|
||||||
|
bufPtr += this->arrivalRunway.length() + 1;
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
this->offBlockTime.c_str(),
|
||||||
|
this->offBlockTime.length());
|
||||||
|
bufPtr += this->offBlockTime.length() + 1;
|
||||||
|
std::memcpy(bufPtr, this->outTime.c_str(), this->outTime.length());
|
||||||
|
bufPtr += this->outTime.length() + 1;
|
||||||
|
std::memcpy(bufPtr, this->inTime.c_str(), this->inTime.length());
|
||||||
|
bufPtr += this->inTime.length() + 1;
|
||||||
|
std::memcpy(bufPtr, this->onBlockTime.c_str(), this->onBlockTime.length());
|
||||||
|
bufPtr += this->onBlockTime.length() + 1;
|
||||||
|
std::memcpy(bufPtr, &this->totalFlightTime, sizeof(this->totalFlightTime));
|
||||||
|
bufPtr += sizeof(this->totalFlightTime);
|
||||||
|
std::memcpy(bufPtr, &this->taxiOutFuel, sizeof(this->taxiOutFuel));
|
||||||
|
bufPtr += sizeof(this->taxiOutFuel);
|
||||||
|
std::memcpy(bufPtr, &this->inFlightFuel, sizeof(this->inFlightFuel));
|
||||||
|
bufPtr += sizeof(this->inFlightFuel);
|
||||||
|
std::memcpy(bufPtr, &this->taxiInFuel, sizeof(this->taxiInFuel));
|
||||||
|
bufPtr += sizeof(this->taxiInFuel);
|
||||||
|
std::memcpy(bufPtr, &this->totalFuel, sizeof(this->totalFuel));
|
||||||
|
bufPtr += sizeof(this->totalFuel);
|
||||||
|
std::memcpy(bufPtr, &this->taxiOutDistance, sizeof(this->taxiOutDistance));
|
||||||
|
bufPtr += sizeof(this->taxiOutDistance);
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
&this->inFlightDistance,
|
||||||
|
sizeof(this->inFlightDistance));
|
||||||
|
bufPtr += sizeof(this->inFlightDistance);
|
||||||
|
std::memcpy(bufPtr, &this->taxiInDistance, sizeof(this->taxiInDistance));
|
||||||
|
bufPtr += sizeof(this->taxiInDistance);
|
||||||
|
std::memcpy(bufPtr, &this->totalDistance, sizeof(this->totalDistance));
|
||||||
|
bufPtr += sizeof(this->totalDistance);
|
||||||
|
std::memcpy(bufPtr, &this->maxLandingRate, sizeof(this->maxLandingRate));
|
||||||
|
bufPtr += sizeof(this->maxLandingRate);
|
||||||
|
std::memcpy(bufPtr, &this->touchdowns, sizeof(this->touchdowns));
|
||||||
|
bufPtr += sizeof(this->touchdowns);
|
||||||
|
std::memcpy(bufPtr, &this->maxLandingGees, sizeof(this->maxLandingGees));
|
||||||
|
bufPtr += sizeof(this->maxLandingGees);
|
||||||
|
std::memset(bufPtr,
|
||||||
|
static_cast<std::uint8_t>(this->recordingFilename.length()),
|
||||||
|
sizeof(std::uint8_t));
|
||||||
|
bufPtr++;
|
||||||
|
std::memcpy(bufPtr,
|
||||||
|
this->recordingFilename.c_str(),
|
||||||
|
this->recordingFilename.length());
|
||||||
|
bufPtr += this->recordingFilename.length() + 1;
|
||||||
|
std::memcpy(bufPtr, &this->points, sizeof(this->points));
|
||||||
|
bufPtr += sizeof(this->points);
|
||||||
|
std::memcpy(bufPtr, &this->flags, sizeof(this->flags));
|
||||||
|
}
|
||||||
|
} // namespace germanairlinesva_logbook
|
||||||
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
require "Recording.php";
|
require "Recording.php";
|
||||||
|
|
||||||
$r = new germanairlinesva_recording\Recording("/mnt/f/X-Plane 11/Resources/plugins/GAConnector/flight.rec");
|
$r = new germanairlinesva_recording\Recording("/mnt/f/X-Plane 12/Resources/plugins/GAConnector/recordings/flight.rec");
|
||||||
print_r($r->geoJSON());
|
print_r($r->geoJSON());
|
||||||
|
|||||||
@ -30,10 +30,10 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
message("Building ixwebsocket for MacOSX Universal into ${PROJECT_BINARY_DIR}/${PLUGIN_NAME}")
|
message("Building ixwebsocket for MacOSX Universal into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}")
|
||||||
|
|
||||||
set_target_properties(ixwebsocket PROPERTIES
|
set_target_properties(ixwebsocket PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}
|
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}
|
||||||
BUILD_WITH_INSTALL_NAME_DIR TRUE
|
BUILD_WITH_INSTALL_NAME_DIR TRUE
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -52,10 +52,10 @@ if(APPLE)
|
|||||||
"-framework Security"
|
"-framework Security"
|
||||||
)
|
)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
message("Building ixwebsocket for Linux ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
|
message("Building ixwebsocket for Linux ${BIT} into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}")
|
||||||
|
|
||||||
set_target_properties(ixwebsocket PROPERTIES
|
set_target_properties(ixwebsocket PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}
|
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}
|
||||||
INSTALL_RPATH "\$ORIGIN"
|
INSTALL_RPATH "\$ORIGIN"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -82,16 +82,16 @@ elseif(UNIX)
|
|||||||
)
|
)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
if (BIT STREQUAL "32")
|
if (BIT STREQUAL "32")
|
||||||
message("Building ixwebsocket for Windows ${BIT} into ${PROJECT_BINARY_DIR}/FSConnect")
|
message("Building ixwebsocket for Windows ${BIT} into ${PROJECT_BINARY_DIR}/ESP/${PLUGIN_NAME}")
|
||||||
|
|
||||||
set_target_properties(ixwebsocket PROPERTIES
|
set_target_properties(ixwebsocket PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/FSConnect"
|
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/ESP/${PLUGIN_NAME}"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
message("Building fileixwebsocket for Windows ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
|
message("Building fileixwebsocket for Windows ${BIT} into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}")
|
||||||
|
|
||||||
set_target_properties(ixwebsocket PROPERTIES
|
set_target_properties(ixwebsocket PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}"
|
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -31,10 +31,10 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
message("Building simdata for MacOSX Universal into ${PROJECT_BINARY_DIR}/${PLUGIN_NAME}")
|
message("Building simdata for MacOSX Universal into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}")
|
||||||
|
|
||||||
set_target_properties(simdata PROPERTIES
|
set_target_properties(simdata PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}"
|
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}"
|
||||||
BUILD_WITH_INSTALL_NAME_DIR TRUE
|
BUILD_WITH_INSTALL_NAME_DIR TRUE
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -48,10 +48,10 @@ if(APPLE)
|
|||||||
"-framework Security"
|
"-framework Security"
|
||||||
)
|
)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
message("Building simdata for Linux ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
|
message("Building simdata for Linux ${BIT} into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}")
|
||||||
|
|
||||||
set_target_properties(simdata PROPERTIES
|
set_target_properties(simdata PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}"
|
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(simdata PRIVATE
|
target_compile_options(simdata PRIVATE
|
||||||
@ -67,16 +67,16 @@ elseif(UNIX)
|
|||||||
endif()
|
endif()
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
if (BIT STREQUAL "32")
|
if (BIT STREQUAL "32")
|
||||||
message("Building simdata for Windows ${BIT} into ${PROJECT_BINARY_DIR}/FSConnect")
|
message("Building simdata for Windows ${BIT} into ${PROJECT_BINARY_DIR}/ESP/${PLUGIN_NAME}")
|
||||||
|
|
||||||
set_target_properties(simdata PROPERTIES
|
set_target_properties(simdata PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/FSConnect"
|
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/ESP/${PLUGIN_NAME}"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
message("Building simdata for Windows ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
|
message("Building simdata for Windows ${BIT} into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}")
|
||||||
|
|
||||||
set_target_properties(simdata PROPERTIES
|
set_target_properties(simdata PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}"
|
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace germanairlinesva_simdata
|
namespace germanairlinesva_simdata
|
||||||
{
|
{
|
||||||
Gate::Gate(const std::string &designator,
|
Gate::Gate(std::string designator,
|
||||||
double latitude,
|
double latitude,
|
||||||
double longitude,
|
double longitude,
|
||||||
std::uint8_t radius)
|
std::uint8_t radius)
|
||||||
@ -15,9 +15,9 @@ namespace germanairlinesva_simdata
|
|||||||
sizeof(center) + sizeof(radius),
|
sizeof(center) + sizeof(radius),
|
||||||
0);
|
0);
|
||||||
std::uint8_t *bufPtr = file.data();
|
std::uint8_t *bufPtr = file.data();
|
||||||
memset(bufPtr,
|
std::memset(bufPtr,
|
||||||
static_cast<std::uint8_t>(this->designator.length()),
|
static_cast<std::uint8_t>(this->designator.length()),
|
||||||
sizeof(std::uint8_t));
|
sizeof(std::uint8_t));
|
||||||
bufPtr++;
|
bufPtr++;
|
||||||
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
|
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
|
||||||
bufPtr += this->designator.length() + 1;
|
bufPtr += this->designator.length() + 1;
|
||||||
@ -27,7 +27,7 @@ namespace germanairlinesva_simdata
|
|||||||
}
|
}
|
||||||
|
|
||||||
// From database
|
// From database
|
||||||
Gate::Gate(const std::string &designator,
|
Gate::Gate(std::string designator,
|
||||||
germanairlinesva_geodata::point center,
|
germanairlinesva_geodata::point center,
|
||||||
std::uint8_t radius)
|
std::uint8_t radius)
|
||||||
{
|
{
|
||||||
@ -39,9 +39,9 @@ namespace germanairlinesva_simdata
|
|||||||
sizeof(center) + sizeof(radius),
|
sizeof(center) + sizeof(radius),
|
||||||
0);
|
0);
|
||||||
std::uint8_t *bufPtr = file.data();
|
std::uint8_t *bufPtr = file.data();
|
||||||
memset(bufPtr,
|
std::memset(bufPtr,
|
||||||
static_cast<std::uint8_t>(this->designator.length()),
|
static_cast<std::uint8_t>(this->designator.length()),
|
||||||
sizeof(std::uint8_t));
|
sizeof(std::uint8_t));
|
||||||
bufPtr++;
|
bufPtr++;
|
||||||
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
|
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
|
||||||
bufPtr += this->designator.length() + 1;
|
bufPtr += this->designator.length() + 1;
|
||||||
|
|||||||
@ -35,12 +35,12 @@ namespace germanairlinesva_simdata
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// From X-Plane or MakeRwys
|
// From X-Plane or MakeRwys
|
||||||
Gate(const std::string &designator,
|
Gate(std::string designator,
|
||||||
double latitude,
|
double latitude,
|
||||||
double longitude,
|
double longitude,
|
||||||
std::uint8_t radius);
|
std::uint8_t radius);
|
||||||
// From database
|
// From database
|
||||||
Gate(const std::string &designator,
|
Gate(std::string designator,
|
||||||
germanairlinesva_geodata::point center,
|
germanairlinesva_geodata::point center,
|
||||||
std::uint8_t radius);
|
std::uint8_t radius);
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace germanairlinesva_simdata
|
|||||||
double longitudeEnd,
|
double longitudeEnd,
|
||||||
double width)
|
double width)
|
||||||
{
|
{
|
||||||
this->designator = std::move(designator);
|
this->designator = designator;
|
||||||
this->width = width;
|
this->width = width;
|
||||||
this->length = germanairlinesva_geodata::distanceEarthD(latitudeStart,
|
this->length = germanairlinesva_geodata::distanceEarthD(latitudeStart,
|
||||||
longitudeStart,
|
longitudeStart,
|
||||||
@ -31,9 +31,9 @@ namespace germanairlinesva_simdata
|
|||||||
sizeof(this->trueHeading),
|
sizeof(this->trueHeading),
|
||||||
0);
|
0);
|
||||||
std::uint8_t *bufPtr = file.data();
|
std::uint8_t *bufPtr = file.data();
|
||||||
memset(bufPtr,
|
std::memset(bufPtr,
|
||||||
static_cast<std::uint8_t>(this->designator.length()),
|
static_cast<std::uint8_t>(this->designator.length()),
|
||||||
sizeof(std::uint8_t));
|
sizeof(std::uint8_t));
|
||||||
bufPtr++;
|
bufPtr++;
|
||||||
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
|
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
|
||||||
bufPtr += this->designator.length() + 1;
|
bufPtr += this->designator.length() + 1;
|
||||||
@ -52,7 +52,7 @@ namespace germanairlinesva_simdata
|
|||||||
std::uint16_t length,
|
std::uint16_t length,
|
||||||
std::uint16_t trueHeading)
|
std::uint16_t trueHeading)
|
||||||
{
|
{
|
||||||
this->designator = std::move(designator);
|
this->designator = designator;
|
||||||
this->bounds = bounds;
|
this->bounds = bounds;
|
||||||
this->width = width;
|
this->width = width;
|
||||||
this->length = length;
|
this->length = length;
|
||||||
@ -64,9 +64,9 @@ namespace germanairlinesva_simdata
|
|||||||
sizeof(this->trueHeading),
|
sizeof(this->trueHeading),
|
||||||
0);
|
0);
|
||||||
std::uint8_t *bufPtr = file.data();
|
std::uint8_t *bufPtr = file.data();
|
||||||
memset(bufPtr,
|
std::memset(bufPtr,
|
||||||
static_cast<std::uint8_t>(this->designator.length()),
|
static_cast<std::uint8_t>(this->designator.length()),
|
||||||
sizeof(std::uint8_t));
|
sizeof(std::uint8_t));
|
||||||
bufPtr++;
|
bufPtr++;
|
||||||
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
|
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
|
||||||
bufPtr += this->designator.length() + 1;
|
bufPtr += this->designator.length() + 1;
|
||||||
|
|||||||
18
utilities/include/constants.h
Normal file
18
utilities/include/constants.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef GERMANAIRLINESVA_GACONNECTOR_CONSTANTS_H
|
||||||
|
#define GERMANAIRLINESVA_GACONNECTOR_CONSTANTS_H
|
||||||
|
|
||||||
|
#define XPLANE_CUSTOM_SCENERY "Custom Scenery/scenery_packs.ini"
|
||||||
|
#define XPLANE_PLUGIN_DIRECTORY "Resources/plugins/GAConnector/"
|
||||||
|
|
||||||
|
#define XPLANE11_BASE_SCENERY \
|
||||||
|
"Resources/default scenery/default apt dat/Earth nav data/apt.dat"
|
||||||
|
#define XPLANE12_BASE_SCENERY \
|
||||||
|
"Global Scenery/Global Airports/Earth nav data/apt.dat"
|
||||||
|
|
||||||
|
#define RECORDING_DIRECTORY "recordings/"
|
||||||
|
|
||||||
|
#define CONFIG "config.cfg"
|
||||||
|
#define SIMDATABASE "sim.bin"
|
||||||
|
#define LOGBOOK "logbook.bin"
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -38,6 +38,8 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace germanairlinesva_util
|
namespace germanairlinesva_util
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
@ -45,10 +45,10 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
message("Building for MacOSX Universal into ${PROJECT_BINARY_DIR}/${PLUGIN_NAME}/${BIT}")
|
message("Building for MacOSX Universal into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}")
|
||||||
|
|
||||||
set_target_properties(germanairlinesva_xplugin PROPERTIES
|
set_target_properties(germanairlinesva_xplugin PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}
|
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}
|
||||||
INSTALL_RPATH "@loader_path"
|
INSTALL_RPATH "@loader_path"
|
||||||
OUTPUT_NAME mac
|
OUTPUT_NAME mac
|
||||||
)
|
)
|
||||||
@ -66,10 +66,10 @@ if(APPLE)
|
|||||||
${CMAKE_SOURCE_DIR}/XPSDK/Libraries/Mac/XPLM.framework/XPLM
|
${CMAKE_SOURCE_DIR}/XPSDK/Libraries/Mac/XPLM.framework/XPLM
|
||||||
)
|
)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
message("Building for Linux ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
|
message("Building for Linux ${BIT} into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}")
|
||||||
|
|
||||||
set_target_properties(germanairlinesva_xplugin PROPERTIES
|
set_target_properties(germanairlinesva_xplugin PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}
|
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}
|
||||||
INSTALL_RPATH "\$ORIGIN"
|
INSTALL_RPATH "\$ORIGIN"
|
||||||
OUTPUT_NAME lin
|
OUTPUT_NAME lin
|
||||||
)
|
)
|
||||||
@ -84,10 +84,10 @@ elseif(UNIX)
|
|||||||
pthread
|
pthread
|
||||||
)
|
)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
message("Building for Windows ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
|
message("Building for Windows ${BIT} into ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}")
|
||||||
|
|
||||||
set_target_properties(germanairlinesva_xplugin PROPERTIES
|
set_target_properties(germanairlinesva_xplugin PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}
|
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/X-Plane/${PLUGIN_NAME}/${BIT}
|
||||||
OUTPUT_NAME win
|
OUTPUT_NAME win
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,12 @@
|
|||||||
#define GERMANAIRLINESVA_GACONNECTOR_XPLUGIN_MAIN_H
|
#define GERMANAIRLINESVA_GACONNECTOR_XPLUGIN_MAIN_H
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
|
#include "constants.h"
|
||||||
|
#include "logbook.h"
|
||||||
#include "pathRecording.h"
|
#include "pathRecording.h"
|
||||||
#include "simdata.h"
|
#include "simdata.h"
|
||||||
#include "simulatorDatabase.hpp"
|
#include "simulatorDatabase.hpp"
|
||||||
|
#include "util.hpp"
|
||||||
#include "websocket.h"
|
#include "websocket.h"
|
||||||
|
|
||||||
#include "XPLM/XPLMDataAccess.h"
|
#include "XPLM/XPLMDataAccess.h"
|
||||||
|
|||||||
@ -114,8 +114,8 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
|||||||
roll = XPLMFindDataRef("sim/flightmodel/position/phi"); // FLOAT
|
roll = XPLMFindDataRef("sim/flightmodel/position/phi"); // FLOAT
|
||||||
quaternion = XPLMFindDataRef("sim/flightmodel/position/q"); // FLOAT[4]
|
quaternion = XPLMFindDataRef("sim/flightmodel/position/q"); // FLOAT[4]
|
||||||
|
|
||||||
configuration = germanairlinesva_config::readConfig(
|
configuration =
|
||||||
"Resources/plugins/GAConnector/config.cfg");
|
germanairlinesva_config::readConfig(XPLANE_PLUGIN_DIRECTORY CONFIG);
|
||||||
toLog("Config loaded");
|
toLog("Config loaded");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -130,29 +130,27 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
|||||||
toLog("WebSocket started");
|
toLog("WebSocket started");
|
||||||
|
|
||||||
char hash[2 * MD5LEN + 1] = "";
|
char hash[2 * MD5LEN + 1] = "";
|
||||||
if (germanairlinesva_util::generateMD5("Custom Scenery/scenery_packs.ini",
|
if (germanairlinesva_util::generateMD5(XPLANE_CUSTOM_SCENERY, hash, toLog) ==
|
||||||
hash,
|
0) {
|
||||||
toLog) == 0) {
|
|
||||||
|
|
||||||
if (strcmp(configuration["scenery"].c_str(), hash) != 0 ||
|
if (strcmp(configuration["scenery"].c_str(), hash) != 0 ||
|
||||||
!germanairlinesva_util::fileExists(
|
!germanairlinesva_util::fileExists(
|
||||||
"Resources/plugins/GAConnector/sim.bin")) {
|
XPLANE_PLUGIN_DIRECTORY SIMDATABASE)) {
|
||||||
scan("Resources/default scenery/default apt dat/Earth nav "
|
scan(xplaneVersion < 12000 ? XPLANE11_BASE_SCENERY
|
||||||
"data/apt.dat",
|
: XPLANE12_BASE_SCENERY,
|
||||||
"Custom Scenery/scenery_packs.ini",
|
XPLANE_CUSTOM_SCENERY,
|
||||||
"Resources/plugins/GAConnector/log.txt",
|
XPLANE_PLUGIN_DIRECTORY "log.txt",
|
||||||
airports);
|
airports);
|
||||||
germanairlinesva_simdata::toFile(airports,
|
germanairlinesva_simdata::toFile(airports,
|
||||||
"Resources/plugins/GAConnector/sim.bin");
|
XPLANE_PLUGIN_DIRECTORY SIMDATABASE);
|
||||||
|
|
||||||
configuration["scenery"] = hash;
|
configuration["scenery"] = hash;
|
||||||
germanairlinesva_config::writeConfig(
|
germanairlinesva_config::writeConfig(configuration,
|
||||||
configuration,
|
XPLANE_PLUGIN_DIRECTORY CONFIG);
|
||||||
"Resources/plugins/GAConnector/config.cfg");
|
|
||||||
toLog("Sim Database updated");
|
toLog("Sim Database updated");
|
||||||
} else {
|
} else {
|
||||||
airports = germanairlinesva_simdata::fromFile(
|
airports = germanairlinesva_simdata::fromFile(
|
||||||
"Resources/plugins/GAConnector/sim.bin");
|
XPLANE_PLUGIN_DIRECTORY SIMDATABASE);
|
||||||
toLog("Sim Database loaded");
|
toLog("Sim Database loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,6 +169,39 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
|||||||
recordingThread = std::thread(&recordingWorker);
|
recordingThread = std::thread(&recordingWorker);
|
||||||
toLog("Workers started");
|
toLog("Workers started");
|
||||||
|
|
||||||
|
toLog("Logbook Test");
|
||||||
|
germanairlinesva_logbook::Logbook logbook;
|
||||||
|
logbook.addEntry({"08.09.2022",
|
||||||
|
"1000",
|
||||||
|
"L049",
|
||||||
|
"D-ALFA",
|
||||||
|
"John F. Kennedy International Aiport / EDDF",
|
||||||
|
"A1",
|
||||||
|
"14L",
|
||||||
|
"Gander International Airport / CYQX",
|
||||||
|
"10",
|
||||||
|
"03",
|
||||||
|
"10:00",
|
||||||
|
"10:20",
|
||||||
|
"13:20",
|
||||||
|
"13:30",
|
||||||
|
210.5,
|
||||||
|
20.1,
|
||||||
|
5012.4156,
|
||||||
|
8.87,
|
||||||
|
5041.3856,
|
||||||
|
7.1,
|
||||||
|
971.14,
|
||||||
|
2.41,
|
||||||
|
980.65,
|
||||||
|
-165.23,
|
||||||
|
1,
|
||||||
|
1.2012,
|
||||||
|
"2022-09-08_VGA1000",
|
||||||
|
5.5,
|
||||||
|
1});
|
||||||
|
logbook.toFile();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +215,7 @@ PLUGIN_API void XPluginStop(void)
|
|||||||
serverThread.join();
|
serverThread.join();
|
||||||
recordingThread.join();
|
recordingThread.join();
|
||||||
|
|
||||||
std::ofstream out("Resources/plugins/GAConnector/flight.rec",
|
std::ofstream out(XPLANE_PLUGIN_DIRECTORY RECORDING_DIRECTORY "flight.rec",
|
||||||
std::fstream::binary);
|
std::fstream::binary);
|
||||||
out.write(reinterpret_cast<const char *>(p.getBinaryData()),
|
out.write(reinterpret_cast<const char *>(p.getBinaryData()),
|
||||||
(std::streamsize)p.getBinaryLength());
|
(std::streamsize)p.getBinaryLength());
|
||||||
@ -209,7 +240,7 @@ float flightLoop(float elapsedMe, float elapsedSim, int counter, void *refcon)
|
|||||||
{
|
{
|
||||||
const std::lock_guard<std::mutex> lock(mutex);
|
const std::lock_guard<std::mutex> lock(mutex);
|
||||||
|
|
||||||
memset(&toSend, 0, sizeof(germanairlinesva_websocket::data));
|
std::memset(&toSend, 0, sizeof(germanairlinesva_websocket::data));
|
||||||
|
|
||||||
toSend.pause = XPLMGetDatai(pauseIndicator);
|
toSend.pause = XPLMGetDatai(pauseIndicator);
|
||||||
toSend.pBrake = XPLMGetDataf(parkingBrake);
|
toSend.pBrake = XPLMGetDataf(parkingBrake);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user