diff --git a/src/comm/MockLink.cc b/src/comm/MockLink.cc index a0aa47def888de3bf12f895618230d7862187c49..ad45267cce97ab3d212f209bb235ef0be2610f05 100644 --- a/src/comm/MockLink.cc +++ b/src/comm/MockLink.cc @@ -803,6 +803,10 @@ void MockLink::_handleCommandLong(const mavlink_message_t& msg) case MAV_CMD_PREFLIGHT_STORAGE: commandResult = MAV_RESULT_ACCEPTED; break; + case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES: + commandResult = MAV_RESULT_ACCEPTED; + _respondWithAutopilotVersion(); + break; } mavlink_message_t commandAck; @@ -814,6 +818,31 @@ void MockLink::_handleCommandLong(const mavlink_message_t& msg) respondWithMavlinkMessage(commandAck); } +void MockLink::_respondWithAutopilotVersion(void) +{ + mavlink_message_t msg; + + uint8_t customVersion[8]; + memset(customVersion, 0, sizeof(customVersion)); + + // Only flight_sw_version is supported a this point + mavlink_msg_autopilot_version_pack(_vehicleSystemId, + _vehicleComponentId, + &msg, + 0, // capabilities, + (1 << (8*3)) | FIRMWARE_VERSION_TYPE_DEV, // flight_sw_version, + 0, // middleware_sw_version, + 0, // os_sw_version, + 0, // board_version, + (uint8_t *)&customVersion, // flight_custom_version, + (uint8_t *)&customVersion, // middleware_custom_version, + (uint8_t *)&customVersion, // os_custom_version, + 0, // vendor_id, + 0, // product_id, + 0); // uid + respondWithMavlinkMessage(msg); +} + void MockLink::setMissionItemFailureMode(MockLinkMissionItemHandler::FailureMode_t failureMode) { _missionItemHandler.setMissionItemFailureMode(failureMode); diff --git a/src/comm/MockLink.h b/src/comm/MockLink.h index 395907e8e660915c27ebe3fdffc1fc84c29b71e7..917dece5c8a4cf888793586c77b3e6caa038b0af 100644 --- a/src/comm/MockLink.h +++ b/src/comm/MockLink.h @@ -185,6 +185,7 @@ private: void _sendGpsRawInt(void); void _sendVibration(void); void _sendStatusTextMessages(void); + void _respondWithAutopilotVersion(void); static MockLink* _startMockLink(MockConfiguration* mockConfig);