164 lines
2.5 KiB
C++
Executable File
164 lines
2.5 KiB
C++
Executable File
// std
|
|
#include <iostream>
|
|
#include <chrono>
|
|
#include <thread>
|
|
|
|
// tmsif
|
|
#include <tmsif/api/MissionCtrl.hpp>
|
|
|
|
// ddkit
|
|
#include <ddkit/actors/Session.hpp>
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
std::cout << "App started ..." << std::endl;
|
|
|
|
const int domain = 4; // TMS-IF MAVLink Adapter runs on domain 4
|
|
ddkit::actors::Session session(domain);
|
|
|
|
// starting Service
|
|
const std::string serviceName = "UAV_MissionCtrl1";
|
|
|
|
auto client = M_MissionCtrl::Client::createWriteOnly(session, serviceName);
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
|
|
|
client->CmdPerformAction(M_MissionCtrl::CommandedActionType(M_MissionCtrl::TaskType({M_MissionCtrl::TaskCategoryKind::Type::Arm}, {}, {}, {}), {}));
|
|
|
|
// std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
|
|
|
client->CmdPerformAction(M_MissionCtrl::CommandedActionType(M_MissionCtrl::TaskType({M_MissionCtrl::TaskCategoryKind::Type::Arm}, {}, {}, {}), {}));
|
|
|
|
|
|
while(true) // keep app running
|
|
{
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // std
|
|
// #include <iostream>
|
|
// #include <chrono>
|
|
// #include <thread>
|
|
|
|
// // tmsif
|
|
// #include <tmsif/api/MissionCtrl.hpp>
|
|
|
|
// // ddkit
|
|
// #include <ddkit/actors/Session.hpp>
|
|
|
|
|
|
// // class DeviceClient : public M_MissionCtrl::IClient
|
|
// // {
|
|
// // public:
|
|
// // void ReportDeviceStatus(M_MissionCtrl::DeviceStatusType const& Status, bool IsRemoved) override
|
|
// // {
|
|
// // fprintf(stdout, "ReportDeviceStatus: Status.OperationStatus.Mode set? %d\n", !(int)Status.OperationStatus.Mode.empty());
|
|
// // }
|
|
// // };
|
|
|
|
|
|
// int main(int argc, char *argv[])
|
|
// {
|
|
// std::cout << "App started ..." << std::endl;
|
|
|
|
// const int domain = 4; // TMS-IF MAVLink Adapter runs on domain 4
|
|
// ddkit::actors::Session session(domain);
|
|
|
|
// // starting Service
|
|
// const std::string serviceName = "UAV_Device1";
|
|
|
|
// M_MissionCtrl::IService callbacksFromClients;
|
|
// auto service = M_MissionCtrl::Service::create(session, serviceName, callbacksFromClients);
|
|
|
|
// // messages
|
|
// // auto msg = M_MissionCtrl::AlarmLogType(M_Alert::AlarmStatusKind::Active, false, false,
|
|
// // false, {}, M_Alert::AlarmCategoryKind::Type::Warning, M_Common::TimeType(4000, 0), {});
|
|
|
|
// uint64_t i = 1;
|
|
// while(true)
|
|
// {
|
|
// std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
|
|
|
// // send data cyclic for example
|
|
// service. // ReportAlarmLog("test123", msg, false);
|
|
// }
|
|
|
|
// return 0;
|
|
// }
|