/** * Sends / receives data to / from one UAVCommander via TMS-IF * $Id$ * $HeadURL$ * $Author$ * Created by Mike Wille, ESZS, 2025-04-17 */ #pragma once #include #include #include #include #include namespace UAS { namespace CoordinateFrame { namespace ReportPositions { struct Message { double lat; double lon; double alt; int64_t timestamp; }; using CallbackFn = std::function; } } namespace TeleOperation { /// Enumeration of states of a the radio link. enum Type { /// The connection is in a undefined state. Undefined, /// The link is currently disconnected. Disconnected, /// The link is currently connecting. Connecting, /// The link is currently disconnecting Diconnecting, /// The link is currently connected. Connected, /// The link is currently in error state. Error }; namespace RadioLinkConnectionState { struct Message { Type status; }; using CallbackFn = std::function; } } namespace BuiltInTest { /// Enumeration of states of a the radio link. namespace TestResult { /// Test result type enumeration. enum Type { /// Unknown -- test has not yet been completed or could not be initiated. Undefined, /// OK -- no failure was detected. OK, /// Warning -- a situation which warrants a warning was detected. Warning, /// Reduced performance -- an error was detected which results in reduced performance. Reduced_Performance_Error, /// Fatal error -- a failure was detected which results in complete loss of functionality. Fatal_Error }; } namespace ReportCBitStatus { struct Message { std::string Key; std::string RoutineName; BuiltInTest::TestResult::Type Result; unsigned long ErrorCode; std::string ErrorCodeDescription; }; using CallbackFn = std::function; } } namespace Device { /// Enumeration of states of a the radio link. namespace OperationModeStateKind { /// Operation mode state enumeration. enum Type { /// Unknown mode state. Undefined, /// Off. Off, /// On. On, /// Standby. Standby, /// Initialising. Init, /// Shutting down. Shutdown, /// Normal operation. Normal, /// Manual operation. Manual, /// Automatic operation. Auto, /// Calibrating. Calibrating, /// Maintenance. Maintenance }; } namespace ReportDeviceStatus { struct Message { OperationModeStateKind::Type Status; }; using CallbackFn = std::function; } } namespace ObjectManager { namespace ReportPoint { struct Message { int uasId; bool isRemoved; }; } } namespace MissionCtrl { enum Task // see tmsif/type/MissionCtrl.hpp:43 { Undefined, // 0 Connect, // 1 Disconnect, // 2 Arm, // 3 Disarm, // 4 Fire, Observe, // 6 /// Let vehicle ascend. Climb, /// Let vehicle descend. Descend, /// Perform vehicle takeoff. Takeoff, // 9 /// Perform vehicle landing. Land, // 10 Reboot, // 11 Shutdown, // 12 /// Loiter around a specified position. Loiter, // 13 /// Return to a specified position. Return, // 14 /// Follow a specified entity. Follow, // 15 /// Stop current motion/action. Stop, /// Resume the stopped motion/action. Resume }; namespace ReportMissionStatus { struct Message { std::string currentMissionName; Task currentTask; std::vector currentlyAllowedTasks; std::string missionEnded; }; using CallbackFn = std::function; } } class UAVCommander { public: virtual ~UAVCommander() = default; bool isReady() const { return m_isReady; } virtual void startIA(const std::string &ip, const uint16_t port, const bool useTcp) noexcept(false) = 0; virtual void sendMission(double lat, double lon, double alt = 0, const QString &missionName = {}) noexcept(false) = 0; virtual void returnToHome() = 0; virtual void sendTryReclaimAutoMode() = 0; virtual void set_CoordinateFrame_ReportPosition_Callback(CoordinateFrame::ReportPositions::CallbackFn callbackFn) = 0; virtual void set_isReady_Callback(std::function callbackFn) = 0; virtual void set_ReportCBitStatus_Callback(BuiltInTest::ReportCBitStatus::CallbackFn callbackFn) = 0; virtual void set_ReportDeviceStatusType_Callback(Device::ReportDeviceStatus::CallbackFn callbackFn) = 0; virtual void set_ReportRadioLinkConnectionState_Callback(TeleOperation::RadioLinkConnectionState::CallbackFn callbackFn) = 0; virtual void set_ReportMissionStatus_Callback(MissionCtrl::ReportMissionStatus::CallbackFn callbackFn) = 0; protected: bool m_isReady { false }; }; } // namespace UAS