@@ -296,7 +296,7 @@ inline auto makePseudoUniqueID(const SystemInfo::UniqueID& uid) -> std::uint64_t
296296
297297// / If the local-ID is provided, the filter will match only on service transfers addressed to the local node.
298298// / If the local-ID is not provided, the filter will match on PnP allocation response messages only.
299- template <std::uint8_t UAVCANVersion >
299+ template <std::uint8_t Version >
300300[[nodiscard]] auto makeAcceptanceFilter (const std::optional<std::uint8_t > local_node_id) -> CANAcceptanceFilterConfig;
301301template <>
302302[[nodiscard]] inline auto makeAcceptanceFilter<0 >(const std::optional<std::uint8_t > local_node_id)
@@ -383,7 +383,7 @@ struct ServiceFrameModel : FrameModel
383383 const std::uint8_t transfer_id = (tail & MaxTransferID);
384384 if (start_of_transfer && (!toggle))
385385 {
386- return {}; // UAVCAN v0
386+ return {}; // DroneCAN
387387 }
388388 if (((!start_of_transfer) || (!end_of_transfer)) && (out_payload_size == 0 ))
389389 {
@@ -450,7 +450,7 @@ struct ServiceFrameModel : FrameModel
450450 -> std::optional<std::variant<MessageFrameModel, ServiceFrameModel>>
451451{
452452 KOCHERGA_ASSERT (payload != nullptr );
453- if ((payload_size < 1 ) || (payload_size > 8 )) // Legacy UAVCAN v0 is compatible only with Classic CAN.
453+ if ((payload_size < 1 ) || (payload_size > 8 )) // Legacy is compatible only with Classic CAN.
454454 { // This is because the low granularity of DLC in CAN FD breaks TAO.
455455 return {};
456456 }
@@ -462,7 +462,7 @@ struct ServiceFrameModel : FrameModel
462462 const std::uint8_t transfer_id = (tail & MaxTransferID);
463463 if (start_of_transfer && toggle)
464464 {
465- return {}; // UAVCAN v1
465+ return {}; // Cyphal
466466 }
467467 const auto priority = static_cast <std::uint8_t >((extended_can_id >> 24U ) & 31U );
468468 const auto source_node_id = static_cast <std::uint8_t >(extended_can_id & 0x7FU );
@@ -671,7 +671,7 @@ class BasicTransferReasmV0
671671 }
672672 if (frame.payload_size > (buffer_.size () - state_->payload_size ))
673673 {
674- state_.reset (); // Too much payload -- UAVCAN v0 does not define payload truncation.
674+ state_.reset (); // Too much payload -- DroneCAN does not define payload truncation.
675675 return {};
676676 }
677677 std::copy_n (frame.payload , frame.payload_size , buffer_.begin () + state_->payload_size );
@@ -778,7 +778,7 @@ class BasicServiceTransferReasmV0 : public BasicTransferReasmV0<MaxPayloadSize>
778778 const std::uint8_t local_node_id_;
779779};
780780
781- // / Send one UAVCAN /CAN v1 transfer. The push_frame callback is invoked per each transmitted frame; its type should be:
781+ // / Send one Cyphal /CAN transfer. The push_frame callback is invoked per each transmitted frame; its type should be:
782782// / (std::size_t, const std::uint8_t*) -> bool
783783// / The return value is true on success, false otherwise.
784784// / The callback shall not be an std::function<> or std::bind<> to avoid heap allocation.
@@ -1070,7 +1070,7 @@ class IActivity
10701070 auto operator =(IActivity&&) -> IActivity& = delete ;
10711071};
10721072
1073- // / The v0 main activity is a simplified translation layer between UAVCAN /CAN v1 and UAVCAN v0 .
1073+ // / The v0 main activity is a simplified translation layer between Cyphal /CAN and DroneCAN .
10741074// / The following ports are supported:
10751075// /
10761076// / Service RX TX
@@ -1437,7 +1437,7 @@ class V0MainActivity : public IActivity
14371437 BasicServiceTransferReasmV0<300 > rx_res_file_read_{FileReadSignature, local_node_id_};
14381438};
14391439
1440- // / The following example shows the CAN exchange dump collected from a real network using the old UAVCAN v0 GUI Tool.
1440+ // / The following example shows the CAN exchange dump collected from a real network using the old GUI Tool.
14411441// /
14421442// / Unique-ID of the allocatee: 35 FF D5 05 50 59 31 34 61 41 23 43 00 00 00 00
14431443// / Preferred node-ID: 0 (any, no preference)
@@ -1619,7 +1619,6 @@ class V0NodeIDAllocationActivity : public IActivity
16191619 KOCHERGA_ASSERT ((0 <= randomized) && (randomized <= delta));
16201620 const auto delay = std::max (std::chrono::microseconds (1 ), range.first ) + std::chrono::microseconds (randomized);
16211621 KOCHERGA_ASSERT (range.first <= delay);
1622- KOCHERGA_ASSERT (range.second >= delay);
16231622 deadline_ = now + delay;
16241623 }
16251624
@@ -2090,17 +2089,17 @@ class VersionDetectionActivity : public IActivity
20902089 while (const auto frame = driver_.pop (buf))
20912090 {
20922091 const auto [can_id, payload_size] = *frame;
2093- if (payload_size > 0 ) // UAVCAN frames are guaranteed to contain the tail byte always.
2092+ if (payload_size > 0 ) // Cyphal frames are guaranteed to contain the tail byte always.
20942093 {
2095- if (const auto uavcan_version = tryDetectVersionFromFrame (can_id, buf.at (payload_size - 1U )))
2094+ if (const auto version = tryDetectVersionFromFrame (can_id, buf.at (payload_size - 1U )))
20962095 {
20972096 if (!highest_version_seen_)
20982097 {
20992098 deadline_ = uptime + ListeningPeriod;
21002099 }
2101- if ((!highest_version_seen_) || (*highest_version_seen_ < *uavcan_version ))
2100+ if ((!highest_version_seen_) || (*highest_version_seen_ < *version ))
21022101 {
2103- highest_version_seen_ = uavcan_version ;
2102+ highest_version_seen_ = version ;
21042103 KOCHERGA_ASSERT (highest_version_seen_);
21052104 }
21062105 }
@@ -2114,7 +2113,7 @@ class VersionDetectionActivity : public IActivity
21142113 -> std::optional<std::uint8_t>
21152114 {
21162115 // CAN ID is not validated at the moment. This may be improved in the future to avoid misdetection if there
2117- // are other protocols besides UAVCAN on the same network.
2116+ // are other protocols besides Cyphal on the same network.
21182117 (void ) can_id;
21192118 if ((tail_byte & TailByteStartOfTransfer) != 0 )
21202119 {
@@ -2200,22 +2199,23 @@ class BitrateDetectionActivity : public IActivity
22002199
22012200} // namespace detail
22022201
2203- // / Kocherga node implementing the UAVCAN /CAN v1 transport along with UAVCAN v0 with automatic version detection.
2202+ // / Kocherga node implementing the Cyphal /CAN transport along with DroneCAN with automatic version detection.
22042203class CANNode : public kocherga ::INode
22052204{
22062205public:
22072206 // / The local UID shall be the same that is passed to the bootloader. It is used for PnP node-ID allocation.
2207+ // / The protocol version is 0 for DroneCAN (derived from legacy UAVCAN v0) and 1 for Cyphal/CAN.
22082208 // / By default, this implementation will auto-detect the parameters of the network and do a PnP node-ID allocation.
22092209 // / The application can opt-out of autoconfiguration by providing the required data to the constructor.
22102210 // / Unknown parameters shall be set to empty options.
22112211 CANNode (ICANDriver& driver,
22122212 const SystemInfo::UniqueID& local_unique_id,
2213- const std::optional<ICANDriver::Bitrate>& can_bitrate = {},
2214- const std::optional<std::uint8_t > uavcan_version = {},
2215- const std::optional<NodeID> local_node_id = {})
2213+ const std::optional<ICANDriver::Bitrate>& can_bitrate = {},
2214+ const std::optional<std::uint8_t > protocol_version = {},
2215+ const std::optional<NodeID> local_node_id = {})
22162216 {
2217- if ((activity_ == nullptr ) && can_bitrate && //
2218- uavcan_version && (*uavcan_version == 0 ) && //
2217+ if ((activity_ == nullptr ) && can_bitrate && //
2218+ protocol_version && (*protocol_version == 0 ) && //
22192219 local_node_id && (*local_node_id > 0 ) && (*local_node_id <= MaxNodeID))
22202220 {
22212221 if (const auto bus_mode =
@@ -2229,8 +2229,8 @@ class CANNode : public kocherga::INode
22292229 static_cast <std::uint8_t >(*local_node_id));
22302230 }
22312231 }
2232- if ((activity_ == nullptr ) && can_bitrate && //
2233- uavcan_version && (*uavcan_version == 1 ) && //
2232+ if ((activity_ == nullptr ) && can_bitrate && //
2233+ protocol_version && (*protocol_version == 1 ) && //
22342234 local_node_id && (*local_node_id <= MaxNodeID))
22352235 {
22362236 if (const auto bus_mode =
@@ -2244,7 +2244,7 @@ class CANNode : public kocherga::INode
22442244 static_cast <std::uint8_t >(*local_node_id));
22452245 }
22462246 }
2247- if ((activity_ == nullptr ) && can_bitrate && uavcan_version && (*uavcan_version == 0 ))
2247+ if ((activity_ == nullptr ) && can_bitrate && protocol_version && (*protocol_version == 0 ))
22482248 {
22492249 if (const auto bus_mode = driver.configure (*can_bitrate, false , detail::makeAcceptanceFilter<0 >({})))
22502250 {
@@ -2255,7 +2255,7 @@ class CANNode : public kocherga::INode
22552255 *can_bitrate);
22562256 }
22572257 }
2258- if ((activity_ == nullptr ) && can_bitrate && uavcan_version && (*uavcan_version == 1 ))
2258+ if ((activity_ == nullptr ) && can_bitrate && protocol_version && (*protocol_version == 1 ))
22592259 {
22602260 if (const auto bus_mode = driver.configure (*can_bitrate, false , detail::makeAcceptanceFilter<1 >({})))
22612261 {
0 commit comments