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 Aug 7, 2024
1 parent 9f5f109 commit 0b8cde5
Show file tree
Hide file tree
Showing 3 changed files with 24 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 @@ -402,6 +402,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
21 changes: 21 additions & 0 deletions libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,7 @@ ap_message GCS_MAVLINK::mavlink_id_to_ap_message_id(const uint32_t mavlink_id) c
#if AP_MAVLINK_MSG_RELAY_STATUS_ENABLED
{ MAVLINK_MSG_ID_RELAY_STATUS, MSG_RELAY_STATUS},
#endif
{ MAVLINK_MSG_ID_COMPONENT_INFORMATION, MSG_COMPONENT_INFORMATION},
};

for (uint8_t i=0; i<ARRAY_SIZE(map); i++) {
Expand Down Expand Up @@ -5983,6 +5984,21 @@ void GCS_MAVLINK::send_received_message_deprecation_warning(const char * message
send_text(MAV_SEVERITY_INFO, "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)
{
bool ret = true;
Expand Down Expand Up @@ -6383,6 +6399,11 @@ bool GCS_MAVLINK::try_send_message(const enum ap_message id)
}
#endif

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

#if AP_MAVLINK_MSG_UAVIONIX_ADSB_OUT_STATUS_ENABLED
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 @@ -97,5 +97,6 @@ enum ap_message : uint8_t {
#if AP_MAVLINK_MSG_HIGHRES_IMU_ENABLED
MSG_HIGHRES_IMU,
#endif
MSG_COMPONENT_INFORMATION,
MSG_LAST // MSG_LAST must be the last entry in this enum
};

0 comments on commit 0b8cde5

Please sign in to comment.