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 Sep 22, 2021
1 parent c45bdab commit 0f12834
Show file tree
Hide file tree
Showing 3 changed files with 23 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 @@ -279,6 +279,8 @@ class GCS_MAVLINK
void send_high_latency() const;
#endif // HAL_HIGH_LATENCY2_ENABLED

void send_component_information() const;

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

for (uint8_t i=0; i<ARRAY_SIZE(map); i++) {
Expand Down Expand Up @@ -4857,6 +4858,21 @@ void GCS_MAVLINK::send_water_depth() const
#endif
}

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 @@ -5176,6 +5192,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;

default:
// try_send_message must always at some stage return true for
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 @@ -80,5 +80,6 @@ enum ap_message : uint8_t {
MSG_HIGH_LATENCY2,
MSG_AIS_VESSEL,
MSG_MCU_STATUS,
MSG_COMPONENT_INFORMATION,
MSG_LAST // MSG_LAST must be the last entry in this enum
};

0 comments on commit 0f12834

Please sign in to comment.