You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
2.2 KiB
46 lines
2.2 KiB
// 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 <Airmap/qt/status.h> |
|
|
|
std::shared_ptr<airmap::qt::Status> airmap::qt::Status::create(const std::shared_ptr<Dispatcher>& dispatcher, |
|
const std::shared_ptr<airmap::Client>& client) { |
|
return std::shared_ptr<Status>{new Status{dispatcher, client}}; |
|
} |
|
|
|
airmap::qt::Status::Status(const std::shared_ptr<Dispatcher>& dispatcher, const std::shared_ptr<airmap::Client>& 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); }); |
|
}); |
|
}); |
|
}
|
|
|