libuav original
Dependents: UAVCAN UAVCAN_Subscriber
DynamicNodeIDClient Class Reference
This class implements client-side logic of dynamic node ID allocation procedure. More...
#include <dynamic_node_id_client.hpp>
Inherits uavcan::TimerBase.
Public Member Functions | |
int | start (const UniqueID &unique_id, const NodeID preferred_node_id=NodeID::Broadcast, const TransferPriority transfer_priority=TransferPriority::OneHigherThanLowest) |
bool | isAllocationComplete () const |
Use this method to determine when allocation is complete. | |
NodeID | getAllocatedNodeID () const |
This method allows to retrieve the node ID that was allocated to the local node. | |
NodeID | getAllocatorNodeID () const |
This method allows to retrieve node ID of the allocator that granted our Node ID. | |
Private Member Functions | |
void | startOneShotWithDeadline (MonotonicTime deadline) |
Various ways to start the timer - periodically or once. | |
MonotonicDuration | getPeriod () const |
Returns period if the timer is in periodic mode. |
Detailed Description
This class implements client-side logic of dynamic node ID allocation procedure.
Once started, the object will be publishing dynamic node ID allocation requests at the default frequency defined by the specification, until a Node ID is granted by the allocator.
If the local node is equipped with redundant CAN interfaces, all of them will be used for publishing requests and listening for responses.
Once dynamic allocation is complete (or not needed anymore), the object can be deleted.
Note that this class uses std::rand(), which must be correctly seeded before use.
Definition at line 31 of file dynamic_node_id_client.hpp.
Member Function Documentation
NodeID getAllocatedNodeID | ( | ) | const |
This method allows to retrieve the node ID that was allocated to the local node.
If no node ID was allocated yet, the returned node ID will be invalid (non-unicast).
- Returns:
- If allocation is complete, a valid unicast node ID will be returned. If allocation is not complete yet, a non-unicast node ID will be returned.
Definition at line 99 of file dynamic_node_id_client.hpp.
NodeID getAllocatorNodeID | ( | ) | const |
This method allows to retrieve node ID of the allocator that granted our Node ID.
If no node ID was allocated yet, the returned node ID will be invalid (non-unicast).
- Returns:
- If allocation is complete, a valid unicast node ID will be returned. If allocation is not complete yet, an non-unicast node ID will be returned.
Definition at line 107 of file dynamic_node_id_client.hpp.
bool isAllocationComplete | ( | ) | const |
Use this method to determine when allocation is complete.
Definition at line 91 of file dynamic_node_id_client.hpp.
int start | ( | const UniqueID & | unique_id, |
const NodeID | preferred_node_id = NodeID::Broadcast , |
||
const TransferPriority | transfer_priority = TransferPriority::OneHigherThanLowest |
||
) |
- Parameters:
-
unique_id Unique ID of the local node. Must be the same as in the hardware version struct. preferred_node_id Node ID that the application would like to take; set to broadcast (zero) if the application doesn't have any preference (this is default). transfer_priority Transfer priority, Normal by default.
- Returns:
- Zero on success Negative error code on failure -ErrLogic if 1. the node is not in passive mode or 2. the client is already started
Definition at line 147 of file uc_dynamic_node_id_client.cpp.
Generated on Tue Jul 12 2022 17:17:37 by 1.7.2