Skip to content

Commit

Permalink
GCS_Common: add support for sending COMPONENT_INFORMATION
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Jun 17, 2022
1 parent fee3ac5 commit 476d252
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libraries/GCS_MAVLink/GCS.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ class GCS_MAVLINK
void send_uavionix_adsb_out_status() const;
void send_autopilot_state_for_gimbal_device() const;

void send_component_information() const;

// lock a channel, preventing use by MAVLink
void lock(bool _lock) {
_locked = _lock;
Expand Down
19 changes: 19 additions & 0 deletions libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ ap_message GCS_MAVLINK::mavlink_id_to_ap_message_id(const uint32_t mavlink_id) c
{ MAVLINK_MSG_ID_AIS_VESSEL, MSG_AIS_VESSEL},
{ MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_STATUS, MSG_UAVIONIX_ADSB_OUT_STATUS},
{ MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE, MSG_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE},
{ MAVLINK_MSG_ID_COMPONENT_INFORMATION, MSG_COMPONENT_INFORMATION},
};

for (uint8_t i=0; i<ARRAY_SIZE(map); i++) {
Expand Down Expand Up @@ -5216,6 +5217,20 @@ void GCS_MAVLINK::send_received_message_deprecation_warning(const char * message
last_deprecation_message = message;

send_text(MAV_SEVERITY_WARNING, "Received message (%s) is deprecated", message);

void GCS_MAVLINK::send_component_information() const
{
const char *general_metadata_url = "mftp:/@SYS/general_metadata.json";
const uint32_t general_metadata_checksum = 133761337;

mavlink_msg_component_information_send(
chan,
AP_HAL::millis(),
general_metadata_checksum,
general_metadata_url,
0, // -1?
""
);
}

bool GCS_MAVLINK::try_send_message(const enum ap_message id)
Expand Down Expand Up @@ -5541,6 +5556,10 @@ bool GCS_MAVLINK::try_send_message(const enum ap_message id)
#endif // HAL_HIGH_LATENCY2_ENABLED
break;

case MSG_COMPONENT_INFORMATION:
CHECK_PAYLOAD_SIZE(COMPONENT_INFORMATION);
send_component_information();
break;

case MSG_UAVIONIX_ADSB_OUT_STATUS:
CHECK_PAYLOAD_SIZE(UAVIONIX_ADSB_OUT_STATUS);
Expand Down
1 change: 1 addition & 0 deletions libraries/GCS_MAVLink/ap_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,6 @@ enum ap_message : uint8_t {
MSG_UAVIONIX_ADSB_OUT_STATUS,
MSG_ATTITUDE_TARGET,
MSG_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE,
MSG_COMPONENT_INFORMATION,
MSG_LAST // MSG_LAST must be the last entry in this enum
};

0 comments on commit 476d252

Please sign in to comment.