mavlink: use reference instead of pointer to access the MAVLink instance from protocol classes

This commit is contained in:
Matthias Grob
2024-06-03 11:26:43 +02:00
parent 9a7a977625
commit 68769ea0ec
16 changed files with 156 additions and 166 deletions
+8 -12
View File
@@ -45,17 +45,13 @@
#include "mavlink_ftp.h" #include "mavlink_ftp.h"
#include "mavlink_tests/mavlink_ftp_test.h" #include "mavlink_tests/mavlink_ftp_test.h"
#ifndef MAVLINK_FTP_UNIT_TEST
#include "mavlink_main.h" #include "mavlink_main.h"
#else
#include <mavlink.h>
#endif
using namespace time_literals; using namespace time_literals;
constexpr const char MavlinkFTP::_root_dir[]; constexpr const char MavlinkFTP::_root_dir[];
MavlinkFTP::MavlinkFTP(Mavlink *mavlink) : MavlinkFTP::MavlinkFTP(Mavlink &mavlink) :
_mavlink(mavlink) _mavlink(mavlink)
{ {
// initialize session // initialize session
@@ -96,7 +92,7 @@ MavlinkFTP::_getServerSystemId()
return MavlinkFtpTest::serverSystemId; return MavlinkFtpTest::serverSystemId;
#else #else
// Not unit testing, use the real thing // Not unit testing, use the real thing
return _mavlink->get_system_id(); return _mavlink.get_system_id();
#endif #endif
} }
@@ -108,7 +104,7 @@ MavlinkFTP::_getServerComponentId()
return MavlinkFtpTest::serverComponentId; return MavlinkFtpTest::serverComponentId;
#else #else
// Not unit testing, use the real thing // Not unit testing, use the real thing
return _mavlink->get_component_id(); return _mavlink.get_component_id();
#endif #endif
} }
@@ -120,7 +116,7 @@ MavlinkFTP::_getServerChannel()
return MavlinkFtpTest::serverChannel; return MavlinkFtpTest::serverChannel;
#else #else
// Not unit testing, use the real thing // Not unit testing, use the real thing
return _mavlink->get_channel(); return _mavlink.get_channel();
#endif #endif
} }
@@ -180,7 +176,7 @@ MavlinkFTP::_process_request(
#ifdef MAVLINK_FTP_UNIT_TEST #ifdef MAVLINK_FTP_UNIT_TEST
_utRcvMsgFunc(last_reply, _worker_data); _utRcvMsgFunc(last_reply, _worker_data);
#else #else
mavlink_msg_file_transfer_protocol_send_struct(_mavlink->get_channel(), last_reply); mavlink_msg_file_transfer_protocol_send_struct(_mavlink.get_channel(), last_reply);
#endif #endif
return; return;
} }
@@ -340,7 +336,7 @@ MavlinkFTP::_reply(mavlink_file_transfer_protocol_t *ftp_req)
// Unit test hook is set, call that instead // Unit test hook is set, call that instead
_utRcvMsgFunc(ftp_req, _worker_data); _utRcvMsgFunc(ftp_req, _worker_data);
#else #else
mavlink_msg_file_transfer_protocol_send_struct(_mavlink->get_channel(), ftp_req); mavlink_msg_file_transfer_protocol_send_struct(_mavlink.get_channel(), ftp_req);
#endif #endif
} }
@@ -1055,8 +1051,8 @@ void MavlinkFTP::send()
#ifndef MAVLINK_FTP_UNIT_TEST #ifndef MAVLINK_FTP_UNIT_TEST
// Skip send if not enough room // Skip send if not enough room
unsigned max_bytes_to_send = _mavlink->get_free_tx_buf(); unsigned max_bytes_to_send = _mavlink.get_free_tx_buf();
PX4_DEBUG("MavlinkFTP::send max_bytes_to_send(%u) get_free_tx_buf(%u)", max_bytes_to_send, _mavlink->get_free_tx_buf()); PX4_DEBUG("MavlinkFTP::send max_bytes_to_send(%u) get_free_tx_buf(%u)", max_bytes_to_send, _mavlink.get_free_tx_buf());
if (max_bytes_to_send < get_size()) { if (max_bytes_to_send < get_size()) {
return; return;
+2 -6
View File
@@ -43,11 +43,7 @@
#include <systemlib/err.h> #include <systemlib/err.h>
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#ifndef MAVLINK_FTP_UNIT_TEST
#include "mavlink_bridge_header.h" #include "mavlink_bridge_header.h"
#else
#include <mavlink.h>
#endif
class MavlinkFtpTest; class MavlinkFtpTest;
class Mavlink; class Mavlink;
@@ -56,7 +52,7 @@ class Mavlink;
class MavlinkFTP class MavlinkFTP
{ {
public: public:
MavlinkFTP(Mavlink *mavlink); MavlinkFTP(Mavlink &mavlink);
~MavlinkFTP(); ~MavlinkFTP();
/** /**
@@ -190,7 +186,7 @@ private:
ReceiveMessageFunc_t _utRcvMsgFunc{}; ///< Unit test override for mavlink message sending ReceiveMessageFunc_t _utRcvMsgFunc{}; ///< Unit test override for mavlink message sending
void *_worker_data{nullptr}; ///< Additional parameter to _utRcvMsgFunc; void *_worker_data{nullptr}; ///< Additional parameter to _utRcvMsgFunc;
Mavlink *_mavlink; Mavlink &_mavlink;
/* do not allow copying this class */ /* do not allow copying this class */
MavlinkFTP(const MavlinkFTP &); MavlinkFTP(const MavlinkFTP &);
+5 -5
View File
@@ -80,7 +80,7 @@ stat_file(const char *file, time_t *date = nullptr, uint32_t *size = nullptr)
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
MavlinkLogHandler::MavlinkLogHandler(Mavlink *mavlink) MavlinkLogHandler::MavlinkLogHandler(Mavlink &mavlink)
: _mavlink(mavlink) : _mavlink(mavlink)
{ {
@@ -123,14 +123,14 @@ MavlinkLogHandler::send()
//-- Log Entries //-- Log Entries
while (_current_status == LogHandlerState::Listing while (_current_status == LogHandlerState::Listing
&& _mavlink->get_free_tx_buf() > MAVLINK_MSG_ID_LOG_ENTRY_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES && _mavlink.get_free_tx_buf() > MAVLINK_MSG_ID_LOG_ENTRY_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES
&& count < MAX_BYTES_SEND) { && count < MAX_BYTES_SEND) {
count += _log_send_listing(); count += _log_send_listing();
} }
//-- Log Data //-- Log Data
while (_current_status == LogHandlerState::SendingData while (_current_status == LogHandlerState::SendingData
&& _mavlink->get_free_tx_buf() > MAVLINK_MSG_ID_LOG_DATA_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES && _mavlink.get_free_tx_buf() > MAVLINK_MSG_ID_LOG_DATA_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES
&& count < MAX_BYTES_SEND) { && count < MAX_BYTES_SEND) {
count += _log_send_data(); count += _log_send_data();
} }
@@ -272,7 +272,7 @@ MavlinkLogHandler::_log_send_listing()
response.id = _next_entry; response.id = _next_entry;
response.num_logs = _log_count; response.num_logs = _log_count;
response.last_log_num = _last_entry; response.last_log_num = _last_entry;
mavlink_msg_log_entry_send_struct(_mavlink->get_channel(), &response); mavlink_msg_log_entry_send_struct(_mavlink.get_channel(), &response);
//-- If we're done listing, flag it. //-- If we're done listing, flag it.
if (_next_entry >= _last_entry) { if (_next_entry >= _last_entry) {
@@ -309,7 +309,7 @@ MavlinkLogHandler::_log_send_data()
response.ofs = _current_log_data_offset; response.ofs = _current_log_data_offset;
response.id = _current_log_index; response.id = _current_log_index;
response.count = read_size; response.count = read_size;
mavlink_msg_log_data_send_struct(_mavlink->get_channel(), &response); mavlink_msg_log_data_send_struct(_mavlink.get_channel(), &response);
_current_log_data_offset += read_size; _current_log_data_offset += read_size;
_current_log_data_remaining -= read_size; _current_log_data_remaining -= read_size;
+2 -2
View File
@@ -51,7 +51,7 @@ class Mavlink;
class MavlinkLogHandler class MavlinkLogHandler
{ {
public: public:
MavlinkLogHandler(Mavlink *mavlink); MavlinkLogHandler(Mavlink &mavlink);
~MavlinkLogHandler(); ~MavlinkLogHandler();
// Handle possible LOG message // Handle possible LOG message
@@ -93,7 +93,7 @@ private:
size_t _log_send_data(); size_t _log_send_data();
LogHandlerState _current_status{LogHandlerState::Inactive}; LogHandlerState _current_status{LogHandlerState::Inactive};
Mavlink *_mavlink; Mavlink &_mavlink;
int _next_entry{0}; int _next_entry{0};
int _last_entry{0}; int _last_entry{0};
+3 -3
View File
@@ -100,7 +100,7 @@ bool Mavlink::_boot_complete = false;
Mavlink::Mavlink() : Mavlink::Mavlink() :
ModuleParams(nullptr), ModuleParams(nullptr),
_receiver(this) _receiver(*this)
{ {
// initialise parameter cache // initialise parameter cache
mavlink_update_parameters(); mavlink_update_parameters();
@@ -438,12 +438,12 @@ Mavlink::serial_instance_exists(const char *device_name, Mavlink *self)
} }
bool bool
Mavlink::component_was_seen(int system_id, int component_id, Mavlink *self) Mavlink::component_was_seen(int system_id, int component_id, Mavlink &self)
{ {
LockGuard lg{mavlink_module_mutex}; LockGuard lg{mavlink_module_mutex};
for (Mavlink *inst : mavlink_module_instances) { for (Mavlink *inst : mavlink_module_instances) {
if (inst && (inst != self) && (inst->_receiver.component_was_seen(system_id, component_id))) { if (inst && (inst != &self) && (inst->_receiver.component_was_seen(system_id, component_id))) {
return true; return true;
} }
} }
+1 -1
View File
@@ -172,7 +172,7 @@ public:
static bool serial_instance_exists(const char *device_name, Mavlink *self); static bool serial_instance_exists(const char *device_name, Mavlink *self);
static bool component_was_seen(int system_id, int component_id, Mavlink *self = nullptr); static bool component_was_seen(int system_id, int component_id, Mavlink &self);
static void forward_message(const mavlink_message_t *msg, Mavlink *self); static void forward_message(const mavlink_message_t *msg, Mavlink *self);
+35 -35
View File
@@ -72,7 +72,7 @@ constexpr uint16_t MavlinkMissionManager::MAX_COUNT[];
(_msg.target_component == MAV_COMP_ID_MISSIONPLANNER) || \ (_msg.target_component == MAV_COMP_ID_MISSIONPLANNER) || \
(_msg.target_component == MAV_COMP_ID_ALL))) (_msg.target_component == MAV_COMP_ID_ALL)))
MavlinkMissionManager::MavlinkMissionManager(Mavlink *mavlink) : MavlinkMissionManager::MavlinkMissionManager(Mavlink &mavlink) :
_mavlink(mavlink) _mavlink(mavlink)
{ {
if (!_dataman_init) { if (!_dataman_init) {
@@ -209,7 +209,7 @@ MavlinkMissionManager::update_geofence_count(dm_item_t fence_dataman_id, unsigne
} else { } else {
if (_filesystem_errcount++ < FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT) { if (_filesystem_errcount++ < FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT) {
_mavlink->send_statustext_critical("Mission storage: Unable to write to microSD\t"); _mavlink.send_statustext_critical("Mission storage: Unable to write to microSD\t");
events::send(events::ID("mavlink_mission_storage_write_failure2"), events::Log::Critical, events::send(events::ID("mavlink_mission_storage_write_failure2"), events::Log::Critical,
"Mission: Unable to write to storage"); "Mission: Unable to write to storage");
} }
@@ -245,7 +245,7 @@ MavlinkMissionManager::update_safepoint_count(dm_item_t safepoint_dataman_id, un
} else { } else {
if (_filesystem_errcount++ < FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT) { if (_filesystem_errcount++ < FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT) {
_mavlink->send_statustext_critical("Mission storage: Unable to write to microSD\t"); _mavlink.send_statustext_critical("Mission storage: Unable to write to microSD\t");
events::send(events::ID("mavlink_mission_storage_write_failure3"), events::Log::Critical, events::send(events::ID("mavlink_mission_storage_write_failure3"), events::Log::Critical,
"Mission: Unable to write to storage"); "Mission: Unable to write to storage");
} }
@@ -270,7 +270,7 @@ MavlinkMissionManager::send_mission_ack(uint8_t sysid, uint8_t compid, uint8_t t
wpa.mission_type = _mission_type; wpa.mission_type = _mission_type;
wpa.opaque_id = opaque_id; wpa.opaque_id = opaque_id;
mavlink_msg_mission_ack_send_struct(_mavlink->get_channel(), &wpa); mavlink_msg_mission_ack_send_struct(_mavlink.get_channel(), &wpa);
PX4_DEBUG("WPM: Send MISSION_ACK type %u to ID %u", wpa.type, wpa.target_system); PX4_DEBUG("WPM: Send MISSION_ACK type %u to ID %u", wpa.type, wpa.target_system);
} }
@@ -284,7 +284,7 @@ MavlinkMissionManager::send_mission_current(uint16_t seq)
wpc.mission_id = _crc32[MAV_MISSION_TYPE_MISSION]; wpc.mission_id = _crc32[MAV_MISSION_TYPE_MISSION];
wpc.fence_id = _crc32[MAV_MISSION_TYPE_FENCE]; wpc.fence_id = _crc32[MAV_MISSION_TYPE_FENCE];
wpc.rally_points_id = _crc32[MAV_MISSION_TYPE_RALLY]; wpc.rally_points_id = _crc32[MAV_MISSION_TYPE_RALLY];
mavlink_msg_mission_current_send_struct(_mavlink->get_channel(), &wpc); mavlink_msg_mission_current_send_struct(_mavlink.get_channel(), &wpc);
PX4_DEBUG("WPM: Send MISSION_CURRENT seq %d", seq); PX4_DEBUG("WPM: Send MISSION_CURRENT seq %d", seq);
} }
@@ -303,7 +303,7 @@ MavlinkMissionManager::send_mission_count(uint8_t sysid, uint8_t compid, uint16_
wpc.mission_type = mission_type; wpc.mission_type = mission_type;
wpc.opaque_id = opaque_id; wpc.opaque_id = opaque_id;
mavlink_msg_mission_count_send_struct(_mavlink->get_channel(), &wpc); mavlink_msg_mission_count_send_struct(_mavlink.get_channel(), &wpc);
PX4_DEBUG("WPM: Send MISSION_COUNT %u to ID %u, mission type=%i", wpc.count, wpc.target_system, mission_type); PX4_DEBUG("WPM: Send MISSION_COUNT %u to ID %u, mission type=%i", wpc.count, wpc.target_system, mission_type);
} }
@@ -350,7 +350,7 @@ MavlinkMissionManager::send_mission_item(uint8_t sysid, uint8_t compid, uint16_t
break; break;
default: default:
_mavlink->send_statustext_critical("Received unknown mission type, abort.\t"); _mavlink.send_statustext_critical("Received unknown mission type, abort.\t");
events::send(events::ID("mavlink_mission_recv_unknown_mis_type"), events::Log::Error, events::send(events::ID("mavlink_mission_recv_unknown_mis_type"), events::Log::Error,
"Received unknown mission type, abort"); "Received unknown mission type, abort");
break; break;
@@ -368,7 +368,7 @@ MavlinkMissionManager::send_mission_item(uint8_t sysid, uint8_t compid, uint16_t
wp.seq = seq; wp.seq = seq;
wp.current = (_current_seq == seq) ? 1 : 0; wp.current = (_current_seq == seq) ? 1 : 0;
mavlink_msg_mission_item_int_send_struct(_mavlink->get_channel(), &wp); mavlink_msg_mission_item_int_send_struct(_mavlink.get_channel(), &wp);
PX4_DEBUG("WPM: Send MISSION_ITEM_INT seq %u to ID %u", wp.seq, wp.target_system); PX4_DEBUG("WPM: Send MISSION_ITEM_INT seq %u to ID %u", wp.seq, wp.target_system);
@@ -381,7 +381,7 @@ MavlinkMissionManager::send_mission_item(uint8_t sysid, uint8_t compid, uint16_t
wp.seq = seq; wp.seq = seq;
wp.current = (_current_seq == seq) ? 1 : 0; wp.current = (_current_seq == seq) ? 1 : 0;
mavlink_msg_mission_item_send_struct(_mavlink->get_channel(), &wp); mavlink_msg_mission_item_send_struct(_mavlink.get_channel(), &wp);
PX4_DEBUG("WPM: Send MISSION_ITEM seq %u to ID %u", wp.seq, wp.target_system); PX4_DEBUG("WPM: Send MISSION_ITEM seq %u to ID %u", wp.seq, wp.target_system);
} }
@@ -390,7 +390,7 @@ MavlinkMissionManager::send_mission_item(uint8_t sysid, uint8_t compid, uint16_t
send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR); send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR);
if (_filesystem_errcount++ < FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT) { if (_filesystem_errcount++ < FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT) {
mavlink_log_critical(_mavlink->get_mavlink_log_pub(), mavlink_log_critical(_mavlink.get_mavlink_log_pub(),
"Mission storage: Unable to read from storage, type: %" PRId8 "\t", (uint8_t)_mission_type); "Mission storage: Unable to read from storage, type: %" PRId8 "\t", (uint8_t)_mission_type);
/* EVENT /* EVENT
* @description Mission type: {1} * @description Mission type: {1}
@@ -448,7 +448,7 @@ MavlinkMissionManager::send_mission_request(uint8_t sysid, uint8_t compid, uint1
wpr.target_component = compid; wpr.target_component = compid;
wpr.seq = seq; wpr.seq = seq;
wpr.mission_type = _mission_type; wpr.mission_type = _mission_type;
mavlink_msg_mission_request_int_send_struct(_mavlink->get_channel(), &wpr); mavlink_msg_mission_request_int_send_struct(_mavlink.get_channel(), &wpr);
PX4_DEBUG("WPM: Send MISSION_REQUEST_INT seq %u to ID %u", wpr.seq, wpr.target_system); PX4_DEBUG("WPM: Send MISSION_REQUEST_INT seq %u to ID %u", wpr.seq, wpr.target_system);
@@ -460,13 +460,13 @@ MavlinkMissionManager::send_mission_request(uint8_t sysid, uint8_t compid, uint1
wpr.seq = seq; wpr.seq = seq;
wpr.mission_type = _mission_type; wpr.mission_type = _mission_type;
mavlink_msg_mission_request_send_struct(_mavlink->get_channel(), &wpr); mavlink_msg_mission_request_send_struct(_mavlink.get_channel(), &wpr);
PX4_DEBUG("WPM: Send MISSION_REQUEST seq %u to ID %u", wpr.seq, wpr.target_system); PX4_DEBUG("WPM: Send MISSION_REQUEST seq %u to ID %u", wpr.seq, wpr.target_system);
} }
} else { } else {
_mavlink->send_statustext_critical("ERROR: Waypoint index exceeds list capacity\t"); _mavlink.send_statustext_critical("ERROR: Waypoint index exceeds list capacity\t");
events::send<uint16_t>(events::ID("mavlink_mission_wp_index_exceeds_list"), events::Log::Error, events::send<uint16_t>(events::ID("mavlink_mission_wp_index_exceeds_list"), events::Log::Error,
"Waypoint index eceeds list capacity (maximum: {1})", current_max_item_count()); "Waypoint index eceeds list capacity (maximum: {1})", current_max_item_count());
@@ -481,7 +481,7 @@ MavlinkMissionManager::send_mission_item_reached(uint16_t seq)
wp_reached.seq = seq; wp_reached.seq = seq;
mavlink_msg_mission_item_reached_send_struct(_mavlink->get_channel(), &wp_reached); mavlink_msg_mission_item_reached_send_struct(_mavlink.get_channel(), &wp_reached);
PX4_DEBUG("WPM: Send MISSION_ITEM_REACHED reached_seq %u", wp_reached.seq); PX4_DEBUG("WPM: Send MISSION_ITEM_REACHED reached_seq %u", wp_reached.seq);
} }
@@ -490,7 +490,7 @@ void
MavlinkMissionManager::send() MavlinkMissionManager::send()
{ {
// do not send anything over high latency communication // do not send anything over high latency communication
if (_mavlink->get_mode() == Mavlink::MAVLINK_MODE_IRIDIUM) { if (_mavlink.get_mode() == Mavlink::MAVLINK_MODE_IRIDIUM) {
return; return;
} }
@@ -509,7 +509,7 @@ MavlinkMissionManager::send()
send_mission_current(_current_seq); send_mission_current(_current_seq);
} else { } else {
_mavlink->send_statustext_critical("ERROR: wp index out of bounds\t"); _mavlink.send_statustext_critical("ERROR: wp index out of bounds\t");
events::send<uint16_t, uint16_t>(events::ID("mavlink_mission_wp_index_out_of_bounds"), events::Log::Error, events::send<uint16_t, uint16_t>(events::ID("mavlink_mission_wp_index_out_of_bounds"), events::Log::Error,
"Waypoint index out of bounds (current {1} \\>= total {2})", mission_result.seq_current, mission_result.seq_total); "Waypoint index out of bounds (current {1} \\>= total {2})", mission_result.seq_current, mission_result.seq_total);
} }
@@ -562,7 +562,7 @@ MavlinkMissionManager::send()
} else if (_state != MAVLINK_WPM_STATE_IDLE && (_time_last_recv > 0) } else if (_state != MAVLINK_WPM_STATE_IDLE && (_time_last_recv > 0)
&& hrt_elapsed_time(&_time_last_recv) > MAVLINK_MISSION_PROTOCOL_TIMEOUT_DEFAULT) { && hrt_elapsed_time(&_time_last_recv) > MAVLINK_MISSION_PROTOCOL_TIMEOUT_DEFAULT) {
_mavlink->send_statustext_critical("Operation timeout\t"); _mavlink.send_statustext_critical("Operation timeout\t");
events::send(events::ID("mavlink_mission_op_timeout"), events::Log::Error, events::send(events::ID("mavlink_mission_op_timeout"), events::Log::Error,
"Operation timeout, aborting transfer"); "Operation timeout, aborting transfer");
@@ -674,7 +674,7 @@ MavlinkMissionManager::handle_mission_ack(const mavlink_message_t *msg)
} }
} else { } else {
_mavlink->send_statustext_critical("REJ. WP CMD: partner id mismatch\t"); _mavlink.send_statustext_critical("REJ. WP CMD: partner id mismatch\t");
events::send(events::ID("mavlink_mission_partner_id_mismatch"), events::Log::Error, events::send(events::ID("mavlink_mission_partner_id_mismatch"), events::Log::Error,
"Rejecting waypoint command, component or system ID mismatch"); "Rejecting waypoint command, component or system ID mismatch");
@@ -699,7 +699,7 @@ MavlinkMissionManager::handle_mission_set_current(const mavlink_message_t *msg)
} else { } else {
PX4_ERR("WPM: MISSION_SET_CURRENT seq=%d ERROR: not in list", wpc.seq); PX4_ERR("WPM: MISSION_SET_CURRENT seq=%d ERROR: not in list", wpc.seq);
_mavlink->send_statustext_critical("WPM: WP CURR CMD: Not in list\t"); _mavlink.send_statustext_critical("WPM: WP CURR CMD: Not in list\t");
events::send(events::ID("mavlink_mission_seq_out_of_bounds"), events::Log::Error, events::send(events::ID("mavlink_mission_seq_out_of_bounds"), events::Log::Error,
"New mission waypoint sequence out of bounds"); "New mission waypoint sequence out of bounds");
} }
@@ -707,7 +707,7 @@ MavlinkMissionManager::handle_mission_set_current(const mavlink_message_t *msg)
} else { } else {
PX4_DEBUG("WPM: MISSION_SET_CURRENT ERROR: busy"); PX4_DEBUG("WPM: MISSION_SET_CURRENT ERROR: busy");
_mavlink->send_statustext_critical("WPM: IGN WP CURR CMD: Busy\t"); _mavlink.send_statustext_critical("WPM: IGN WP CURR CMD: Busy\t");
events::send(events::ID("mavlink_mission_state_busy"), events::Log::Error, events::send(events::ID("mavlink_mission_state_busy"), events::Log::Error,
"Mission manager currently busy, ignoring new waypoint index"); "Mission manager currently busy, ignoring new waypoint index");
} }
@@ -768,7 +768,7 @@ MavlinkMissionManager::handle_mission_request_list(const mavlink_message_t *msg)
} else { } else {
PX4_DEBUG("WPM: MISSION_REQUEST_LIST ERROR: busy"); PX4_DEBUG("WPM: MISSION_REQUEST_LIST ERROR: busy");
_mavlink->send_statustext_info("Mission download request ignored, already active\t"); _mavlink.send_statustext_info("Mission download request ignored, already active\t");
events::send(events::ID("mavlink_mission_req_ignored"), events::Log::Warning, events::send(events::ID("mavlink_mission_req_ignored"), events::Log::Warning,
"Mission download request ignored, already active"); "Mission download request ignored, already active");
} }
@@ -843,7 +843,7 @@ MavlinkMissionManager::handle_mission_request_both(const mavlink_message_t *msg)
switch_to_idle_state(); switch_to_idle_state();
send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR); send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR);
_mavlink->send_statustext_critical("WPM: REJ. CMD: Req. WP was unexpected\t"); _mavlink.send_statustext_critical("WPM: REJ. CMD: Req. WP was unexpected\t");
events::send(events::ID("mavlink_mission_wp_unexpected"), events::Log::Error, events::send(events::ID("mavlink_mission_wp_unexpected"), events::Log::Error,
"Unexpected waypoint index, aborting transfer"); "Unexpected waypoint index, aborting transfer");
return; return;
@@ -860,7 +860,7 @@ MavlinkMissionManager::handle_mission_request_both(const mavlink_message_t *msg)
switch_to_idle_state(); switch_to_idle_state();
send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR); send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR);
_mavlink->send_statustext_critical("WPM: REJ. CMD: Req. WP was unexpected\t"); _mavlink.send_statustext_critical("WPM: REJ. CMD: Req. WP was unexpected\t");
events::send(events::ID("mavlink_mission_wp_unexpected2"), events::Log::Error, events::send(events::ID("mavlink_mission_wp_unexpected2"), events::Log::Error,
"Unexpected waypoint index, aborting mission transfer"); "Unexpected waypoint index, aborting mission transfer");
} }
@@ -869,18 +869,18 @@ MavlinkMissionManager::handle_mission_request_both(const mavlink_message_t *msg)
PX4_DEBUG("WPM: MISSION_ITEM_REQUEST(_INT) ERROR: no transfer"); PX4_DEBUG("WPM: MISSION_ITEM_REQUEST(_INT) ERROR: no transfer");
// Silently ignore this as some OSDs have buggy mission protocol implementations // Silently ignore this as some OSDs have buggy mission protocol implementations
//_mavlink->send_statustext_critical("IGN MISSION_ITEM_REQUEST(_INT): No active transfer"); //_mavlink.send_statustext_critical("IGN MISSION_ITEM_REQUEST(_INT): No active transfer");
} else { } else {
PX4_DEBUG("WPM: MISSION_ITEM_REQUEST(_INT) ERROR: busy (state %d).", _state); PX4_DEBUG("WPM: MISSION_ITEM_REQUEST(_INT) ERROR: busy (state %d).", _state);
_mavlink->send_statustext_critical("WPM: REJ. CMD: Busy\t"); _mavlink.send_statustext_critical("WPM: REJ. CMD: Busy\t");
events::send(events::ID("mavlink_mission_mis_req_ignored_busy"), events::Log::Error, events::send(events::ID("mavlink_mission_mis_req_ignored_busy"), events::Log::Error,
"Ignoring mission request, currently busy"); "Ignoring mission request, currently busy");
} }
} else { } else {
_mavlink->send_statustext_critical("WPM: REJ. CMD: partner id mismatch\t"); _mavlink.send_statustext_critical("WPM: REJ. CMD: partner id mismatch\t");
events::send(events::ID("mavlink_mission_partner_id_mismatch2"), events::Log::Error, events::send(events::ID("mavlink_mission_partner_id_mismatch2"), events::Log::Error,
"Rejecting mission request command, component or system ID mismatch"); "Rejecting mission request command, component or system ID mismatch");
@@ -1000,7 +1000,7 @@ MavlinkMissionManager::handle_mission_count(const mavlink_message_t *msg)
} else { } else {
PX4_DEBUG("WPM: MISSION_COUNT ERROR: busy, already receiving seq %u", _transfer_seq); PX4_DEBUG("WPM: MISSION_COUNT ERROR: busy, already receiving seq %u", _transfer_seq);
_mavlink->send_statustext_critical("WPM: REJ. CMD: Busy\t"); _mavlink.send_statustext_critical("WPM: REJ. CMD: Busy\t");
events::send(events::ID("mavlink_mission_getlist_busy"), events::Log::Error, events::send(events::ID("mavlink_mission_getlist_busy"), events::Log::Error,
"Mission upload busy, already receiving waypoint"); "Mission upload busy, already receiving waypoint");
@@ -1011,7 +1011,7 @@ MavlinkMissionManager::handle_mission_count(const mavlink_message_t *msg)
} else { } else {
PX4_DEBUG("WPM: MISSION_COUNT ERROR: busy, state %i", _state); PX4_DEBUG("WPM: MISSION_COUNT ERROR: busy, state %i", _state);
_mavlink->send_statustext_critical("WPM: IGN MISSION_COUNT: Busy\t"); _mavlink.send_statustext_critical("WPM: IGN MISSION_COUNT: Busy\t");
events::send(events::ID("mavlink_mission_ignore_mis_count"), events::Log::Error, events::send(events::ID("mavlink_mission_ignore_mis_count"), events::Log::Error,
"Mission upload busy, ignoring MISSION_COUNT"); "Mission upload busy, ignoring MISSION_COUNT");
send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR); send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR);
@@ -1088,7 +1088,7 @@ MavlinkMissionManager::handle_mission_item_both(const mavlink_message_t *msg)
} else { } else {
PX4_DEBUG("WPM: MISSION_ITEM ERROR: no transfer"); PX4_DEBUG("WPM: MISSION_ITEM ERROR: no transfer");
_mavlink->send_statustext_critical("IGN MISSION_ITEM: No transfer\t"); _mavlink.send_statustext_critical("IGN MISSION_ITEM: No transfer\t");
events::send(events::ID("mavlink_mission_no_transfer"), events::Log::Error, events::send(events::ID("mavlink_mission_no_transfer"), events::Log::Error,
"Ignoring mission item, no transfer in progress"); "Ignoring mission item, no transfer in progress");
send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR); send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR);
@@ -1099,7 +1099,7 @@ MavlinkMissionManager::handle_mission_item_both(const mavlink_message_t *msg)
} else { } else {
PX4_DEBUG("WPM: MISSION_ITEM ERROR: busy, state %i", _state); PX4_DEBUG("WPM: MISSION_ITEM ERROR: busy, state %i", _state);
_mavlink->send_statustext_critical("IGN MISSION_ITEM: Busy\t"); _mavlink.send_statustext_critical("IGN MISSION_ITEM: Busy\t");
events::send(events::ID("mavlink_mission_mis_item_busy"), events::Log::Error, events::send(events::ID("mavlink_mission_mis_item_busy"), events::Log::Error,
"Ignoring mission item, busy"); "Ignoring mission item, busy");
send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR); send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR);
@@ -1113,7 +1113,7 @@ MavlinkMissionManager::handle_mission_item_both(const mavlink_message_t *msg)
if (ret != PX4_OK) { if (ret != PX4_OK) {
PX4_DEBUG("WPM: MISSION_ITEM ERROR: seq %u invalid item", wp.seq); PX4_DEBUG("WPM: MISSION_ITEM ERROR: seq %u invalid item", wp.seq);
_mavlink->send_statustext_critical("IGN MISSION_ITEM: Invalid item\t"); _mavlink.send_statustext_critical("IGN MISSION_ITEM: Invalid item\t");
events::send(events::ID("mavlink_mission_mis_item_invalid"), events::Log::Error, events::send(events::ID("mavlink_mission_mis_item_invalid"), events::Log::Error,
"Ignoring mission item, invalid item"); "Ignoring mission item, invalid item");
@@ -1208,7 +1208,7 @@ MavlinkMissionManager::handle_mission_item_both(const mavlink_message_t *msg)
break; break;
default: default:
_mavlink->send_statustext_critical("Received unknown mission type, abort.\t"); _mavlink.send_statustext_critical("Received unknown mission type, abort.\t");
events::send(events::ID("mavlink_mission_unknown_mis_type"), events::Log::Error, events::send(events::ID("mavlink_mission_unknown_mis_type"), events::Log::Error,
"Received unknown mission type, abort"); "Received unknown mission type, abort");
break; break;
@@ -1220,7 +1220,7 @@ MavlinkMissionManager::handle_mission_item_both(const mavlink_message_t *msg)
send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR); send_mission_ack(_transfer_partner_sysid, _transfer_partner_compid, MAV_MISSION_ERROR);
if (write_failed) { if (write_failed) {
_mavlink->send_statustext_critical("Unable to write on micro SD\t"); _mavlink.send_statustext_critical("Unable to write on micro SD\t");
events::send(events::ID("mavlink_mission_storage_failure"), events::Log::Error, events::send(events::ID("mavlink_mission_storage_failure"), events::Log::Error,
"Mission: unable to write to storage"); "Mission: unable to write to storage");
} }
@@ -1361,7 +1361,7 @@ MavlinkMissionManager::handle_mission_clear_all(const mavlink_message_t *msg)
} }
} else { } else {
_mavlink->send_statustext_critical("WPM: IGN CLEAR CMD: Busy\t"); _mavlink.send_statustext_critical("WPM: IGN CLEAR CMD: Busy\t");
events::send(events::ID("mavlink_mission_ignore_clear"), events::Log::Error, events::send(events::ID("mavlink_mission_ignore_clear"), events::Log::Error,
"Ignoring mission clear command, busy"); "Ignoring mission clear command, busy");
@@ -1839,7 +1839,7 @@ void MavlinkMissionManager::copy_params_from_mavlink_to_mission_item(struct miss
void MavlinkMissionManager::check_active_mission() void MavlinkMissionManager::check_active_mission()
{ {
// do not send anything over high latency communication // do not send anything over high latency communication
if (_mavlink->get_mode() == Mavlink::MAVLINK_MODE_IRIDIUM) { if (_mavlink.get_mode() == Mavlink::MAVLINK_MODE_IRIDIUM) {
return; return;
} }
+2 -2
View File
@@ -77,7 +77,7 @@ class Mavlink;
class MavlinkMissionManager class MavlinkMissionManager
{ {
public: public:
explicit MavlinkMissionManager(Mavlink *mavlink); explicit MavlinkMissionManager(Mavlink &mavlink);
~MavlinkMissionManager() = default; ~MavlinkMissionManager() = default;
@@ -146,7 +146,7 @@ private:
MavlinkRateLimiter _slow_rate_limiter{1000 * 1000}; ///< Rate limit sending of the current WP sequence to 1 Hz MavlinkRateLimiter _slow_rate_limiter{1000 * 1000}; ///< Rate limit sending of the current WP sequence to 1 Hz
Mavlink *_mavlink; Mavlink &_mavlink;
static constexpr unsigned int FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT = static constexpr unsigned int FILESYSTEM_ERRCOUNT_NOTIFY_LIMIT =
2; ///< Error count limit before stopping to report FS errors 2; ///< Error count limit before stopping to report FS errors
+14 -14
View File
@@ -46,7 +46,7 @@
#include "mavlink_main.h" #include "mavlink_main.h"
#include <lib/systemlib/mavlink_log.h> #include <lib/systemlib/mavlink_log.h>
MavlinkParametersManager::MavlinkParametersManager(Mavlink *mavlink) : MavlinkParametersManager::MavlinkParametersManager(Mavlink &mavlink) :
_mavlink(mavlink) _mavlink(mavlink)
{ {
} }
@@ -111,7 +111,7 @@ MavlinkParametersManager::handle_message(const mavlink_message_t *msg)
/* Whatever the value is, we're being told to stop sending */ /* Whatever the value is, we're being told to stop sending */
if (strncmp(name, "_HASH_CHECK", sizeof(name)) == 0) { if (strncmp(name, "_HASH_CHECK", sizeof(name)) == 0) {
if (_mavlink->hash_check_enabled()) { if (_mavlink.hash_check_enabled()) {
_send_all_index = -1; _send_all_index = -1;
} }
@@ -189,7 +189,7 @@ MavlinkParametersManager::handle_message(const mavlink_message_t *msg)
strncpy(param_value.param_id, HASH_PARAM, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN); strncpy(param_value.param_id, HASH_PARAM, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN);
param_value.param_type = MAV_PARAM_TYPE_UINT32; param_value.param_type = MAV_PARAM_TYPE_UINT32;
memcpy(&param_value.param_value, &hash, sizeof(hash)); memcpy(&param_value.param_value, &hash, sizeof(hash));
mavlink_msg_param_value_send_struct(_mavlink->get_channel(), &param_value); mavlink_msg_param_value_send_struct(_mavlink.get_channel(), &param_value);
} else { } else {
/* local name buffer to enforce null-terminated string */ /* local name buffer to enforce null-terminated string */
@@ -249,7 +249,7 @@ MavlinkParametersManager::handle_message(const mavlink_message_t *msg)
size_t i = map_rc.parameter_rc_channel_index; size_t i = map_rc.parameter_rc_channel_index;
if (i >= sizeof(_rc_param_map.param_index) / sizeof(_rc_param_map.param_index[0])) { if (i >= sizeof(_rc_param_map.param_index) / sizeof(_rc_param_map.param_index[0])) {
mavlink_log_warning(_mavlink->get_mavlink_log_pub(), "parameter_rc_channel_index out of bounds\t"); mavlink_log_warning(_mavlink.get_mavlink_log_pub(), "parameter_rc_channel_index out of bounds\t");
events::send(events::ID("mavlink_param_rc_chan_out_of_bounds"), events::Log::Warning, events::send(events::ID("mavlink_param_rc_chan_out_of_bounds"), events::Log::Warning,
"parameter_rc_channel_index out of bounds"); "parameter_rc_channel_index out of bounds");
break; break;
@@ -319,7 +319,7 @@ MavlinkParametersManager::send()
int max_num_to_send; int max_num_to_send;
if (_mavlink->get_protocol() == Protocol::SERIAL && !_mavlink->is_usb_uart()) { if (_mavlink.get_protocol() == Protocol::SERIAL && !_mavlink.is_usb_uart()) {
max_num_to_send = 3; max_num_to_send = 3;
} else { } else {
@@ -330,7 +330,7 @@ MavlinkParametersManager::send()
int i = 0; int i = 0;
// Send while burst is not exceeded, we still have buffer space and still something to send // Send while burst is not exceeded, we still have buffer space and still something to send
while ((i++ < max_num_to_send) && (_mavlink->get_free_tx_buf() >= get_size()) && !_mavlink->radio_status_critical() while ((i++ < max_num_to_send) && (_mavlink.get_free_tx_buf() >= get_size()) && !_mavlink.radio_status_critical()
&& send_params()) {} && send_params()) {}
} }
@@ -394,7 +394,7 @@ MavlinkParametersManager::send_untransmitted()
break; break;
} }
} }
} while ((_mavlink->get_free_tx_buf() >= get_size()) && !_mavlink->radio_status_critical() } while ((_mavlink.get_free_tx_buf() >= get_size()) && !_mavlink.radio_status_critical()
&& (_param_update_index < (int) param_count())); && (_param_update_index < (int) param_count()));
// Flag work as done once all params have been sent // Flag work as done once all params have been sent
@@ -426,7 +426,7 @@ MavlinkParametersManager::send_one()
strncpy(msg.param_id, HASH_PARAM, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN); strncpy(msg.param_id, HASH_PARAM, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN);
msg.param_type = MAV_PARAM_TYPE_UINT32; msg.param_type = MAV_PARAM_TYPE_UINT32;
memcpy(&msg.param_value, &hash, sizeof(hash)); memcpy(&msg.param_value, &hash, sizeof(hash));
mavlink_msg_param_value_send_struct(_mavlink->get_channel(), &msg); mavlink_msg_param_value_send_struct(_mavlink.get_channel(), &msg);
/* after this we should start sending all params */ /* after this we should start sending all params */
_send_all_index = 0; _send_all_index = 0;
@@ -468,7 +468,7 @@ MavlinkParametersManager::send_param(param_t param, int component_id)
} }
/* no free TX buf to send this param */ /* no free TX buf to send this param */
if (_mavlink->get_free_tx_buf() < MAVLINK_MSG_ID_PARAM_VALUE_LEN) { if (_mavlink.get_free_tx_buf() < MAVLINK_MSG_ID_PARAM_VALUE_LEN) {
return 1; return 1;
} }
@@ -535,13 +535,13 @@ MavlinkParametersManager::send_param(param_t param, int component_id)
/* default component ID */ /* default component ID */
if (component_id < 0) { if (component_id < 0) {
mavlink_msg_param_value_send_struct(_mavlink->get_channel(), &msg); mavlink_msg_param_value_send_struct(_mavlink.get_channel(), &msg);
} else { } else {
// Re-pack the message with a different component ID // Re-pack the message with a different component ID
mavlink_message_t mavlink_packet; mavlink_message_t mavlink_packet;
mavlink_msg_param_value_encode_chan(mavlink_system.sysid, component_id, _mavlink->get_channel(), &mavlink_packet, &msg); mavlink_msg_param_value_encode_chan(mavlink_system.sysid, component_id, _mavlink.get_channel(), &mavlink_packet, &msg);
_mavlink_resend_uart(_mavlink->get_channel(), &mavlink_packet); _mavlink_resend_uart(_mavlink.get_channel(), &mavlink_packet);
} }
return 0; return 0;
@@ -595,9 +595,9 @@ bool MavlinkParametersManager::send_uavcan()
// Re-pack the message with the UAVCAN node ID // Re-pack the message with the UAVCAN node ID
mavlink_message_t mavlink_packet{}; mavlink_message_t mavlink_packet{};
mavlink_msg_param_value_encode_chan(mavlink_system.sysid, value.node_id, _mavlink->get_channel(), &mavlink_packet, mavlink_msg_param_value_encode_chan(mavlink_system.sysid, value.node_id, _mavlink.get_channel(), &mavlink_packet,
&msg); &msg);
_mavlink_resend_uart(_mavlink->get_channel(), &mavlink_packet); _mavlink_resend_uart(_mavlink.get_channel(), &mavlink_packet);
return true; return true;
} }
+2 -2
View File
@@ -64,7 +64,7 @@ class Mavlink;
class MavlinkParametersManager class MavlinkParametersManager
{ {
public: public:
explicit MavlinkParametersManager(Mavlink *mavlink); explicit MavlinkParametersManager(Mavlink &mavlink);
~MavlinkParametersManager() = default; ~MavlinkParametersManager() = default;
/** /**
@@ -159,7 +159,7 @@ protected:
hrt_abstime _param_update_time{0}; hrt_abstime _param_update_time{0};
int _param_update_index{0}; int _param_update_index{0};
Mavlink *_mavlink; Mavlink &_mavlink;
bool _first_send{false}; bool _first_send{false};
}; };
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -126,7 +126,7 @@ class Mavlink;
class MavlinkReceiver : public ModuleParams class MavlinkReceiver : public ModuleParams
{ {
public: public:
MavlinkReceiver(Mavlink *parent); MavlinkReceiver(Mavlink &parent);
~MavlinkReceiver() override; ~MavlinkReceiver() override;
void start(); void start();
@@ -246,7 +246,7 @@ private:
*/ */
void updateParams() override; void updateParams() override;
Mavlink *_mavlink; Mavlink &_mavlink;
MavlinkFTP _mavlink_ftp; MavlinkFTP _mavlink_ftp;
MavlinkLogHandler _mavlink_log_handler; MavlinkLogHandler _mavlink_log_handler;
@@ -77,7 +77,7 @@ MavlinkFtpTest::MavlinkFtpTest() :
void MavlinkFtpTest::_init() void MavlinkFtpTest::_init()
{ {
_expected_seq_number = 0; _expected_seq_number = 0;
_ftp_server = new MavlinkFTP(nullptr); _ftp_server = new MavlinkFTP(_mavlink);
_ftp_server->set_unittest_worker(MavlinkFtpTest::receive_message_handler_generic, this); _ftp_server->set_unittest_worker(MavlinkFtpTest::receive_message_handler_generic, this);
_create_test_files(); _create_test_files();
@@ -37,12 +37,9 @@
#pragma once #pragma once
#include <unit_test.h> #include <unit_test.h>
#ifndef MAVLINK_FTP_UNIT_TEST
#include "../mavlink_bridge_header.h" #include "../mavlink_bridge_header.h"
#else
#include <mavlink.h>
#endif
#include "../mavlink_ftp.h" #include "../mavlink_ftp.h"
#include "../mavlink_main.h"
class MavlinkFtpTest : public UnitTest class MavlinkFtpTest : public UnitTest
{ {
@@ -130,6 +127,7 @@ private:
bool _receive_message_handler_burst(const mavlink_file_transfer_protocol_t *ftp_req, BurstInfo *burst_info); bool _receive_message_handler_burst(const mavlink_file_transfer_protocol_t *ftp_req, BurstInfo *burst_info);
MavlinkFTP *_ftp_server; MavlinkFTP *_ftp_server;
Mavlink _mavlink;
uint16_t _expected_seq_number; uint16_t _expected_seq_number;
mavlink_file_transfer_protocol_t _reply_msg; mavlink_file_transfer_protocol_t _reply_msg;
+2 -2
View File
@@ -43,7 +43,7 @@
#include <stdlib.h> #include <stdlib.h>
MavlinkTimesync::MavlinkTimesync(Mavlink *mavlink) : MavlinkTimesync::MavlinkTimesync(Mavlink &mavlink) :
_mavlink(mavlink) _mavlink(mavlink)
{ {
} }
@@ -66,7 +66,7 @@ MavlinkTimesync::handle_message(const mavlink_message_t *msg)
rsync.tc1 = now * 1000ULL; rsync.tc1 = now * 1000ULL;
rsync.ts1 = tsync.ts1; rsync.ts1 = tsync.ts1;
mavlink_msg_timesync_send_struct(_mavlink->get_channel(), &rsync); mavlink_msg_timesync_send_struct(_mavlink.get_channel(), &rsync);
return; return;
+2 -2
View File
@@ -49,7 +49,7 @@ class Mavlink;
class MavlinkTimesync class MavlinkTimesync
{ {
public: public:
explicit MavlinkTimesync(Mavlink *mavlink); explicit MavlinkTimesync(Mavlink &mavlink);
~MavlinkTimesync() = default; ~MavlinkTimesync() = default;
void handle_message(const mavlink_message_t *msg); void handle_message(const mavlink_message_t *msg);
@@ -61,6 +61,6 @@ public:
uint64_t sync_stamp(uint64_t usec) { return _timesync.sync_stamp(usec); } uint64_t sync_stamp(uint64_t usec) { return _timesync.sync_stamp(usec); }
private: private:
Mavlink *const _mavlink; Mavlink &_mavlink;
Timesync _timesync{}; Timesync _timesync{};
}; };