MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / handle_command_long

Method handle_command_long

libraries/GCS_MAVLink/GCS_Common.cpp:5170–5202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5168}
5169
5170void GCS_MAVLINK::handle_command_long(const mavlink_message_t &msg)
5171{
5172 // decode packet
5173 mavlink_command_long_t packet;
5174 mavlink_msg_command_long_decode(&msg, &packet);
5175
5176#if AP_SCRIPTING_ENABLED
5177 AP_Scripting *scripting = AP_Scripting::get_singleton();
5178 if (scripting != nullptr && scripting->is_handling_command(packet.command)) {
5179 // Scripting has registered to receive this command, do not procces it internaly
5180 return;
5181 }
5182#endif
5183
5184 hal.util->persistent_data.last_mavlink_cmd = packet.command;
5185
5186 const MAV_RESULT result = try_command_long_as_command_int(packet, msg);
5187
5188 // send ACK or NAK
5189 mavlink_msg_command_ack_send(chan, packet.command, result,
5190 0, 0,
5191 msg.sysid,
5192 msg.compid);
5193
5194#if HAL_LOGGING_ENABLED
5195 // log the packet:
5196 mavlink_command_int_t packet_int;
5197 convert_COMMAND_LONG_to_COMMAND_INT(packet, packet_int);
5198 AP::logger().Write_Command(packet_int, msg.sysid, msg.compid, result, true);
5199#endif
5200
5201 hal.util->persistent_data.last_mavlink_cmd = 0;
5202}
5203
5204#else
5205void GCS_MAVLINK::handle_command_long(const mavlink_message_t &msg)

Callers

nothing calls this directly

Calls 3

get_singletonFunction · 0.85
is_handling_commandMethod · 0.80
Write_CommandMethod · 0.80

Tested by

no test coverage detected