// AirMap Platform SDK // Copyright © 2018 AirMap, Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an AS IS BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include std::shared_ptr airmap::qt::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) : dispatcher_{dispatcher}, client_{client} { } void airmap::qt::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); }); }); }); } void airmap::qt::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); }); }); }); } void airmap::qt::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); }); }); }); }