Line data Source code
1 : #pragma once 2 : 3 : #include "AP_Frsky_MAVlite.h" 4 : #include "AP_Frsky_Telem.h" 5 : #include "AP_Frsky_MAVlite_Message.h" 6 : 7 : #if HAL_WITH_FRSKY_TELEM_BIDIRECTIONAL 8 : 9 : class AP_Frsky_MAVliteMsgHandler { 10 : public: 11 : 12 : FUNCTOR_TYPEDEF(send_mavlite_fn_t, bool, const AP_Frsky_MAVlite_Message &); 13 3 : AP_Frsky_MAVliteMsgHandler(send_mavlite_fn_t send_fn) : 14 3 : _send_fn(send_fn) {} 15 : 16 : void process_message(const AP_Frsky_MAVlite_Message &rxmsg); 17 : 18 : private: 19 : // mavlite messages tx/rx methods 20 : bool send_message(AP_Frsky_MAVlite_Message &txmsg); 21 : 22 : // gcs mavlite methods 23 : void handle_param_request_read(const AP_Frsky_MAVlite_Message &rxmsg); 24 : void handle_param_set(const AP_Frsky_MAVlite_Message &rxmsg); 25 : 26 : void handle_command_long(const AP_Frsky_MAVlite_Message &rxmsg); 27 : 28 : MAV_RESULT handle_command(const mavlink_command_long_t &mav_command_long); 29 : MAV_RESULT handle_command_preflight_calibration_baro(const mavlink_command_long_t &mav_command_long); 30 : MAV_RESULT handle_command_do_set_mode(const mavlink_command_long_t &mav_command_long); 31 : MAV_RESULT handle_command_do_fence_enable(const mavlink_command_long_t &mav_command_long); 32 : MAV_RESULT handle_command_preflight_reboot(const mavlink_command_long_t &mav_command_long); 33 : 34 : void send_command_ack(const MAV_RESULT mav_result, const uint16_t cmdid); 35 : 36 : send_mavlite_fn_t _send_fn; 37 : }; 38 : 39 : #endif