diff --git a/libuavcan/include/uavcan/protocol/dynamic_node_id_server/allocation_request_manager.hpp b/libuavcan/include/uavcan/protocol/dynamic_node_id_server/allocation_request_manager.hpp index b68a7005d6..ae85348d2f 100644 --- a/libuavcan/include/uavcan/protocol/dynamic_node_id_server/allocation_request_manager.hpp +++ b/libuavcan/include/uavcan/protocol/dynamic_node_id_server/allocation_request_manager.hpp @@ -51,6 +51,7 @@ class AllocationRequestManager const MonotonicDuration stage_timeout_; MonotonicTime last_message_timestamp_; + MonotonicTime last_activity_timestamp_; Allocation::FieldTypes::unique_id current_unique_id_; IAllocationRequestHandler& handler_; @@ -127,6 +128,7 @@ class AllocationRequestManager void handleAllocation(const ReceivedDataStructure& msg) { trace(TraceAllocationActivity, msg.getSrcNodeID().get()); + last_activity_timestamp_ = msg.getMonotonicTimestamp(); if (!msg.isAnonymousTransfer()) { @@ -269,6 +271,12 @@ public: return allocation_pub_.broadcast(msg); } + + /** + * When the last allocation activity was registered. + * This value can be used to heuristically determine whether there are any unallocated nodes left in the network. + */ + MonotonicTime getTimeOfLastAllocationActivity() const { return last_activity_timestamp_; } }; }