mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 01:13:34 +08:00
TransferSender is now capable of broadcasting in passive mode; Frame::isValid() was modified to accept SFT broadcasts with zero SNID
This commit is contained in:
@@ -115,6 +115,7 @@ public:
|
||||
: canio_(driver, allocator, sysclock)
|
||||
, sysclock_(sysclock)
|
||||
, outgoing_transfer_reg_(otr)
|
||||
, self_node_id_(NodeID::Broadcast) // Default
|
||||
, self_node_id_is_set_(false)
|
||||
{ }
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
{
|
||||
UAVCAN_ASSERT((transfer_type == TransferTypeMessageBroadcast) == dst_node_id.isBroadcast());
|
||||
UAVCAN_ASSERT(data_type_id.isValid());
|
||||
UAVCAN_ASSERT(src_node_id != dst_node_id);
|
||||
UAVCAN_ASSERT(src_node_id.isUnicast() ? (src_node_id != dst_node_id) : true);
|
||||
UAVCAN_ASSERT(frame_index <= MaxIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ class UAVCAN_EXPORT TransferSender
|
||||
const TransferCRC crc_base_;
|
||||
CanIOFlags flags_;
|
||||
uint8_t iface_mask_;
|
||||
bool allow_broadcasting_in_passive_mode_;
|
||||
|
||||
Dispatcher& dispatcher_;
|
||||
|
||||
@@ -46,6 +47,7 @@ public:
|
||||
, crc_base_(data_type.getSignature().toTransferCRC())
|
||||
, flags_(CanIOFlags(0))
|
||||
, iface_mask_(AllIfacesMask)
|
||||
, allow_broadcasting_in_passive_mode_(false)
|
||||
, dispatcher_(dispatcher)
|
||||
{ }
|
||||
|
||||
@@ -59,6 +61,13 @@ public:
|
||||
iface_mask_ = iface_mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, this class will return an error on any attempt to publish a message while the
|
||||
* dispatcher is configured in passive mode. This method allows to permanently enable sending
|
||||
* broadcast transfers in passive mode for this class instance.
|
||||
*/
|
||||
void allowBroadcastingInPassiveMode() { allow_broadcasting_in_passive_mode_ = true; }
|
||||
|
||||
/**
|
||||
* Send with explicit Transfer ID.
|
||||
* Should be used only for service responses, where response TID should match request TID.
|
||||
|
||||
Reference in New Issue
Block a user