|
Open Model Railroad Network (OpenMRN)
|
Virtual node class for an OpenLCB train protocol node. More...
#include <TractionTrain.hxx>
Public Member Functions | |
| virtual TrainImpl * | train ()=0 |
| virtual bool | function_policy (NodeHandle src, uint8_t command_byte, uint32_t fnum, uint16_t value, Notifiable *done)=0 |
| Applies a policy to function change requests coming in from the OpenLCB bus. | |
| virtual void | command_hook (NodeHandle src, const Payload &p)=0 |
| Invoked for every incoming traction command targeted to this node. | |
| virtual NodeHandle | get_controller ()=0 |
| virtual void | set_controller (NodeHandle id)=0 |
| virtual bool | add_consist (NodeID tgt, uint8_t flags)=0 |
| Adds a node ID to the consist targets. | |
| virtual bool | remove_consist (NodeID tgt)=0 |
| Removes a node ID from the consist targets. | |
| virtual NodeID | query_consist (int id, uint8_t *flags)=0 |
| Fetch a given consist link. | |
| virtual int | query_consist_length ()=0 |
Public Member Functions inherited from openlcb::Node | |
| virtual NodeID | node_id ()=0 |
| virtual If * | iface ()=0 |
| virtual bool | is_initialized ()=0 |
| virtual void | set_initialized () |
| Callback from the node initialization flow when the node finished initialization. | |
| virtual void | clear_initialized ()=0 |
| Callback from the simple stack when the node has to return to uninitialized state. | |
| void | initialize () |
| Callback from the simple stack to start the initialization process. | |
Virtual node class for an OpenLCB train protocol node.
Usage:
for train implementations see LoggingTrain, dcc::Dcc28Train, dcc::MMNewTrain etc.
Definition at line 60 of file TractionTrain.hxx.
| openlcb::TrainNode::~TrainNode | ( | ) |
Definition at line 53 of file TractionTrain.cxx.
Adds a node ID to the consist targets.
| tgt | the destination of the consist link |
| flags | consisting flags from the Traction protocol. |
Implemented in openlcb::TrainNodeWithConsist.
|
pure virtual |
Invoked for every incoming traction command targeted to this node.
| src | what node sent this command |
| p | command payload |
Implemented in openlcb::TrainNodeWithConsist.
|
pure virtual |
Applies a policy to function change requests coming in from the OpenLCB bus.
If the policy returns false, the change will not be applied to the TrainImpl. This is used to implement consist function behavior.
| src | source node where the request came from. |
| command_byte | is the first byte of the payload (usually 0x01 or 0x81 depending on the REQ_LISTENER bit) |
| fnum | which function to set |
| value | what value to set this function to |
| done | must be notified inline if the policy application is successful. If not notified inline, then the returned value is ignored and the call is repeated after done has been invoked by the callee. |
Implemented in openlcb::TrainNodeWithConsist.
|
pure virtual |
Implemented in openlcb::DefaultTrainNode.
|
pure virtual |
Fetch a given consist link.
| id | zero-based index of consist links. |
| flags | retrieved consist link's flags go here. |
Implemented in openlcb::TrainNodeWithConsist.
|
pure virtual |
Implemented in openlcb::TrainNodeWithConsist.
Removes a node ID from the consist targets.
| tgt | destination of consist link to remove. |
Implemented in openlcb::TrainNodeWithConsist.
|
pure virtual |
| id | the controller node of this train. |
Implemented in openlcb::DefaultTrainNode.
|
pure virtual |
Implemented in openlcb::DefaultTrainNode.