Skip to content

Commit

Permalink
Merge pull request #1 from vACDM/feature/AORT,ASRT&colorizeFixes
Browse files Browse the repository at this point in the history
feature/aort,asrt&colorize fixes
  • Loading branch information
LeoKle authored Apr 19, 2023
2 parents a40372a + 07b0be1 commit ab239eb
Show file tree
Hide file tree
Showing 8 changed files with 323 additions and 61 deletions.
51 changes: 50 additions & 1 deletion com/Airport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void Airport::updateTobt(const std::string& callsign, const std::chrono::utc_clo
if (true == resetTsat)
root["vacdm"]["tsat"] = Airport::timestampToIsoString(types::defaultTime);
if (false == manualTobt)
root["vacdm"]["tobt_state"] = "NOW";
root["vacdm"]["tobt_state"] = "CONFIRMED";
root["vacdm"]["ttot"] = root["vacdm"]["tsat"].asString();
root["vacdm"]["asat"] = root["vacdm"]["tsat"].asString();
root["vacdm"]["aobt"] = root["vacdm"]["tsat"].asString();
Expand Down Expand Up @@ -246,6 +246,52 @@ void Airport::updateAtot(const std::string& callsign, const std::chrono::utc_clo
}
}

void Airport::updateAsrt(const std::string& callsign, const std::chrono::utc_clock::time_point& asrt) {
if (true == this->m_pause)
return;

std::lock_guard guard(this->m_lock);

auto it = this->m_flights.find(callsign);
if (it != this->m_flights.end() && it->second[FlightServer].callsign == callsign) {
Json::Value root;

root["callsign"] = callsign;
root["vacdm"] = Json::Value();
root["vacdm"]["asrt"] = Airport::timestampToIsoString(asrt);


it->second[FlightEuroscope].lastUpdate = std::chrono::utc_clock::now();
it->second[FlightConsolidated].asrt = asrt;

logging::Logger::instance().log("Airport", logging::Logger::Level::Debug, "Updating ASRT: " + callsign + ", " + root["vacdm"]["asrt"].asString());
Server::instance().patchFlight(callsign, root);
}
}

void Airport::updateAort(const std::string& callsign, const std::chrono::utc_clock::time_point& aort) {
if (true == this->m_pause)
return;

std::lock_guard guard(this->m_lock);

auto it = this->m_flights.find(callsign);
if (it != this->m_flights.end() && it->second[FlightServer].callsign == callsign) {
Json::Value root;

root["callsign"] = callsign;
root["vacdm"] = Json::Value();
root["vacdm"]["aort"] = Airport::timestampToIsoString(aort);


it->second[FlightEuroscope].lastUpdate = std::chrono::utc_clock::now();
it->second[FlightConsolidated].aort = aort;

logging::Logger::instance().log("Airport", logging::Logger::Level::Debug, "Updating AORT: " + callsign + ", " + root["vacdm"]["aort"].asString());
Server::instance().patchFlight(callsign, root);
}
}

Airport::SendType Airport::deltaEuroscopeToBackend(const std::array<types::Flight_t, 3>& data, Json::Value& root) {
root.clear();

Expand Down Expand Up @@ -361,6 +407,9 @@ void Airport::consolidateData(std::array<types::Flight_t, 3>& data) {
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].runway = data[FlightEuroscope].runway;
Expand Down
2 changes: 2 additions & 0 deletions com/Airport.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class Airport {
void updateAsat(const std::string& callsign, const std::chrono::utc_clock::time_point& asat);
void updateAobt(const std::string& callsign, const std::chrono::utc_clock::time_point& aobt);
void updateAtot(const std::string& callsign, const std::chrono::utc_clock::time_point& atot);
void updateAsrt(const std::string& callsign, const std::chrono::utc_clock::time_point& asrt);
void updateAort(const std::string& callsign, const std::chrono::utc_clock::time_point& aort);
bool flightExists(const std::string& callsign);
const types::Flight_t& flight(const std::string& callsign);
};
Expand Down
3 changes: 3 additions & 0 deletions com/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ std::list<types::Flight_t> Server::allFlights(const std::string& airport) {
flights.back().aobt = Server::isoStringToTimestamp(flight["vacdm"]["aobt"].asString());
flights.back().atot = Server::isoStringToTimestamp(flight["vacdm"]["atot"].asString());
flights.back().exot = std::chrono::utc_clock::time_point(std::chrono::minutes(flight["vacdm"]["exot"].asInt64()));
flights.back().asrt = Server::isoStringToTimestamp(flight["vacdm"]["asrt"].asString());
flights.back().aort = Server::isoStringToTimestamp(flight["vacdm"]["aort"].asString());
flights.back().tobt_state = flight["vacdm"]["tobt_state"].asString();

flights.back().runway = flight["clearance"]["dep_rwy"].asString();
flights.back().sid = flight["clearance"]["sid"].asString();
Expand Down
2 changes: 2 additions & 0 deletions config/FileFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ bool FileFormat::parse(const std::string& filename, SystemConfig& config) {
parsed = this->parseColor(entry[1], config.green, lineOffset);
} else if ("COLOR_blue" == entry[0]) {
parsed = this->parseColor(entry[1], config.blue, lineOffset);
} else if ("COLOR_lightyellow" == entry[0]) {
parsed = this->parseColor(entry[1], config.lightyellow, lineOffset);
} else if ("COLOR_yellow" == entry[0]) {
parsed = this->parseColor(entry[1], config.yellow, lineOffset);
} else if ("COLOR_orange" == entry[0]) {
Expand Down
4 changes: 4 additions & 0 deletions types/Flight.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ typedef struct Flight {
// position/*
double latitude = 0.0;
double longitude = 0.0;
bool taxizoneIsTaxiout = false;

// flightplan/*
std::string origin;
Expand All @@ -32,6 +33,9 @@ typedef struct Flight {
std::chrono::utc_clock::time_point asat = defaultTime;
std::chrono::utc_clock::time_point aobt = defaultTime;
std::chrono::utc_clock::time_point atot = defaultTime;
std::chrono::utc_clock::time_point asrt = defaultTime;
std::chrono::utc_clock::time_point aort = defaultTime;
std::string tobt_state = "";

// clearance/*
std::string runway;
Expand Down
1 change: 1 addition & 0 deletions types/SystemConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace vacdm {
COLORREF lightblue = RGB(53, 218, 235);
COLORREF green = RGB(0, 181, 27);
COLORREF blue = RGB(0, 0, 255);
COLORREF lightyellow = RGB(255, 255, 191);
COLORREF yellow = RGB(255, 255, 0);
COLORREF orange = RGB(255, 153, 0);
COLORREF red = RGB(255, 0, 0);
Expand Down
Loading

0 comments on commit ab239eb

Please sign in to comment.