From da7ed73051a3cf08ffb68cbb4e26e1a7d50be247 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 7 Nov 2016 11:03:11 +1100 Subject: [PATCH] GCS_MAVLlink: added handle_common_message() this will make it easier to add common functions for mavlink messages without having to do a commit for each vehicle --- libraries/GCS_MAVLink/GCS.h | 3 ++- libraries/GCS_MAVLink/GCS_Common.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index 913da5b010..d40e42cde7 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -272,11 +272,12 @@ protected: void handle_gps_inject(const mavlink_message_t *msg, AP_GPS &gps); + void handle_common_message(mavlink_message_t *msg); void handle_log_message(mavlink_message_t *msg, DataFlash_Class &dataflash); void handle_setup_signing(const mavlink_message_t *msg); uint8_t handle_preflight_reboot(const mavlink_command_long_t &packet, bool disable_overrides); uint8_t handle_rc_bind(const mavlink_command_long_t &packet); - + private: float adjust_rate_for_stream_trigger(enum streams stream_num); diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 0f0a184943..63ebf66a7e 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -1803,3 +1803,18 @@ uint8_t GCS_MAVLINK::handle_rc_bind(const mavlink_command_long_t &packet) } return MAV_RESULT_ACCEPTED; } + +/* + handle messages which don't require vehicle specific data + */ +void GCS_MAVLINK::handle_common_message(mavlink_message_t *msg) +{ + switch (msg->msgid) { + case MAVLINK_MSG_ID_SETUP_SIGNING: + handle_setup_signing(msg); + break; + case MAVLINK_MSG_ID_PARAM_REQUEST_READ: + handle_param_request_read(msg); + break; + } +}