Skip to content

Commit 3cdde17

Browse files
author
Aashay Shah
committed
Handle rx with mavlink structs
1 parent 75cac10 commit 3cdde17

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

libraries/AP_ODIDScanner/AP_ODIDScanner.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ void AP_ODIDScanner::handle_msg(mavlink_message_t msg) {
7878
last_dev_hb_ms = now_ms;
7979
break;
8080
}
81+
case MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION:
82+
{
83+
mavlink_open_drone_id_location_t loc;
84+
mavlink_msg_open_drone_id_location_decode(&msg, &loc);
85+
// Handle the location message.
86+
break;
87+
}
8188
}
8289
}
8390
void AP_ODIDScanner::update() {
@@ -100,3 +107,6 @@ void AP_ODIDScanner::update() {
100107
}
101108
}
102109

110+
bool AP_ODIDScanner::message_from_rx(mavlink_channel_t& chan) {
111+
return chan == _chan;
112+
}

libraries/AP_ODIDScanner/AP_ODIDScanner.h

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class AP_ODIDScanner
2525
void handle_msg(mavlink_message_t);
2626
// mavlink_channel_t _chan; // mavlink channel that communicates with the remote id transceiver
2727
uint8_t _mav_port;
28+
bool message_from_rx(mavlink_channel_t& chan);
29+
2830
mavlink_uav_found_t found_msg;
2931
mavlink_channel_t _chan;
3032
AP_HAL::UARTDriver* _port;

libraries/GCS_MAVLink/GCS_Common.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -4168,7 +4168,12 @@ void GCS_MAVLINK::handle_common_message(const mavlink_message_t &msg)
41684168
case MAVLINK_MSG_ID_OPEN_DRONE_ID_BASIC_ID:
41694169
case MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM:
41704170
case MAVLINK_MSG_ID_OPEN_DRONE_ID_SYSTEM_UPDATE:
4171-
AP::opendroneid().handle_msg(chan, msg);
4171+
if(AP::vehicle()->odidscanner.message_from_rx(chan)) {
4172+
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Detected msg from odid-rx");
4173+
AP::vehicle()->odidscanner.handle_msg(msg);
4174+
} else {
4175+
AP::opendroneid().handle_msg(chan, msg);
4176+
}
41724177
break;
41734178
#endif
41744179
case MAVLINK_MSG_ID_UAV_FOUND:

0 commit comments

Comments
 (0)