diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/mavlink/mavlink_receiver.cpp | 15 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_receiver.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index e3f274b8b..1f91654da 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -157,6 +157,10 @@ MavlinkReceiver::handle_message(mavlink_message_t *msg) handle_message_optical_flow_rad(msg); break; + case MAVLINK_MSG_ID_PING: + handle_message_ping(msg); + break; + case MAVLINK_MSG_ID_SET_MODE: handle_message_set_mode(msg); break; @@ -947,6 +951,17 @@ MavlinkReceiver::handle_message_heartbeat(mavlink_message_t *msg) } void +MavlinkReceiver::handle_message_ping(mavlink_message_t *msg) +{ + mavlink_ping_t ping; + mavlink_msg_ping_decode( msg, &ping); + if (mavlink_system.sysid == ping.target_system && + mavlink_system.compid == ping.target_component) { + _mavlink->send_message(MAVLINK_MSG_ID_PING, &msg); + } +} + +void MavlinkReceiver::handle_message_request_data_stream(mavlink_message_t *msg) { mavlink_request_data_stream_t req; diff --git a/src/modules/mavlink/mavlink_receiver.h b/src/modules/mavlink/mavlink_receiver.h index 1d214b948..ffacb59a6 100644 --- a/src/modules/mavlink/mavlink_receiver.h +++ b/src/modules/mavlink/mavlink_receiver.h @@ -127,6 +127,7 @@ private: void handle_message_radio_status(mavlink_message_t *msg); void handle_message_manual_control(mavlink_message_t *msg); void handle_message_heartbeat(mavlink_message_t *msg); + void handle_message_ping(mavlink_message_t *msg); void handle_message_request_data_stream(mavlink_message_t *msg); void handle_message_system_time(mavlink_message_t *msg); void handle_message_timesync(mavlink_message_t *msg); |