libuav original

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

NodeStatusMonitor Class Reference

NodeStatusMonitor Class Reference

This class implements the core functionality of a network monitor. More...

#include <node_status_monitor.hpp>

Inherited by Monitor, and NodeInfoRetriever.

Public Member Functions

int start ()
 Starts the monitor.
void forgetNode (NodeID node_id)
 Make the node unknown.
void forgetAllNodes ()
 Make all nodes unknown.
NodeStatus getNodeStatus (NodeID node_id) const
 Returns status of a given node.
bool isNodeKnown (NodeID node_id) const
 Whether the class has observed this node at least once since initialization.
NodeID findNodeWithWorstHealth () const
 This helper method allows to quickly estimate the overall network health.
template<typename Operator >
void forEachNode (Operator op) const
 Calls the operator for every known node.

Protected Member Functions

virtual void handleNodeStatusChange (const NodeStatusChangeEvent &event)
 Called when a node becomes online, changes status or goes offline.
virtual void handleNodeStatusMessage (const ReceivedDataStructure< protocol::NodeStatus > &msg)
 Called for every received message uavcan.protocol.NodeStatus after handleNodeStatusChange(), even if the status code did not change.

Detailed Description

This class implements the core functionality of a network monitor.

It can be extended by inheritance to add more complex logic, or used directly as is.

Definition at line 22 of file node_status_monitor.hpp.


Member Function Documentation

NodeID findNodeWithWorstHealth (  ) const

This helper method allows to quickly estimate the overall network health.

Health of the local node is not considered. Returns an invalid Node ID value if there's no known nodes in the network.

Definition at line 274 of file node_status_monitor.hpp.

void forEachNode ( Operator  op ) const

Calls the operator for every known node.

Operator signature: void (NodeID, NodeStatus)

Definition at line 303 of file node_status_monitor.hpp.

void forgetAllNodes (  )

Make all nodes unknown.

Definition at line 223 of file node_status_monitor.hpp.

void forgetNode ( NodeID  node_id )

Make the node unknown.

Definition at line 207 of file node_status_monitor.hpp.

NodeStatus getNodeStatus ( NodeID  node_id ) const

Returns status of a given node.

Unknown nodes are considered offline. Complexity O(1).

Definition at line 236 of file node_status_monitor.hpp.

virtual void handleNodeStatusChange ( const NodeStatusChangeEvent &  event ) [protected, virtual]

Called when a node becomes online, changes status or goes offline.

Refer to uavcan.protocol.NodeStatus for the offline timeout value. Overriding is not required.

Definition at line 165 of file node_status_monitor.hpp.

virtual void handleNodeStatusMessage ( const ReceivedDataStructure< protocol::NodeStatus > &  msg ) [protected, virtual]

Called for every received message uavcan.protocol.NodeStatus after handleNodeStatusChange(), even if the status code did not change.

Overriding is not required.

Definition at line 175 of file node_status_monitor.hpp.

bool isNodeKnown ( NodeID  node_id ) const

Whether the class has observed this node at least once since initialization.

Complexity O(1).

Definition at line 259 of file node_status_monitor.hpp.

int start (  )

Starts the monitor.

Destroy the object to stop it. Returns negative error code.

Definition at line 193 of file node_status_monitor.hpp.