Skip to content

Commit

Permalink
Merge pull request #6 from vACDM/feature/EventBooking
Browse files Browse the repository at this point in the history
Feature/event booking
  • Loading branch information
LeoKle authored Apr 19, 2023
2 parents ab239eb + fad998b commit 1024571
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
30 changes: 15 additions & 15 deletions com/Airport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,21 +396,21 @@ void Airport::consolidateData(std::array<types::Flight_t, 3>& data) {
data[FlightConsolidated].destination = data[FlightEuroscope].destination;
data[FlightConsolidated].rule = data[FlightEuroscope].rule;

//if (data[FlightConsolidated].lastUpdate != data[FlightServer].lastUpdate) {
data[FlightConsolidated].lastUpdate = data[FlightServer].lastUpdate;
data[FlightConsolidated].eobt = data[FlightServer].eobt;
data[FlightConsolidated].tobt = data[FlightServer].tobt;
data[FlightConsolidated].ctot = data[FlightServer].ctot;
data[FlightConsolidated].ttot = data[FlightServer].ttot;
data[FlightConsolidated].tsat = data[FlightServer].tsat;
data[FlightConsolidated].exot = data[FlightServer].exot;
data[FlightConsolidated].asat = data[FlightServer].asat;
data[FlightConsolidated].aobt = data[FlightServer].aobt;
data[FlightConsolidated].atot = data[FlightServer].atot;
data[FlightConsolidated].aort = data[FlightServer].aort;
data[FlightConsolidated].asrt = data[FlightServer].asrt;
data[FlightConsolidated].tobt_state = data[FlightServer].tobt_state;
//}
data[FlightConsolidated].lastUpdate = data[FlightServer].lastUpdate;
data[FlightConsolidated].eobt = data[FlightServer].eobt;
data[FlightConsolidated].tobt = data[FlightServer].tobt;
data[FlightConsolidated].ctot = data[FlightServer].ctot;
data[FlightConsolidated].ttot = data[FlightServer].ttot;
data[FlightConsolidated].tsat = data[FlightServer].tsat;
data[FlightConsolidated].exot = data[FlightServer].exot;
data[FlightConsolidated].asat = data[FlightServer].asat;
data[FlightConsolidated].aobt = data[FlightServer].aobt;
data[FlightConsolidated].atot = data[FlightServer].atot;
data[FlightConsolidated].aort = data[FlightServer].aort;
data[FlightConsolidated].asrt = data[FlightServer].asrt;
data[FlightConsolidated].tobt_state = data[FlightServer].tobt_state;

data[FlightConsolidated].hasBooking = data[FlightServer].hasBooking;

data[FlightConsolidated].runway = data[FlightEuroscope].runway;
data[FlightConsolidated].sid = data[FlightEuroscope].sid;
Expand Down
8 changes: 5 additions & 3 deletions com/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,16 @@ bool Server::checkWepApi() {

logging::Logger::instance().log("Server", logging::Logger::Level::System, "Received API-version-message: " + __receivedGetData);
if (reader->parse(__receivedGetData.c_str(), __receivedGetData.c_str() + __receivedGetData.length(), &root, &errors)) {
if (ApiMajorVersion != root.get("major", Json::Value(-1)).asInt() || ApiMinorVersion != root.get("minor", Json::Value(-1)).asInt()) {
this->m_errorCode = "Invalid version: " + __receivedGetData;
if (ApiMajorVersion != root.get("major", Json::Value(-1)).asInt()) {
this->m_errorCode = "Backend-version is incompatible. Please update the plugin.";
this->m_validWebApi = false;
}
else {
this->m_validWebApi = true;
}
}
else {
this->m_errorCode = "Invalid response: " + __receivedGetData;
this->m_errorCode = "Invalid backend-version response: " + __receivedGetData;
this->m_validWebApi = false;
}
}
Expand Down Expand Up @@ -275,6 +275,8 @@ std::list<types::Flight_t> Server::allFlights(const std::string& airport) {
flights.back().aort = Server::isoStringToTimestamp(flight["vacdm"]["aort"].asString());
flights.back().tobt_state = flight["vacdm"]["tobt_state"].asString();

flights.back().hasBooking = flight["hasBooking"].asBool();

flights.back().runway = flight["clearance"]["dep_rwy"].asString();
flights.back().sid = flight["clearance"]["sid"].asString();
flights.back().assignedSquawk = flight["clearance"]["assigned_squawk"].asString();
Expand Down
3 changes: 3 additions & 0 deletions types/Flight.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ typedef struct Flight {
std::chrono::utc_clock::time_point aort = defaultTime;
std::string tobt_state = "";

// booking/*
bool hasBooking = false;

// clearance/*
std::string runway;
std::string sid;
Expand Down
11 changes: 11 additions & 0 deletions vACDM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,16 @@ void vACDM::OnGetTagItem(EuroScopePlugIn::CFlightPlan FlightPlan, EuroScopePlugI
*pRGB = this->colorizeAort(data);
}
break;
case itemType::EventBooking:
if (data.hasBooking == true) {
stream << "B";
*pRGB = this->m_pluginConfig.green;
}
else {
stream << "";
*pRGB = this->m_pluginConfig.grey;
}
break;
default:
break;
}
Expand Down Expand Up @@ -954,6 +964,7 @@ void vACDM::RegisterTagItemTypes() {
RegisterTagItemType("ATOT", itemType::ATOT);
RegisterTagItemType("ASRT", itemType::ASRT);
RegisterTagItemType("AORT", itemType::AORT);
RegisterTagItemType("Event Booking", itemType::EventBooking);
}

} //namespace vacdm
1 change: 1 addition & 0 deletions vACDM.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum itemType
ATOT,
ASRT,
AORT,
EventBooking
};

enum itemFunction
Expand Down

0 comments on commit 1024571

Please sign in to comment.