Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: UAVCAN UAVCAN_Subscriber
Node< MemPoolSize > Class Template Reference
This is the top-level node API. More...
#include <node.hpp>
Inherits uavcan::INode.
Public Member Functions | |
| Node (ICanDriver &can_driver, ISystemClock &system_clock) | |
| This overload is only valid if MemPoolSize > 0. | |
| Node (ICanDriver &can_driver, ISystemClock &system_clock, IPoolAllocator &allocator) | |
| This overload is only valid if MemPoolSize == 0. | |
| int | spin (MonotonicTime deadline) |
| Same as spin(MonotonicDuration), but the deadline is specified as an absolute time value rather than duration. | |
| int | spin (MonotonicDuration duration) |
| Runs the node. | |
| int | spinOnce () |
| This method is designed for non-blocking applications. | |
| int | start (const TransferPriority node_status_transfer_priority=TransferPriority::Default) |
| Starts the node and publishes uavcan.protocol.NodeStatus immediately. | |
| const NodeStatusProvider::NodeName & | getName () const |
| Gets/sets the node name, e.g. | |
| void | setHealthOk () |
| Node health code helpers. | |
| void | setModeOperational () |
| Node mode code helpers. | |
| void | setVendorSpecificStatusCode (NodeStatusProvider::VendorSpecificStatusCode code) |
| Updates the vendor-specific status code. | |
| void | setSoftwareVersion (const protocol::SoftwareVersion &version) |
| Gets/sets the node version information. | |
| void | setRestartRequestHandler (IRestartRequestHandler *handler) |
| Restart handler can be installed to handle external node restart requests (highly recommended). | |
| Logger & | getLogger () |
| Use this method to configure logging. | |
| NodeID | getNodeID () const |
| Returns the Node ID of this node. | |
| bool | setNodeID (NodeID nid) |
| Sets the Node ID of this node. | |
| bool | isPassiveMode () const |
| Whether the node is in passive mode, i.e. | |
| int | injectTxFrame (const CanFrame &frame, MonotonicTime tx_deadline, uint8_t iface_mask, CanTxQueue::Qos qos=CanTxQueue::Volatile, CanIOFlags flags=0) |
| This method allows to directly transmit a raw CAN frame circumventing the whole UAVCAN stack. | |
| void | removeRxFrameListener () |
| The IRxFrameListener interface allows one to monitor all incoming CAN frames. | |
| template<typename... Args> | |
| void | logDebug (const char *source, const char *format, Args...args) |
| Node logging. | |
Detailed Description
template<std::size_t MemPoolSize = 0>
class uavcan::Node< MemPoolSize >
This is the top-level node API.
A custom node class can be implemented if needed, in which case it shall inherit INode.
- Template Parameters:
-
MemPoolSize Size of memory pool for this node, in bytes. Please refer to the documentation for details. If this value is zero, the constructor will accept a reference to user-provided allocator.
Definition at line 38 of file node.hpp.
Constructor & Destructor Documentation
| Node | ( | ICanDriver & | can_driver, |
| ISystemClock & | system_clock | ||
| ) |
| Node | ( | ICanDriver & | can_driver, |
| ISystemClock & | system_clock, | ||
| IPoolAllocator & | allocator | ||
| ) |
Member Function Documentation
| Logger& getLogger | ( | ) |
| const NodeStatusProvider::NodeName& getName | ( | ) | const |
| NodeID getNodeID | ( | ) | const [inherited] |
Returns the Node ID of this node.
If Node ID was not set yet, an invalid value will be returned.
Definition at line 39 of file abstract_node.hpp.
| int injectTxFrame | ( | const CanFrame & | frame, |
| MonotonicTime | tx_deadline, | ||
| uint8_t | iface_mask, | ||
| CanTxQueue::Qos | qos = CanTxQueue::Volatile, |
||
| CanIOFlags | flags = 0 |
||
| ) | [inherited] |
This method allows to directly transmit a raw CAN frame circumventing the whole UAVCAN stack.
Mandatory parameters:
- Parameters:
-
frame CAN frame to be transmitted. tx_deadline The frame will be discarded if it could not be transmitted by this time. iface_mask This bitmask allows to select what CAN interfaces this frame should go into. Example: - 1 - the frame will be sent only to iface 0.
- 4 - the frame will be sent only to iface 2.
- 3 - the frame will be sent to ifaces 0 and 1.
Optional parameters:
- Parameters:
-
qos Quality of service. Please refer to the CAN IO manager for details. flags CAN IO flags. Please refer to the CAN driver API for details.
Definition at line 111 of file abstract_node.hpp.
| bool isPassiveMode | ( | ) | const [inherited] |
Whether the node is in passive mode, i.e.
can't transmit anything to the bus. Please read the specs to learn more.
Definition at line 57 of file abstract_node.hpp.
| void logDebug | ( | const char * | source, |
| const char * | format, | ||
| Args... | args | ||
| ) |
| void removeRxFrameListener | ( | ) | [inherited] |
The IRxFrameListener interface allows one to monitor all incoming CAN frames.
This feature can be used to implement multithreaded nodes, or to add secondary protocol support.
Definition at line 123 of file abstract_node.hpp.
| void setModeOperational | ( | ) |
| bool setNodeID | ( | NodeID | nid ) | [inherited] |
Sets the Node ID of this node.
Node ID can be assigned only once. This method returns true if the Node ID was successfully assigned, otherwise it returns false. As long as a valid Node ID is not set, the node will remain in passive mode. Using a non-unicast Node ID puts the node into passive mode (as default).
Definition at line 48 of file abstract_node.hpp.
| void setRestartRequestHandler | ( | IRestartRequestHandler * | handler ) |
| void setSoftwareVersion | ( | const protocol::SoftwareVersion & | version ) |
| void setVendorSpecificStatusCode | ( | NodeStatusProvider::VendorSpecificStatusCode | code ) |
| int spin | ( | MonotonicDuration | duration ) |
| int spin | ( | MonotonicTime | deadline ) |
Same as spin(MonotonicDuration), but the deadline is specified as an absolute time value rather than duration.
Reimplemented from INode.
| int spinOnce | ( | ) |
This method is designed for non-blocking applications.
Instead of blocking, it returns immediately once all available CAN frames and timer events are processed. Note that this is unlike plain spin(), which will strictly return when the deadline is reached, even if there still are unprocessed events. This method returns 0 if no errors occurred, or a negative error code if something failed (see error.hpp).
Reimplemented from INode.
| int start | ( | const TransferPriority | node_status_transfer_priority = TransferPriority::Default ) |
Starts the node and publishes uavcan.protocol.NodeStatus immediately.
Does not so anything if the node is already started. Once started, the node can't stop. If the node failed to start up, it's recommended to destroy the current node instance and start over. Returns negative error code.
- Parameters:
-
node_status_transfer_priority Transfer priority that will be used for outgoing NodeStatus messages. Normal priority is used by default.
Generated on Tue Jul 12 2022 17:17:37 by
1.7.2