diff --git a/src/Airmap/AirMapManager.cc b/src/Airmap/AirMapManager.cc index 9c5f750..8fc5580 100644 --- a/src/Airmap/AirMapManager.cc +++ b/src/Airmap/AirMapManager.cc @@ -41,12 +41,12 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox) : AirspaceManager(app, toolbox) , _authStatus(Unknown) { - _logger = std::make_shared(); - qt::register_types(); // TODO: still needed? + _logger = std::make_shared(); + services::register_types(); // TODO: still needed? _logger->logging_category().setEnabled(QtDebugMsg, false); _logger->logging_category().setEnabled(QtInfoMsg, false); _logger->logging_category().setEnabled(QtWarningMsg, false); - _dispatchingLogger = std::make_shared(_logger); + _dispatchingLogger = std::make_shared(_logger); connect(&_shared, &AirMapSharedState::error, this, &AirMapManager::_error); connect(&_shared, &AirMapSharedState::authStatus, this, &AirMapManager::_authStatusChanged); } @@ -170,9 +170,9 @@ AirMapManager::_settingsTimeout() auto configuration = Client::default_production_configuration(credentials); configuration.telemetry.host = _telemetryHost; configuration.telemetry.port = _telemetryPort; - qt::Client::create(configuration, _dispatchingLogger, this, [this](const qt::Client::CreateResult& result) { + services::Client::create(configuration, _dispatchingLogger, this, [this](const services::Client::CreateResult& result) { if (result) { - qCDebug(AirMapManagerLog) << "Successfully created airmap::qt::Client instance"; + qCDebug(AirMapManagerLog) << "Successfully created airmap::services::Client instance"; _shared.setClient(result.value()); emit connectedChanged(); _connectStatus = tr("AirMap Enabled"); @@ -180,10 +180,10 @@ AirMapManager::_settingsTimeout() //-- Now test authentication _shared.login(); } else { - qWarning("Failed to create airmap::qt::Client instance"); + qWarning("Failed to create airmap::services::Client instance"); QString description = QString::fromStdString(result.error().description() ? result.error().description().get() : ""); QString error = QString::fromStdString(result.error().message()); - _error(tr("Failed to create airmap::qt::Client instance"), + _error(tr("Failed to create airmap::services::Client instance"), error, description); _connectStatus = error; if(!description.isEmpty()) { diff --git a/src/Airmap/AirMapManager.h b/src/Airmap/AirMapManager.h index 99af59b..96910f5 100644 --- a/src/Airmap/AirMapManager.h +++ b/src/Airmap/AirMapManager.h @@ -60,14 +60,14 @@ private slots: void _authStatusChanged (AirspaceManager::AuthStatus status); private: - QString _connectStatus; - QTimer _settingsTimer; - AirMapSharedState _shared; - std::shared_ptr _logger; - std::shared_ptr _dispatchingLogger; - AirspaceManager::AuthStatus _authStatus; - const std::string _telemetryHost = "telemetry.airmap.com"; - const uint16_t _telemetryPort = 16060; + QString _connectStatus; + QTimer _settingsTimer; + AirMapSharedState _shared; + std::shared_ptr _logger; + std::shared_ptr _dispatchingLogger; + AirspaceManager::AuthStatus _authStatus; + const std::string _telemetryHost = "telemetry.airmap.com"; + const uint16_t _telemetryPort = 16060; }; diff --git a/src/Airmap/AirMapSharedState.h b/src/Airmap/AirMapSharedState.h index 7269b84..7727fa9 100644 --- a/src/Airmap/AirMapSharedState.h +++ b/src/Airmap/AirMapSharedState.h @@ -35,7 +35,7 @@ public: void setSettings (const Settings& settings); const Settings& settings () const { return _settings; } - void setClient (airmap::qt::Client* client) { _client = client; } + void setClient (airmap::services::Client* client) { _client = client; } QString pilotID () { return _pilotID; } void setPilotID (const QString& pilotID) { _pilotID = pilotID; } @@ -44,9 +44,9 @@ public: * Get the current client instance. It can be NULL. If not NULL, it implies * there's an API key set. */ - airmap::qt::Client* client () const { return _client; } - bool hasAPIKey () const { return _settings.apiKey != ""; } - bool isLoggedIn () const { return _loginToken != ""; } + airmap::services::Client* client () const { return _client; } + bool hasAPIKey () const { return _settings.apiKey != ""; } + bool isLoggedIn () const { return _loginToken != ""; } using Callback = std::function; @@ -67,11 +67,11 @@ private: void _processPendingRequests (); private: - bool _isLoginInProgress = false; - QString _loginToken; ///< login token: empty when not logged in - QString _pilotID; - airmap::qt::Client* _client = nullptr; - Settings _settings; - QQueue _pendingRequests; ///< pending requests that are processed after a successful login + bool _isLoginInProgress = false; + QString _loginToken; ///< login token: empty when not logged in + QString _pilotID; + airmap::services::Client* _client = nullptr; + Settings _settings; + QQueue _pendingRequests; ///< pending requests that are processed after a successful login }; diff --git a/src/Airmap/services/advisory.cpp b/src/Airmap/services/advisory.cpp index 95745b7..25724c2 100644 --- a/src/Airmap/services/advisory.cpp +++ b/src/Airmap/services/advisory.cpp @@ -1,16 +1,16 @@ #include -std::shared_ptr airmap::qt::Advisory::create(const std::shared_ptr& dispatcher, +std::shared_ptr airmap::services::Advisory::create(const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new Advisory{dispatcher, client}}; } -airmap::qt::Advisory::Advisory(const std::shared_ptr& dispatcher, +airmap::services::Advisory::Advisory(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::Advisory::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) { +void airmap::services::Advisory::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->advisory().for_id(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -18,7 +18,7 @@ void airmap::qt::Advisory::for_id(const ForId::Parameters& parameters, const For }); } -void airmap::qt::Advisory::search(const Search::Parameters& parameters, const Search::Callback& cb) { +void airmap::services::Advisory::search(const Search::Parameters& parameters, const Search::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->advisory().search(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -26,7 +26,7 @@ void airmap::qt::Advisory::search(const Search::Parameters& parameters, const Se }); } -void airmap::qt::Advisory::report_weather(const ReportWeather::Parameters& parameters, +void airmap::services::Advisory::report_weather(const ReportWeather::Parameters& parameters, const ReportWeather::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->advisory().report_weather(parameters, [this, sp, cb](const auto& result) { diff --git a/src/Airmap/services/advisory.h b/src/Airmap/services/advisory.h index 82c64e9..5c58144 100644 --- a/src/Airmap/services/advisory.h +++ b/src/Airmap/services/advisory.h @@ -6,7 +6,7 @@ #include "dispatcher.h" namespace airmap { -namespace qt { +namespace services { class Advisory : public airmap::Advisory, public std::enable_shared_from_this { public: diff --git a/src/Airmap/services/aircrafts.cpp b/src/Airmap/services/aircrafts.cpp index 428b50e..d086966 100644 --- a/src/Airmap/services/aircrafts.cpp +++ b/src/Airmap/services/aircrafts.cpp @@ -1,16 +1,16 @@ #include -std::shared_ptr airmap::qt::Aircrafts::create(const std::shared_ptr& dispatcher, +std::shared_ptr airmap::services::Aircrafts::create(const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new Aircrafts{dispatcher, client}}; } -airmap::qt::Aircrafts::Aircrafts(const std::shared_ptr& dispatcher, +airmap::services::Aircrafts::Aircrafts(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::Aircrafts::manufacturers(const Manufacturers::Parameters& parameters, +void airmap::services::Aircrafts::manufacturers(const Manufacturers::Parameters& parameters, const Manufacturers::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->aircrafts().manufacturers(parameters, [this, sp, cb](const auto& result) { @@ -19,7 +19,7 @@ void airmap::qt::Aircrafts::manufacturers(const Manufacturers::Parameters& param }); } -void airmap::qt::Aircrafts::models(const Models::Parameters& parameters, const Models::Callback& cb) { +void airmap::services::Aircrafts::models(const Models::Parameters& parameters, const Models::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->aircrafts().models(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -27,7 +27,7 @@ void airmap::qt::Aircrafts::models(const Models::Parameters& parameters, const M }); } -void airmap::qt::Aircrafts::model_for_id(const ModelForId::Parameters& parameters, const ModelForId::Callback& cb) { +void airmap::services::Aircrafts::model_for_id(const ModelForId::Parameters& parameters, const ModelForId::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->aircrafts().model_for_id(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); diff --git a/src/Airmap/services/aircrafts.h b/src/Airmap/services/aircrafts.h index 21231f9..83be8aa 100644 --- a/src/Airmap/services/aircrafts.h +++ b/src/Airmap/services/aircrafts.h @@ -9,7 +9,7 @@ #include namespace airmap { -namespace qt { +namespace services { class Aircrafts : public airmap::Aircrafts, public std::enable_shared_from_this { public: diff --git a/src/Airmap/services/airspaces.cpp b/src/Airmap/services/airspaces.cpp index 6958af6..556fa87 100644 --- a/src/Airmap/services/airspaces.cpp +++ b/src/Airmap/services/airspaces.cpp @@ -1,16 +1,16 @@ #include -std::shared_ptr airmap::qt::Airspaces::create(const std::shared_ptr& dispatcher, +std::shared_ptr airmap::services::Airspaces::create(const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new Airspaces{dispatcher, client}}; } -airmap::qt::Airspaces::Airspaces(const std::shared_ptr& dispatcher, +airmap::services::Airspaces::Airspaces(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::Airspaces::search(const Search::Parameters& parameters, const Search::Callback& cb) { +void airmap::services::Airspaces::search(const Search::Parameters& parameters, const Search::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->airspaces().search(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -18,7 +18,7 @@ void airmap::qt::Airspaces::search(const Search::Parameters& parameters, const S }); } -void airmap::qt::Airspaces::for_ids(const ForIds::Parameters& parameters, const ForIds::Callback& cb) { +void airmap::services::Airspaces::for_ids(const ForIds::Parameters& parameters, const ForIds::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->airspaces().for_ids(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); diff --git a/src/Airmap/services/airspaces.h b/src/Airmap/services/airspaces.h index 38df223..920b7b3 100644 --- a/src/Airmap/services/airspaces.h +++ b/src/Airmap/services/airspaces.h @@ -8,7 +8,7 @@ #include namespace airmap { -namespace qt { +namespace services { class Airspaces : public airmap::Airspaces, public std::enable_shared_from_this { public: diff --git a/src/Airmap/services/authenticator.cpp b/src/Airmap/services/authenticator.cpp index e00054b..8371387 100644 --- a/src/Airmap/services/authenticator.cpp +++ b/src/Airmap/services/authenticator.cpp @@ -1,16 +1,16 @@ #include -std::shared_ptr airmap::qt::Authenticator::create( +std::shared_ptr airmap::services::Authenticator::create( const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new Authenticator{dispatcher, client}}; } -airmap::qt::Authenticator::Authenticator(const std::shared_ptr& dispatcher, +airmap::services::Authenticator::Authenticator(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::Authenticator::authenticate_with_password(const AuthenticateWithPassword::Params& parameters, +void airmap::services::Authenticator::authenticate_with_password(const AuthenticateWithPassword::Params& parameters, const AuthenticateWithPassword::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->authenticator().authenticate_with_password(parameters, [this, sp, cb](const auto& result) { @@ -19,7 +19,7 @@ void airmap::qt::Authenticator::authenticate_with_password(const AuthenticateWit }); } -void airmap::qt::Authenticator::authenticate_anonymously(const AuthenticateAnonymously::Params& parameters, +void airmap::services::Authenticator::authenticate_anonymously(const AuthenticateAnonymously::Params& parameters, const AuthenticateAnonymously::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->authenticator().authenticate_anonymously(parameters, [this, sp, cb](const auto& result) { @@ -28,7 +28,7 @@ void airmap::qt::Authenticator::authenticate_anonymously(const AuthenticateAnony }); } -void airmap::qt::Authenticator::renew_authentication(const RenewAuthentication::Params& parameters, +void airmap::services::Authenticator::renew_authentication(const RenewAuthentication::Params& parameters, const RenewAuthentication::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->authenticator().renew_authentication(parameters, [this, sp, cb](const auto& result) { diff --git a/src/Airmap/services/authenticator.h b/src/Airmap/services/authenticator.h index 4b53de1..00e96c4 100644 --- a/src/Airmap/services/authenticator.h +++ b/src/Airmap/services/authenticator.h @@ -8,7 +8,7 @@ #include namespace airmap { -namespace qt { +namespace services { class Authenticator : public airmap::Authenticator, public std::enable_shared_from_this { public: diff --git a/src/Airmap/services/client.cpp b/src/Airmap/services/client.cpp index dca403f..aea558d 100644 --- a/src/Airmap/services/client.cpp +++ b/src/Airmap/services/client.cpp @@ -46,24 +46,24 @@ class ContextRunner { } // namespace -struct airmap::qt::Client::Private { +struct airmap::services::Client::Private { explicit Private(const Client::Configuration& configuration, const std::shared_ptr& context_runner, const std::shared_ptr& dispatcher, const std::shared_ptr& client) : configuration_{configuration}, context_runner_{context_runner}, dispatcher_{dispatcher}, client_{client}, - advisory_{airmap::qt::Advisory::create(dispatcher_, client_)}, - aircrafts_{airmap::qt::Aircrafts::create(dispatcher_, client_)}, - airspaces_{airmap::qt::Airspaces::create(dispatcher_, client_)}, - authenticator_{airmap::qt::Authenticator::create(dispatcher_, client_)}, - flight_plans_{airmap::qt::FlightPlans::create(dispatcher_, client_)}, - flights_{airmap::qt::Flights::create(dispatcher_, client_)}, - pilots_{airmap::qt::Pilots::create(dispatcher_, client_)}, - rulesets_{airmap::qt::RuleSets::create(dispatcher_, client_)}, - status_{airmap::qt::Status::create(dispatcher_, client_)}, - telemetry_{airmap::qt::Telemetry::create(dispatcher_, client_)}, - traffic_{airmap::qt::Traffic::create(dispatcher_, client_)} { + advisory_{airmap::services::Advisory::create(dispatcher_, client_)}, + aircrafts_{airmap::services::Aircrafts::create(dispatcher_, client_)}, + airspaces_{airmap::services::Airspaces::create(dispatcher_, client_)}, + authenticator_{airmap::services::Authenticator::create(dispatcher_, client_)}, + flight_plans_{airmap::services::FlightPlans::create(dispatcher_, client_)}, + flights_{airmap::services::Flights::create(dispatcher_, client_)}, + pilots_{airmap::services::Pilots::create(dispatcher_, client_)}, + rulesets_{airmap::services::RuleSets::create(dispatcher_, client_)}, + status_{airmap::services::Status::create(dispatcher_, client_)}, + telemetry_{airmap::services::Telemetry::create(dispatcher_, client_)}, + traffic_{airmap::services::Traffic::create(dispatcher_, client_)} { } ~Private() { @@ -72,22 +72,22 @@ struct airmap::qt::Client::Private { Client::Configuration configuration_; std::shared_ptr context_runner_; - std::shared_ptr dispatcher_; + std::shared_ptr dispatcher_; std::shared_ptr client_; - std::shared_ptr advisory_; - std::shared_ptr aircrafts_; - std::shared_ptr airspaces_; - std::shared_ptr authenticator_; - std::shared_ptr flight_plans_; - std::shared_ptr flights_; - std::shared_ptr pilots_; - std::shared_ptr rulesets_; - std::shared_ptr status_; - std::shared_ptr telemetry_; - std::shared_ptr traffic_; + std::shared_ptr advisory_; + std::shared_ptr aircrafts_; + std::shared_ptr airspaces_; + std::shared_ptr authenticator_; + std::shared_ptr flight_plans_; + std::shared_ptr flights_; + std::shared_ptr pilots_; + std::shared_ptr rulesets_; + std::shared_ptr status_; + std::shared_ptr telemetry_; + std::shared_ptr traffic_; }; -void airmap::qt::Client::create(const Client::Configuration& configuration, const std::shared_ptr& logger, +void airmap::services::Client::create(const Client::Configuration& configuration, const std::shared_ptr& logger, QObject* parent, const CreateCallback& cb) { register_types(); @@ -115,52 +115,52 @@ void airmap::qt::Client::create(const Client::Configuration& configuration, cons } } -airmap::qt::Client::Client(std::unique_ptr&& d, QObject* parent) : QObject{parent}, d_{std::move(d)} { +airmap::services::Client::Client(std::unique_ptr&& d, QObject* parent) : QObject{parent}, d_{std::move(d)} { } -airmap::qt::Client::~Client() = default; +airmap::services::Client::~Client() = default; // From airmap::Client -airmap::Authenticator& airmap::qt::Client::authenticator() { +airmap::Authenticator& airmap::services::Client::authenticator() { return *d_->authenticator_; } -airmap::Advisory& airmap::qt::Client::advisory() { +airmap::Advisory& airmap::services::Client::advisory() { return *d_->advisory_; } -airmap::Aircrafts& airmap::qt::Client::aircrafts() { +airmap::Aircrafts& airmap::services::Client::aircrafts() { return *d_->aircrafts_; } -airmap::Airspaces& airmap::qt::Client::airspaces() { +airmap::Airspaces& airmap::services::Client::airspaces() { return *d_->airspaces_; } -airmap::FlightPlans& airmap::qt::Client::flight_plans() { +airmap::FlightPlans& airmap::services::Client::flight_plans() { return *d_->flight_plans_; } -airmap::Flights& airmap::qt::Client::flights() { +airmap::Flights& airmap::services::Client::flights() { return *d_->flights_; } -airmap::Pilots& airmap::qt::Client::pilots() { +airmap::Pilots& airmap::services::Client::pilots() { return *d_->pilots_; } -airmap::RuleSets& airmap::qt::Client::rulesets() { +airmap::RuleSets& airmap::services::Client::rulesets() { return *d_->rulesets_; } -airmap::Status& airmap::qt::Client::status() { +airmap::Status& airmap::services::Client::status() { return *d_->status_; } -airmap::Telemetry& airmap::qt::Client::telemetry() { +airmap::Telemetry& airmap::services::Client::telemetry() { return *d_->telemetry_; } -airmap::Traffic& airmap::qt::Client::traffic() { +airmap::Traffic& airmap::services::Client::traffic() { return *d_->traffic_; } diff --git a/src/Airmap/services/client.h b/src/Airmap/services/client.h index aec7b85..6ba9ffd 100644 --- a/src/Airmap/services/client.h +++ b/src/Airmap/services/client.h @@ -11,9 +11,9 @@ #include namespace airmap { -/// @namespace namespace qt bundles up types and functions that help with integrating AirMap functionality +/// @namespace namespace services bundles up types and functions that help with integrating AirMap functionality /// into Qt-based applications and libraries. -namespace qt { +namespace services { /// Client implements the airmap::Client interface, bridging over between /// the Qt event loop and the native event loop of the airmap::Client. @@ -60,6 +60,6 @@ class AIRMAP_EXPORT Client : public QObject, public airmap::Client { } // namespace airmap /// @example qt/client.cpp -/// Illustrates how to use airmap::qt::Client, airmap::qt::DispatchingLogger and airmap::qt::Logger. +/// Illustrates how to use airmap::services::Client, airmap::services::DispatchingLogger and airmap::services::Logger. #endif // AIRMAP_QT_CLIENT_H_ diff --git a/src/Airmap/services/dispatcher.cpp b/src/Airmap/services/dispatcher.cpp index 772fec7..f481a67 100644 --- a/src/Airmap/services/dispatcher.cpp +++ b/src/Airmap/services/dispatcher.cpp @@ -5,32 +5,32 @@ #include -QEvent::Type airmap::qt::Dispatcher::Event::registered_type() { +QEvent::Type airmap::services::Dispatcher::Event::registered_type() { static const Type rt = static_cast(registerEventType()); return rt; } -airmap::qt::Dispatcher::Event::Event(const std::function& task) : QEvent{registered_type()}, task_{task} { +airmap::services::Dispatcher::Event::Event(const std::function& task) : QEvent{registered_type()}, task_{task} { } -void airmap::qt::Dispatcher::Event::dispatch() { +void airmap::services::Dispatcher::Event::dispatch() { task_(); } -std::shared_ptr airmap::qt::Dispatcher::ToQt::create() { +std::shared_ptr airmap::services::Dispatcher::ToQt::create() { return std::shared_ptr{new ToQt{}}; } -airmap::qt::Dispatcher::ToQt::ToQt() { +airmap::services::Dispatcher::ToQt::ToQt() { } -void airmap::qt::Dispatcher::ToQt::dispatch(const Task& task) { +void airmap::services::Dispatcher::ToQt::dispatch(const Task& task) { auto sp = shared_from_this(); QCoreApplication::postEvent(this, new Event{[sp, task]() { task(); }}); } -bool airmap::qt::Dispatcher::ToQt::event(QEvent* event) { +bool airmap::services::Dispatcher::ToQt::event(QEvent* event) { assert(QCoreApplication::instance()); assert(QThread::currentThread() == QCoreApplication::instance()->thread()); @@ -47,15 +47,15 @@ bool airmap::qt::Dispatcher::ToQt::event(QEvent* event) { return false; } -airmap::qt::Dispatcher::Dispatcher(const std::shared_ptr& context) +airmap::services::Dispatcher::Dispatcher(const std::shared_ptr& context) : to_qt_{ToQt::create()}, context_{context} { } -void airmap::qt::Dispatcher::dispatch_to_qt(const std::function& task) { +void airmap::services::Dispatcher::dispatch_to_qt(const std::function& task) { to_qt_->dispatch(task); } -void airmap::qt::Dispatcher::dispatch_to_airmap(const std::function& task) { +void airmap::services::Dispatcher::dispatch_to_airmap(const std::function& task) { context_->schedule_in(task); } diff --git a/src/Airmap/services/dispatcher.h b/src/Airmap/services/dispatcher.h index f57d3f9..db9863d 100644 --- a/src/Airmap/services/dispatcher.h +++ b/src/Airmap/services/dispatcher.h @@ -9,7 +9,7 @@ #include #include namespace airmap { -namespace qt { +namespace services { class Dispatcher : public QObject { public: diff --git a/src/Airmap/services/flight_plans.cpp b/src/Airmap/services/flight_plans.cpp index 9e9eb01..4e434ee 100644 --- a/src/Airmap/services/flight_plans.cpp +++ b/src/Airmap/services/flight_plans.cpp @@ -1,16 +1,16 @@ #include -std::shared_ptr airmap::qt::FlightPlans::create( +std::shared_ptr airmap::services::FlightPlans::create( const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new FlightPlans{dispatcher, client}}; } -airmap::qt::FlightPlans::FlightPlans(const std::shared_ptr& dispatcher, +airmap::services::FlightPlans::FlightPlans(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::FlightPlans::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) { +void airmap::services::FlightPlans::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flight_plans().for_id(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -18,7 +18,7 @@ void airmap::qt::FlightPlans::for_id(const ForId::Parameters& parameters, const }); } -void airmap::qt::FlightPlans::create_by_polygon(const Create::Parameters& parameters, const Create::Callback& cb) { +void airmap::services::FlightPlans::create_by_polygon(const Create::Parameters& parameters, const Create::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flight_plans().create_by_polygon(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -26,7 +26,7 @@ void airmap::qt::FlightPlans::create_by_polygon(const Create::Parameters& parame }); } -void airmap::qt::FlightPlans::update(const Update::Parameters& parameters, const Update::Callback& cb) { +void airmap::services::FlightPlans::update(const Update::Parameters& parameters, const Update::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flight_plans().update(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -34,7 +34,7 @@ void airmap::qt::FlightPlans::update(const Update::Parameters& parameters, const }); } -void airmap::qt::FlightPlans::delete_(const Delete::Parameters& parameters, const Delete::Callback& cb) { +void airmap::services::FlightPlans::delete_(const Delete::Parameters& parameters, const Delete::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flight_plans().delete_(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -42,7 +42,7 @@ void airmap::qt::FlightPlans::delete_(const Delete::Parameters& parameters, cons }); } -void airmap::qt::FlightPlans::render_briefing(const RenderBriefing::Parameters& parameters, +void airmap::services::FlightPlans::render_briefing(const RenderBriefing::Parameters& parameters, const RenderBriefing::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flight_plans().render_briefing(parameters, [this, sp, cb](const auto& result) { @@ -51,7 +51,7 @@ void airmap::qt::FlightPlans::render_briefing(const RenderBriefing::Parameters& }); } -void airmap::qt::FlightPlans::submit(const Submit::Parameters& parameters, const Submit::Callback& cb) { +void airmap::services::FlightPlans::submit(const Submit::Parameters& parameters, const Submit::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flight_plans().submit(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); diff --git a/src/Airmap/services/flight_plans.h b/src/Airmap/services/flight_plans.h index e3f764d..c4233ea 100644 --- a/src/Airmap/services/flight_plans.h +++ b/src/Airmap/services/flight_plans.h @@ -8,7 +8,7 @@ #include namespace airmap { -namespace qt { +namespace services { /// FlightPlans provides functionality for managing flight plans. class FlightPlans : public airmap::FlightPlans, public std::enable_shared_from_this { diff --git a/src/Airmap/services/flights.cpp b/src/Airmap/services/flights.cpp index f2d18ef..1bfa342 100644 --- a/src/Airmap/services/flights.cpp +++ b/src/Airmap/services/flights.cpp @@ -1,16 +1,16 @@ #include -std::shared_ptr airmap::qt::Flights::create(const std::shared_ptr& dispatcher, +std::shared_ptr airmap::services::Flights::create(const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new Flights{dispatcher, client}}; } -airmap::qt::Flights::Flights(const std::shared_ptr& dispatcher, +airmap::services::Flights::Flights(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::Flights::search(const Search::Parameters& parameters, const Search::Callback& cb) { +void airmap::services::Flights::search(const Search::Parameters& parameters, const Search::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flights().search(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -18,7 +18,7 @@ void airmap::qt::Flights::search(const Search::Parameters& parameters, const Sea }); } -void airmap::qt::Flights::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) { +void airmap::services::Flights::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flights().for_id(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -26,7 +26,7 @@ void airmap::qt::Flights::for_id(const ForId::Parameters& parameters, const ForI }); } -void airmap::qt::Flights::create_flight_by_point(const CreateFlight::Parameters& parameters, +void airmap::services::Flights::create_flight_by_point(const CreateFlight::Parameters& parameters, const CreateFlight::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flights().create_flight_by_point(parameters, [this, sp, cb](const auto& result) { @@ -35,7 +35,7 @@ void airmap::qt::Flights::create_flight_by_point(const CreateFlight::Parameters& }); } -void airmap::qt::Flights::create_flight_by_path(const CreateFlight::Parameters& parameters, +void airmap::services::Flights::create_flight_by_path(const CreateFlight::Parameters& parameters, const CreateFlight::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flights().create_flight_by_path(parameters, [this, sp, cb](const auto& result) { @@ -44,7 +44,7 @@ void airmap::qt::Flights::create_flight_by_path(const CreateFlight::Parameters& }); } -void airmap::qt::Flights::create_flight_by_polygon(const CreateFlight::Parameters& parameters, +void airmap::services::Flights::create_flight_by_polygon(const CreateFlight::Parameters& parameters, const CreateFlight::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flights().create_flight_by_polygon(parameters, [this, sp, cb](const auto& result) { @@ -53,7 +53,7 @@ void airmap::qt::Flights::create_flight_by_polygon(const CreateFlight::Parameter }); } -void airmap::qt::Flights::end_flight(const EndFlight::Parameters& parameters, const EndFlight::Callback& cb) { +void airmap::services::Flights::end_flight(const EndFlight::Parameters& parameters, const EndFlight::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flights().end_flight(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -61,7 +61,7 @@ void airmap::qt::Flights::end_flight(const EndFlight::Parameters& parameters, co }); } -void airmap::qt::Flights::delete_flight(const DeleteFlight::Parameters& parameters, const DeleteFlight::Callback& cb) { +void airmap::services::Flights::delete_flight(const DeleteFlight::Parameters& parameters, const DeleteFlight::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flights().delete_flight(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -69,7 +69,7 @@ void airmap::qt::Flights::delete_flight(const DeleteFlight::Parameters& paramete }); } -void airmap::qt::Flights::start_flight_communications(const StartFlightCommunications::Parameters& parameters, +void airmap::services::Flights::start_flight_communications(const StartFlightCommunications::Parameters& parameters, const StartFlightCommunications::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flights().start_flight_communications(parameters, [this, sp, cb](const auto& result) { @@ -78,7 +78,7 @@ void airmap::qt::Flights::start_flight_communications(const StartFlightCommunica }); } -void airmap::qt::Flights::end_flight_communications(const EndFlightCommunications::Parameters& parameters, +void airmap::services::Flights::end_flight_communications(const EndFlightCommunications::Parameters& parameters, const EndFlightCommunications::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->flights().end_flight_communications(parameters, [this, sp, cb](const auto& result) { diff --git a/src/Airmap/services/flights.h b/src/Airmap/services/flights.h index 194fc96..4fb9d7f 100644 --- a/src/Airmap/services/flights.h +++ b/src/Airmap/services/flights.h @@ -8,7 +8,7 @@ #include namespace airmap { -namespace qt { +namespace services { class Flights : public airmap::Flights, public std::enable_shared_from_this { public: diff --git a/src/Airmap/services/logger.cpp b/src/Airmap/services/logger.cpp index 29b6f42..042e628 100644 --- a/src/Airmap/services/logger.cpp +++ b/src/Airmap/services/logger.cpp @@ -2,26 +2,26 @@ #include -struct airmap::qt::Logger::Private { +struct airmap::services::Logger::Private { QLoggingCategory logging_category{"airmap"}; }; -struct airmap::qt::DispatchingLogger::Private { +struct airmap::services::DispatchingLogger::Private { std::shared_ptr next; std::shared_ptr dispatcher; }; -airmap::qt::Logger::Logger() : d_{new Private{}} { +airmap::services::Logger::Logger() : d_{new Private{}} { } -airmap::qt::Logger::~Logger() { +airmap::services::Logger::~Logger() { } -QLoggingCategory& airmap::qt::Logger::logging_category() { +QLoggingCategory& airmap::services::Logger::logging_category() { static QLoggingCategory lc{"airmap"}; return lc; } -void airmap::qt::Logger::log(Severity severity, const char* message, const char*) { +void airmap::services::Logger::log(Severity severity, const char* message, const char*) { switch (severity) { case Severity::debug: qCDebug(logging_category(), "%s", message); @@ -37,7 +37,7 @@ void airmap::qt::Logger::log(Severity severity, const char* message, const char* } } -bool airmap::qt::Logger::should_log(Severity severity, const char*, const char*) { +bool airmap::services::Logger::should_log(Severity severity, const char*, const char*) { switch (severity) { case Severity::debug: return logging_category().isDebugEnabled(); @@ -52,14 +52,14 @@ bool airmap::qt::Logger::should_log(Severity severity, const char*, const char*) return true; } -airmap::qt::DispatchingLogger::DispatchingLogger(const std::shared_ptr& next) +airmap::services::DispatchingLogger::DispatchingLogger(const std::shared_ptr& next) : d_{new Private{next, Dispatcher::ToQt::create()}} { } -airmap::qt::DispatchingLogger::~DispatchingLogger() { +airmap::services::DispatchingLogger::~DispatchingLogger() { } -void airmap::qt::DispatchingLogger::log(Severity severity, const char* message, const char* component) { +void airmap::services::DispatchingLogger::log(Severity severity, const char* message, const char* component) { std::string cmessage{message}; std::string ccomponent{component}; auto cnext{d_->next}; @@ -70,7 +70,7 @@ void airmap::qt::DispatchingLogger::log(Severity severity, const char* message, }); } -bool airmap::qt::DispatchingLogger::should_log(Severity, const char*, const char*) { +bool airmap::services::DispatchingLogger::should_log(Severity, const char*, const char*) { // We have to accept all incoming log messages and postpone // the actual evaluation of should_log in the context of next until we // run on the correct thread. diff --git a/src/Airmap/services/logger.h b/src/Airmap/services/logger.h index 63ecaa5..8a27385 100644 --- a/src/Airmap/services/logger.h +++ b/src/Airmap/services/logger.h @@ -9,7 +9,7 @@ #include namespace airmap { -namespace qt { +namespace services { /// Logger is an airmap::Logger implementation that uses to /// Qt's logging facilities. diff --git a/src/Airmap/services/pilots.cpp b/src/Airmap/services/pilots.cpp index 904e9ac..b11047b 100644 --- a/src/Airmap/services/pilots.cpp +++ b/src/Airmap/services/pilots.cpp @@ -1,15 +1,15 @@ #include -std::shared_ptr airmap::qt::Pilots::create(const std::shared_ptr& dispatcher, +std::shared_ptr airmap::services::Pilots::create(const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new Pilots{dispatcher, client}}; } -airmap::qt::Pilots::Pilots(const std::shared_ptr& dispatcher, const std::shared_ptr& client) +airmap::services::Pilots::Pilots(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::Pilots::authenticated(const Authenticated::Parameters& parameters, const Authenticated::Callback& cb) { +void airmap::services::Pilots::authenticated(const Authenticated::Parameters& parameters, const Authenticated::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->pilots().authenticated(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -17,7 +17,7 @@ void airmap::qt::Pilots::authenticated(const Authenticated::Parameters& paramete }); } -void airmap::qt::Pilots::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) { +void airmap::services::Pilots::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->pilots().for_id(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -25,7 +25,7 @@ void airmap::qt::Pilots::for_id(const ForId::Parameters& parameters, const ForId }); } -void airmap::qt::Pilots::update_for_id(const UpdateForId::Parameters& parameters, const UpdateForId::Callback& cb) { +void airmap::services::Pilots::update_for_id(const UpdateForId::Parameters& parameters, const UpdateForId::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->pilots().update_for_id(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -33,7 +33,7 @@ void airmap::qt::Pilots::update_for_id(const UpdateForId::Parameters& parameters }); } -void airmap::qt::Pilots::start_verify_pilot_phone_for_id(const StartVerifyPilotPhoneForId::Parameters& parameters, +void airmap::services::Pilots::start_verify_pilot_phone_for_id(const StartVerifyPilotPhoneForId::Parameters& parameters, const StartVerifyPilotPhoneForId::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->pilots().start_verify_pilot_phone_for_id(parameters, [this, sp, cb](const auto& result) { @@ -42,7 +42,7 @@ void airmap::qt::Pilots::start_verify_pilot_phone_for_id(const StartVerifyPilotP }); } -void airmap::qt::Pilots::finish_verify_pilot_phone_for_id(const FinishVerifyPilotPhoneForId::Parameters& parameters, +void airmap::services::Pilots::finish_verify_pilot_phone_for_id(const FinishVerifyPilotPhoneForId::Parameters& parameters, const FinishVerifyPilotPhoneForId::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->pilots().finish_verify_pilot_phone_for_id(parameters, [this, sp, cb](const auto& result) { @@ -51,7 +51,7 @@ void airmap::qt::Pilots::finish_verify_pilot_phone_for_id(const FinishVerifyPilo }); } -void airmap::qt::Pilots::aircrafts(const Aircrafts::Parameters& parameters, const Aircrafts::Callback& cb) { +void airmap::services::Pilots::aircrafts(const Aircrafts::Parameters& parameters, const Aircrafts::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->pilots().aircrafts(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -59,7 +59,7 @@ void airmap::qt::Pilots::aircrafts(const Aircrafts::Parameters& parameters, cons }); } -void airmap::qt::Pilots::add_aircraft(const AddAircraft::Parameters& parameters, const AddAircraft::Callback& cb) { +void airmap::services::Pilots::add_aircraft(const AddAircraft::Parameters& parameters, const AddAircraft::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->pilots().add_aircraft(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -67,7 +67,7 @@ void airmap::qt::Pilots::add_aircraft(const AddAircraft::Parameters& parameters, }); } -void airmap::qt::Pilots::delete_aircraft(const DeleteAircraft::Parameters& parameters, +void airmap::services::Pilots::delete_aircraft(const DeleteAircraft::Parameters& parameters, const DeleteAircraft::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->pilots().delete_aircraft(parameters, [this, sp, cb](const auto& result) { @@ -76,7 +76,7 @@ void airmap::qt::Pilots::delete_aircraft(const DeleteAircraft::Parameters& param }); } -void airmap::qt::Pilots::update_aircraft(const UpdateAircraft::Parameters& parameters, +void airmap::services::Pilots::update_aircraft(const UpdateAircraft::Parameters& parameters, const UpdateAircraft::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->pilots().update_aircraft(parameters, [this, sp, cb](const auto& result) { diff --git a/src/Airmap/services/pilots.h b/src/Airmap/services/pilots.h index 5067f99..1380409 100644 --- a/src/Airmap/services/pilots.h +++ b/src/Airmap/services/pilots.h @@ -9,7 +9,7 @@ #include namespace airmap { -namespace qt { +namespace services { class Pilots : public airmap::Pilots, public std::enable_shared_from_this { public: diff --git a/src/Airmap/services/rulesets.cpp b/src/Airmap/services/rulesets.cpp index 16a4ed5..77ea647 100644 --- a/src/Airmap/services/rulesets.cpp +++ b/src/Airmap/services/rulesets.cpp @@ -1,16 +1,16 @@ #include -std::shared_ptr airmap::qt::RuleSets::create(const std::shared_ptr& dispatcher, +std::shared_ptr airmap::services::RuleSets::create(const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new RuleSets{dispatcher, client}}; } -airmap::qt::RuleSets::RuleSets(const std::shared_ptr& dispatcher, +airmap::services::RuleSets::RuleSets(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::RuleSets::search(const Search::Parameters& parameters, const Search::Callback& cb) { +void airmap::services::RuleSets::search(const Search::Parameters& parameters, const Search::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->rulesets().search(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -18,7 +18,7 @@ void airmap::qt::RuleSets::search(const Search::Parameters& parameters, const Se }); } -void airmap::qt::RuleSets::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) { +void airmap::services::RuleSets::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->rulesets().for_id(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -26,7 +26,7 @@ void airmap::qt::RuleSets::for_id(const ForId::Parameters& parameters, const For }); } -void airmap::qt::RuleSets::fetch_rules(const FetchRules::Parameters& parameters, const FetchRules::Callback& cb) { +void airmap::services::RuleSets::fetch_rules(const FetchRules::Parameters& parameters, const FetchRules::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->rulesets().fetch_rules(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -34,7 +34,7 @@ void airmap::qt::RuleSets::fetch_rules(const FetchRules::Parameters& parameters, }); } -void airmap::qt::RuleSets::evaluate_rulesets(const EvaluateRules::Parameters& parameters, +void airmap::services::RuleSets::evaluate_rulesets(const EvaluateRules::Parameters& parameters, const EvaluateRules::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->rulesets().evaluate_rulesets(parameters, [this, sp, cb](const auto& result) { @@ -43,7 +43,7 @@ void airmap::qt::RuleSets::evaluate_rulesets(const EvaluateRules::Parameters& pa }); } -void airmap::qt::RuleSets::evaluate_flight_plan(const EvaluateFlightPlan::Parameters& parameters, +void airmap::services::RuleSets::evaluate_flight_plan(const EvaluateFlightPlan::Parameters& parameters, const EvaluateFlightPlan::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->rulesets().evaluate_flight_plan(parameters, [this, sp, cb](const auto& result) { diff --git a/src/Airmap/services/rulesets.h b/src/Airmap/services/rulesets.h index 8d098d2..157d370 100644 --- a/src/Airmap/services/rulesets.h +++ b/src/Airmap/services/rulesets.h @@ -6,7 +6,7 @@ #include namespace airmap { -namespace qt { +namespace services { class RuleSets : public airmap::RuleSets, public std::enable_shared_from_this { public: diff --git a/src/Airmap/services/status.cpp b/src/Airmap/services/status.cpp index cda0587..8a89902 100644 --- a/src/Airmap/services/status.cpp +++ b/src/Airmap/services/status.cpp @@ -1,15 +1,15 @@ #include -std::shared_ptr airmap::qt::Status::create(const std::shared_ptr& dispatcher, +std::shared_ptr airmap::services::Status::create(const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new Status{dispatcher, client}}; } -airmap::qt::Status::Status(const std::shared_ptr& dispatcher, const std::shared_ptr& client) +airmap::services::Status::Status(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::Status::get_status_by_point(const GetStatus::Parameters& parameters, const GetStatus::Callback& cb) { +void airmap::services::Status::get_status_by_point(const GetStatus::Parameters& parameters, const GetStatus::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->status().get_status_by_point(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -17,7 +17,7 @@ void airmap::qt::Status::get_status_by_point(const GetStatus::Parameters& parame }); } -void airmap::qt::Status::get_status_by_path(const GetStatus::Parameters& parameters, const GetStatus::Callback& cb) { +void airmap::services::Status::get_status_by_path(const GetStatus::Parameters& parameters, const GetStatus::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->status().get_status_by_path(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); @@ -25,7 +25,7 @@ void airmap::qt::Status::get_status_by_path(const GetStatus::Parameters& paramet }); } -void airmap::qt::Status::get_status_by_polygon(const GetStatus::Parameters& parameters, const GetStatus::Callback& cb) { +void airmap::services::Status::get_status_by_polygon(const GetStatus::Parameters& parameters, const GetStatus::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->status().get_status_by_polygon(parameters, [this, sp, cb](const auto& result) { sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); }); diff --git a/src/Airmap/services/status.h b/src/Airmap/services/status.h index b0393e4..431c4c3 100644 --- a/src/Airmap/services/status.h +++ b/src/Airmap/services/status.h @@ -8,7 +8,7 @@ #include namespace airmap { -namespace qt { +namespace services { class Status : public airmap::Status, public std::enable_shared_from_this { public: diff --git a/src/Airmap/services/telemetry.cpp b/src/Airmap/services/telemetry.cpp index ffb3eb1..aded0bb 100644 --- a/src/Airmap/services/telemetry.cpp +++ b/src/Airmap/services/telemetry.cpp @@ -2,17 +2,17 @@ #include -std::shared_ptr airmap::qt::Telemetry::create(const std::shared_ptr& dispatcher, +std::shared_ptr airmap::services::Telemetry::create(const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new Telemetry{dispatcher, client}}; } -airmap::qt::Telemetry::Telemetry(const std::shared_ptr& dispatcher, +airmap::services::Telemetry::Telemetry(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::Telemetry::submit_updates(const Flight& flight, const std::string& key, +void airmap::services::Telemetry::submit_updates(const Flight& flight, const std::string& key, const std::initializer_list& updates) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), flight, key, updates]() { sp->client_->telemetry().submit_updates(flight, key, updates); diff --git a/src/Airmap/services/telemetry.h b/src/Airmap/services/telemetry.h index acb5ea8..ddb4f10 100644 --- a/src/Airmap/services/telemetry.h +++ b/src/Airmap/services/telemetry.h @@ -8,7 +8,7 @@ #include namespace airmap { -namespace qt { +namespace services { class Telemetry : public airmap::Telemetry, public std::enable_shared_from_this { public: diff --git a/src/Airmap/services/traffic.cpp b/src/Airmap/services/traffic.cpp index ab60954..d3d9a60 100644 --- a/src/Airmap/services/traffic.cpp +++ b/src/Airmap/services/traffic.cpp @@ -1,42 +1,42 @@ #include -std::shared_ptr airmap::qt::Traffic::Monitor::create( +std::shared_ptr airmap::services::Traffic::Monitor::create( const std::shared_ptr& dispatcher, const std::shared_ptr& native) { return std::shared_ptr{new Monitor{dispatcher, native}}; } -airmap::qt::Traffic::Monitor::Monitor(const std::shared_ptr& dispatcher, +airmap::services::Traffic::Monitor::Monitor(const std::shared_ptr& dispatcher, const std::shared_ptr& native) : dispatcher_{dispatcher}, native_{native} { } -void airmap::qt::Traffic::Monitor::subscribe(const std::shared_ptr& subscriber) { +void airmap::services::Traffic::Monitor::subscribe(const std::shared_ptr& subscriber) { dispatcher_->dispatch_to_qt([this, sp = shared_from_this(), subscriber] { sp->subscribers_.insert(subscriber); }); } -void airmap::qt::Traffic::Monitor::unsubscribe( +void airmap::services::Traffic::Monitor::unsubscribe( const std::shared_ptr& subscriber) { dispatcher_->dispatch_to_qt([this, sp = shared_from_this(), subscriber] { sp->subscribers_.erase(subscriber); }); } -void airmap::qt::Traffic::Monitor::handle_update(Update::Type type, const std::vector& update) { +void airmap::services::Traffic::Monitor::handle_update(Update::Type type, const std::vector& update) { dispatcher_->dispatch_to_qt([this, sp = shared_from_this(), type, update]() { for (const auto& subscriber : sp->subscribers_) subscriber->handle_update(type, update); }); } -std::shared_ptr airmap::qt::Traffic::create(const std::shared_ptr& dispatcher, +std::shared_ptr airmap::services::Traffic::create(const std::shared_ptr& dispatcher, const std::shared_ptr& client) { return std::shared_ptr{new Traffic{dispatcher, client}}; } -airmap::qt::Traffic::Traffic(const std::shared_ptr& dispatcher, +airmap::services::Traffic::Traffic(const std::shared_ptr& dispatcher, const std::shared_ptr& client) : dispatcher_{dispatcher}, client_{client} { } -void airmap::qt::Traffic::monitor(const Monitor::Params& parameters, const Monitor::Callback& cb) { +void airmap::services::Traffic::monitor(const Monitor::Params& parameters, const Monitor::Callback& cb) { dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() { sp->client_->traffic().monitor(parameters, [this, sp, parameters, cb](const auto& result) { if (result) { diff --git a/src/Airmap/services/traffic.h b/src/Airmap/services/traffic.h index ca9f915..a3cd156 100644 --- a/src/Airmap/services/traffic.h +++ b/src/Airmap/services/traffic.h @@ -9,7 +9,7 @@ #include namespace airmap { -namespace qt { +namespace services { class Traffic : public airmap::Traffic, public std::enable_shared_from_this { public: diff --git a/src/Airmap/services/types.cpp b/src/Airmap/services/types.cpp index 14721ba..102e75b 100644 --- a/src/Airmap/services/types.cpp +++ b/src/Airmap/services/types.cpp @@ -16,7 +16,7 @@ inline void register_type_once() { } // namespace -void airmap::qt::register_types() { +void airmap::services::register_types() { register_type_once("Aircraft"); register_type_once("Airspace"); register_type_once("Credentials"); diff --git a/src/Airmap/services/types.h b/src/Airmap/services/types.h index 5fb3aef..97e76c7 100644 --- a/src/Airmap/services/types.h +++ b/src/Airmap/services/types.h @@ -53,7 +53,7 @@ Q_DECLARE_METATYPE(airmap::Traffic::Update) Q_DECLARE_METATYPE(airmap::Version) namespace airmap { -namespace qt { +namespace services { /// register_types makes airmap::* types known to the Qt type system. ///