Fix merge errors
This commit is contained in:
parent
6027095c38
commit
de8b282ab1
@ -16,16 +16,22 @@ namespace file
|
|||||||
{
|
{
|
||||||
namespace simdata
|
namespace simdata
|
||||||
{
|
{
|
||||||
int scan(const std::string defaultFile,
|
int scan(
|
||||||
const std::string sceneryPack,
|
const std::string defaultFile,
|
||||||
const std::string logFile,
|
const std::string sceneryPack,
|
||||||
SimDatabase &airports);
|
const std::string logFile,
|
||||||
|
std::map<std::string,
|
||||||
|
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||||
|
&airports);
|
||||||
|
|
||||||
void makeAirport(const std::string &kind,
|
void makeAirport(
|
||||||
std::ifstream &infile,
|
const std::string &kind,
|
||||||
SimDatabase &airports,
|
std::ifstream &infile,
|
||||||
std::ofstream &logfile);
|
std::map<std::string,
|
||||||
void makeGate15(std::vector<Gate> &gates,
|
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||||
|
&airports,
|
||||||
|
std::ofstream &logfile);
|
||||||
|
void makeGate15(std::vector<const Gate> &gates,
|
||||||
const std::vector<std::string> &fields);
|
const std::vector<std::string> &fields);
|
||||||
void makeRunway(std::vector<const Runway> &runways,
|
void makeRunway(std::vector<const Runway> &runways,
|
||||||
const std::vector<std::string> &fields);
|
const std::vector<std::string> &fields);
|
||||||
|
|||||||
@ -6,10 +6,13 @@ namespace file
|
|||||||
{
|
{
|
||||||
namespace simdata
|
namespace simdata
|
||||||
{
|
{
|
||||||
int scan(const std::string defaultFile,
|
int scan(
|
||||||
const std::string sceneryPack,
|
const std::string defaultFile,
|
||||||
const std::string logFile,
|
const std::string sceneryPack,
|
||||||
SimDatabase &database)
|
const std::string logFile,
|
||||||
|
std::map<std::string,
|
||||||
|
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||||
|
&airports)
|
||||||
{
|
{
|
||||||
std::ifstream base(defaultFile);
|
std::ifstream base(defaultFile);
|
||||||
if (!base.good()) {
|
if (!base.good()) {
|
||||||
@ -29,7 +32,7 @@ namespace file
|
|||||||
|
|
||||||
// Default
|
// Default
|
||||||
logfile << "<FILE> " << defaultFile << std::endl;
|
logfile << "<FILE> " << defaultFile << std::endl;
|
||||||
makeAirport("DEFAULT", base, database, logfile);
|
makeAirport("DEFAULT", base, airports, logfile);
|
||||||
base.close();
|
base.close();
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
@ -49,7 +52,7 @@ namespace file
|
|||||||
std::ifstream pack(path);
|
std::ifstream pack(path);
|
||||||
if (pack.good()) {
|
if (pack.good()) {
|
||||||
logfile << "<FILE> " << path << std::endl;
|
logfile << "<FILE> " << path << std::endl;
|
||||||
makeAirport("CUSTOM", pack, database, logfile);
|
makeAirport("CUSTOM", pack, airports, logfile);
|
||||||
pack.close();
|
pack.close();
|
||||||
} else {
|
} else {
|
||||||
pack.close();
|
pack.close();
|
||||||
@ -59,18 +62,20 @@ namespace file
|
|||||||
}
|
}
|
||||||
|
|
||||||
logfile << std::endl
|
logfile << std::endl
|
||||||
<< "<STATUS> Total airports: " << database.numAirports()
|
<< "<STATUS> Total airports: " << airports.size() << std::endl;
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
custom.close();
|
custom.close();
|
||||||
logfile.close();
|
logfile.close();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeAirport(const std::string &kind,
|
void makeAirport(
|
||||||
std::ifstream &infile,
|
const std::string &kind,
|
||||||
SimDatabase &database,
|
std::ifstream &infile,
|
||||||
std::ofstream &logfile)
|
std::map<std::string,
|
||||||
|
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||||
|
&airports,
|
||||||
|
std::ofstream &logfile)
|
||||||
{
|
{
|
||||||
std::string line;
|
std::string line;
|
||||||
std::string *currentIcao = nullptr;
|
std::string *currentIcao = nullptr;
|
||||||
@ -93,7 +98,7 @@ namespace file
|
|||||||
// Write to file if ICAO is valid, and we have gates and runways
|
// Write to file if ICAO is valid, and we have gates and runways
|
||||||
if (currentIcao != nullptr && !tmpRunways.empty() &&
|
if (currentIcao != nullptr && !tmpRunways.empty() &&
|
||||||
!tmpGates.empty()) {
|
!tmpGates.empty()) {
|
||||||
database.addAirport(*currentIcao, tmpGates, tmpRunways);
|
airports[*currentIcao] = {tmpGates, tmpRunways};
|
||||||
validCount += 1;
|
validCount += 1;
|
||||||
logfile << "\t<STATUS> " << *currentIcao << " committed"
|
logfile << "\t<STATUS> " << *currentIcao << " committed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -113,7 +118,7 @@ namespace file
|
|||||||
// Write to file if ICAO is valid, and we have gates and runways
|
// Write to file if ICAO is valid, and we have gates and runways
|
||||||
if (currentIcao != nullptr && !tmpRunways.empty() &&
|
if (currentIcao != nullptr && !tmpRunways.empty() &&
|
||||||
!tmpGates.empty()) {
|
!tmpGates.empty()) {
|
||||||
database.addAirport(*currentIcao, tmpGates, tmpRunways);
|
airports[*currentIcao] = {tmpGates, tmpRunways};
|
||||||
validCount += 1;
|
validCount += 1;
|
||||||
logfile << "\t<STATUS> " << *currentIcao << " committed"
|
logfile << "\t<STATUS> " << *currentIcao << " committed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -135,7 +140,7 @@ namespace file
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentIcao != nullptr && !tmpRunways.empty() && !tmpGates.empty()) {
|
if (currentIcao != nullptr && !tmpRunways.empty() && !tmpGates.empty()) {
|
||||||
database.addAirport(*currentIcao, tmpGates, tmpRunways);
|
airports[*currentIcao] = {tmpGates, tmpRunways};
|
||||||
validCount += 1;
|
validCount += 1;
|
||||||
logfile << "\t<STATUS> " << *currentIcao << " committed" << std::endl;
|
logfile << "\t<STATUS> " << *currentIcao << " committed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,10 +116,11 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
connector = std::make_unique<germanairlinesva_websocket::Websocket>(
|
connector = std::make_unique<germanairlinesva_websocket::Websocket>(
|
||||||
"wss://ws.hofmannnet.myhome-server.de:8000",
|
"ss://ws.hofmannnet.myhome-server.de:8000",
|
||||||
configuration->getUser(),
|
configuration->getUser(),
|
||||||
toLog);
|
toLog);
|
||||||
} catch (const std::invalid_argument &e) {
|
} catch (const std::invalid_argument &e) {
|
||||||
|
toLog("SOCK");
|
||||||
toLog(e.what());
|
toLog(e.what());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -146,9 +147,55 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
|||||||
ap2.first.size() == 0 ? toLog(" SUCCESS") : toLog(" ERROR");
|
ap2.first.size() == 0 ? toLog(" SUCCESS") : toLog(" ERROR");
|
||||||
}
|
}
|
||||||
|
|
||||||
delete connector.release();
|
// Thread for sending data to websocket
|
||||||
delete database.release();
|
serverThread = std::thread(&serverWorker);
|
||||||
delete configuration.release();
|
recordingThread = std::thread(&recordingWorker);
|
||||||
|
toLog("Workers started");
|
||||||
|
|
||||||
|
toLog("Logbook Test");
|
||||||
|
germanairlinesva::file::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;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLUGIN_API void XPluginStop(void)
|
||||||
|
{
|
||||||
|
/* Flight Loop */
|
||||||
|
XPLMUnregisterFlightLoopCallback(flightLoop, nullptr);
|
||||||
|
/* End threads */
|
||||||
|
wantsExit = true;
|
||||||
|
serverThread.join();
|
||||||
|
recordingThread.join();
|
||||||
|
|
||||||
delete connector.release();
|
delete connector.release();
|
||||||
delete database.release();
|
delete database.release();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user