|
Open Model Railroad Network (OpenMRN)
|
This class helps establishing a list of all (live) nodes on the network. More...
#include <NodeBrowser.hxx>
Classes | |
| class | VerifiedHandler |
| Helper class to register in the dispatcher. More... | |
Public Types | |
| typedef std::function< void(NodeID n)> | CallbackFunction |
| Function prototype for the callback. | |
Public Member Functions | |
| NodeBrowser (Node *node, CallbackFunction cb) | |
| Constructor. | |
| ~NodeBrowser () | |
| Destructor. | |
| void | refresh () |
| Requests a pong from every live node. | |
Private Member Functions | |
| void | register_callbacks () |
| Register with the interface for messages we want to listen to. | |
| void | unregister_callbacks () |
| Remove callbacks from the interface. | |
Private Attributes | |
| Node * | node_ |
| Me-node. | |
| VerifiedHandler | handler_ {this} |
| Callback registerd in the interface. | |
| CallbackFunction | callback_ |
| Client callback for live or new nodes. | |
Friends | |
| class | VerifiedHandler |
This class helps establishing a list of all (live) nodes on the network.
Useful for configuration tools.
Definition at line 46 of file NodeBrowser.hxx.
| typedef std::function<void(NodeID n)> openlcb::NodeBrowser::CallbackFunction |
Function prototype for the callback.
This function will be called on the interface's executor.
| n | the node id of the discovered remote node. |
Definition at line 52 of file NodeBrowser.hxx.
| openlcb::NodeBrowser::NodeBrowser | ( | Node * | node, |
| CallbackFunction | cb | ||
| ) |
Constructor.
| node | is the current node, from which we can send traffic to the bus. |
| cb | will be called for each newly arriving node, and for each existing node after the refresh command is executed. |
Definition at line 39 of file NodeBrowser.cxx.
| openlcb::NodeBrowser::~NodeBrowser | ( | ) |
Destructor.
After calling it is guaranteed not to receive any more callbacks.
Definition at line 46 of file NodeBrowser.cxx.
| void openlcb::NodeBrowser::refresh | ( | ) |
Requests a pong from every live node.
This function will return immediately, then callbacks will be called for each reply that arrives.
Definition at line 51 of file NodeBrowser.cxx.
|
private |
Register with the interface for messages we want to listen to.
Definition at line 59 of file NodeBrowser.cxx.
|
private |
Remove callbacks from the interface.
Definition at line 67 of file NodeBrowser.cxx.
|
friend |
Definition at line 84 of file NodeBrowser.hxx.
|
private |
Client callback for live or new nodes.
Definition at line 95 of file NodeBrowser.hxx.
|
private |
Callback registerd in the interface.
Definition at line 93 of file NodeBrowser.hxx.
|
private |
Me-node.
Definition at line 91 of file NodeBrowser.hxx.