-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Request Builder Functions * Style * Tidy Up The Api Helper * Add To ApiHelper * Formatting * Fix missing constructor for ApiInterface * Fix Method * Status indicator tag item * Start cancellation menu * Cancelling Prenote Menu * Allow controller positions to have prenote permissions * Only allow deletion of prenotes by responsible controllers * Sending prenote messages * Formatting
- Loading branch information
Showing
27 changed files
with
2,113 additions
and
817 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,81 @@ | ||
#include "pch/pch.h" | ||
#include "controller/ControllerPosition.h" | ||
#include "ControllerPosition.h" | ||
|
||
namespace UKControllerPlugin { | ||
namespace Controller { | ||
ControllerPosition::ControllerPosition( | ||
int id, | ||
std::string callsign, | ||
double frequency, | ||
std::vector<std::string> topdown, | ||
bool requestsDepartureReleases, | ||
bool receivesDepartureReleases | ||
): id(id), requestsDepartureReleases(requestsDepartureReleases), | ||
receivesDepartureReleases(receivesDepartureReleases), callsign(callsign), | ||
frequency(frequency), topdown(std::move(topdown)) | ||
{ } | ||
namespace UKControllerPlugin::Controller { | ||
ControllerPosition::ControllerPosition( | ||
int id, | ||
std::string callsign, | ||
double frequency, | ||
std::vector<std::string> topdown, | ||
bool requestsDepartureReleases, | ||
bool receivesDepartureReleases, | ||
bool sendsPrenoteMessages, | ||
bool receivesPrenoteMessages) | ||
: id(id), requestsDepartureReleases(requestsDepartureReleases), | ||
receivesDepartureReleases(receivesDepartureReleases), callsign(std::move(callsign)), frequency(frequency), | ||
topdown(std::move(topdown)), sendsPrenoteMessages(sendsPrenoteMessages), | ||
receivesPrenoteMessages(receivesPrenoteMessages) | ||
{ | ||
} | ||
|
||
int ControllerPosition::GetId() const | ||
{ | ||
return this->id; | ||
} | ||
auto ControllerPosition::GetId() const -> int | ||
{ | ||
return this->id; | ||
} | ||
|
||
std::string ControllerPosition::GetUnit() const | ||
{ | ||
return this->callsign.substr(0, this->callsign.find('_')); | ||
} | ||
auto ControllerPosition::GetUnit() const -> std::string | ||
{ | ||
return this->callsign.substr(0, this->callsign.find('_')); | ||
} | ||
|
||
std::string ControllerPosition::GetCallsign() const | ||
{ | ||
return this->callsign; | ||
} | ||
auto ControllerPosition::GetCallsign() const -> std::string | ||
{ | ||
return this->callsign; | ||
} | ||
|
||
double ControllerPosition::GetFrequency() const | ||
{ | ||
return this->frequency; | ||
} | ||
auto ControllerPosition::GetFrequency() const -> double | ||
{ | ||
return this->frequency; | ||
} | ||
|
||
std::string ControllerPosition::GetType() const | ||
{ | ||
return callsign.substr(this->callsign.size() - 3, this->callsign.size()); | ||
} | ||
auto ControllerPosition::GetType() const -> std::string | ||
{ | ||
return callsign.substr(this->callsign.size() - 3, this->callsign.size()); | ||
} | ||
|
||
bool ControllerPosition::HasTopdownAirfield(std::string icao) const | ||
{ | ||
return std::find( | ||
this->topdown.cbegin(), | ||
this->topdown.cend(), | ||
icao | ||
) != this->topdown.cend(); | ||
} | ||
auto ControllerPosition::HasTopdownAirfield(const std::string& icao) const -> bool | ||
{ | ||
return std::find(this->topdown.cbegin(), this->topdown.cend(), icao) != this->topdown.cend(); | ||
} | ||
|
||
bool ControllerPosition::RequestsDepartureReleases() const | ||
{ | ||
return this->requestsDepartureReleases; | ||
} | ||
auto ControllerPosition::RequestsDepartureReleases() const -> bool | ||
{ | ||
return this->requestsDepartureReleases; | ||
} | ||
|
||
bool ControllerPosition::ReceivesDepartureReleases() const | ||
{ | ||
return this->receivesDepartureReleases; | ||
} | ||
auto ControllerPosition::ReceivesDepartureReleases() const -> bool | ||
{ | ||
return this->receivesDepartureReleases; | ||
} | ||
|
||
std::vector<std::string> ControllerPosition::GetTopdown() const | ||
{ | ||
return this->topdown; | ||
} | ||
auto ControllerPosition::GetTopdown() const -> std::vector<std::string> | ||
{ | ||
return this->topdown; | ||
} | ||
|
||
bool ControllerPosition::operator==(const ControllerPosition& position) const | ||
{ | ||
return this->GetId() == position.GetId() && | ||
fabs(this->frequency - position.GetFrequency()) < 0.001 && | ||
this->callsign.compare(position.GetCallsign()) == 0; | ||
} | ||
} // namespace Controller | ||
} // namespace UKControllerPlugin | ||
auto ControllerPosition::operator==(const ControllerPosition& position) const -> bool | ||
{ | ||
return this->GetId() == position.GetId() && | ||
fabs(this->frequency - position.GetFrequency()) < frequencyMatchDelta && | ||
this->callsign == position.GetCallsign(); | ||
} | ||
|
||
auto ControllerPosition::SendsPrenoteMessages() const -> bool | ||
{ | ||
return this->sendsPrenoteMessages; | ||
} | ||
|
||
auto ControllerPosition::ReceivesPrenoteMessages() const -> bool | ||
{ | ||
return this->receivesPrenoteMessages; | ||
} | ||
} // namespace UKControllerPlugin::Controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,61 @@ | ||
#pragma once | ||
|
||
namespace UKControllerPlugin { | ||
namespace Controller { | ||
|
||
/* | ||
Class that represents a potential UK Controller position. | ||
*/ | ||
class ControllerPosition | ||
{ | ||
public: | ||
ControllerPosition( | ||
int id, | ||
std::string callsign, | ||
double frequency, | ||
std::vector<std::string> topdown, | ||
bool requestsDepartureReleases, | ||
bool receivesDepartureReleases | ||
); | ||
|
||
int GetId() const; | ||
std::string GetUnit() const; | ||
std::string GetCallsign() const; | ||
double GetFrequency() const; | ||
std::vector<std::string> GetTopdown() const; | ||
std::string GetType() const; | ||
bool HasTopdownAirfield(std::string icao) const; | ||
bool RequestsDepartureReleases() const; | ||
bool ReceivesDepartureReleases() const; | ||
bool operator==(const ControllerPosition & position) const; | ||
|
||
private: | ||
|
||
// The id of the controller in the API | ||
const int id; | ||
|
||
// The default controller callsign | ||
const std::string callsign; | ||
|
||
// The controller frequency | ||
const double frequency; | ||
|
||
// The airfields for which this controller has some level of top-down responsibility. | ||
const std::vector<std::string> topdown; | ||
|
||
// Can the controller request a departure release | ||
const bool requestsDepartureReleases; | ||
|
||
// Can the controller receive a departure release | ||
const bool receivesDepartureReleases; | ||
}; | ||
} // namespace Controller | ||
} // namespace UKControllerPlugin | ||
namespace UKControllerPlugin::Controller { | ||
|
||
/* | ||
Class that represents a potential UK Controller position. | ||
*/ | ||
class ControllerPosition | ||
{ | ||
public: | ||
ControllerPosition( | ||
int id, | ||
std::string callsign, | ||
double frequency, | ||
std::vector<std::string> topdown, | ||
bool requestsDepartureReleases, | ||
bool receivesDepartureReleases, | ||
bool sendsPrenoteMessages = false, | ||
bool receivesPrenoteMessages = false); | ||
|
||
[[nodiscard]] auto GetId() const -> int; | ||
[[nodiscard]] auto GetUnit() const -> std::string; | ||
[[nodiscard]] auto GetCallsign() const -> std::string; | ||
[[nodiscard]] auto GetFrequency() const -> double; | ||
[[nodiscard]] auto GetTopdown() const -> std::vector<std::string>; | ||
[[nodiscard]] auto GetType() const -> std::string; | ||
[[nodiscard]] auto HasTopdownAirfield(const std::string& icao) const -> bool; | ||
[[nodiscard]] auto RequestsDepartureReleases() const -> bool; | ||
[[nodiscard]] auto ReceivesDepartureReleases() const -> bool; | ||
[[nodiscard]] auto SendsPrenoteMessages() const -> bool; | ||
[[nodiscard]] auto ReceivesPrenoteMessages() const -> bool; | ||
auto operator==(const ControllerPosition& position) const -> bool; | ||
|
||
private: | ||
// The id of the controller in the API | ||
const int id; | ||
|
||
// The default controller callsign | ||
const std::string callsign; | ||
|
||
// The controller frequency | ||
const double frequency; | ||
|
||
// The airfields for which this controller has some level of top-down responsibility. | ||
const std::vector<std::string> topdown; | ||
|
||
// Can the controller request a departure release | ||
const bool requestsDepartureReleases; | ||
|
||
// Can the controller receive a departure release | ||
const bool receivesDepartureReleases; | ||
|
||
// Can this controller send a prenote | ||
const bool sendsPrenoteMessages; | ||
|
||
// Can this controller cancel a prenote | ||
const bool receivesPrenoteMessages; | ||
|
||
const double frequencyMatchDelta = 0.001; | ||
}; | ||
} // namespace UKControllerPlugin::Controller |
Oops, something went wrong.