Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::TrainNodeWithId Class Reference

Train node class with a fixed OpenLCB Node ID. More...

#include <TractionTrain.hxx>

Inheritance diagram for openlcb::TrainNodeWithId:
openlcb::DefaultTrainNode openlcb::TrainNodeWithConsist openlcb::TrainNode openlcb::Node

Public Member Functions

 TrainNodeWithId (TrainService *service, TrainImpl *train, NodeID node_id)
 Constructor.
 
 ~TrainNodeWithId ()
 Destructor.
 
NodeID node_id () OVERRIDE
 
- Public Member Functions inherited from openlcb::DefaultTrainNode
 DefaultTrainNode (TrainService *service, TrainImpl *impl)
 
NodeHandle get_controller () override
 
void set_controller (NodeHandle id) override
 
Ififace () override
 
bool is_initialized () override
 
void set_initialized () override
 Callback from the node initialization flow when the node finished initialization.
 
void clear_initialized () override
 Callback from the simple stack when the node has to return to uninitialized state.
 
TrainImpltrain () override
 
- Public Member Functions inherited from openlcb::TrainNodeWithConsist
bool function_policy (NodeHandle src, uint8_t command_byte, uint32_t fnum, uint16_t value, Notifiable *done) override
 Applies a policy to function change requests coming in from the OpenLCB bus.
 
void command_hook (NodeHandle src, const Payload &p) override
 Invoked for every incoming traction command targeted to this node.
 
bool add_consist (NodeID tgt, uint8_t flags) override
 Adds a node ID to the consist targets.
 
bool remove_consist (NodeID tgt) override
 Removes a node ID from the consist targets.
 
NodeID query_consist (int id, uint8_t *flags) override
 Returns the consist target with offset id, or NodeID(0) if there are fewer than id consist targets.
 
int query_consist_length () override
 Returns the number of slaves in this consist.
 
- Public Member Functions inherited from openlcb::Node
void initialize ()
 Callback from the simple stack to start the initialization process.
 

Private Attributes

NodeID nodeId_
 The OpenLCB node ID.
 

Additional Inherited Members

- Public Attributes inherited from openlcb::TrainNodeWithConsist
TypedQueue< ConsistEntryconsistSlaves_
 
- Protected Attributes inherited from openlcb::DefaultTrainNode
TrainServiceservice_
 Pointer to the traction service.
 
TrainImpltrain_
 Pointer to the train implementation object.
 

Detailed Description

Train node class with a fixed OpenLCB Node ID.

This is useful for native train nodes that are not dynamically generated by a command station.

Definition at line 328 of file TractionTrain.hxx.

Constructor & Destructor Documentation

◆ TrainNodeWithId()

openlcb::TrainNodeWithId::TrainNodeWithId ( TrainService service,
TrainImpl train,
NodeID  node_id 
)

Constructor.

Parameters
servicethe traction service object that will own this node.
trainthe implementation object that the traction messages should be forwarded to.
node_idthe OpenLCB node ID for this train.

Definition at line 82 of file TractionTrain.cxx.

◆ ~TrainNodeWithId()

openlcb::TrainNodeWithId::~TrainNodeWithId ( )

Destructor.

Todo:
enable this line of code. It currently breaks unit tests due to bugs

Definition at line 90 of file TractionTrain.cxx.

Member Function Documentation

◆ node_id()

NodeID openlcb::TrainNodeWithId::node_id ( )
inlinevirtual
Returns
the openlcb node ID.

Implements openlcb::Node.

Definition at line 342 of file TractionTrain.hxx.

Member Data Documentation

◆ nodeId_

NodeID openlcb::TrainNodeWithId::nodeId_
private

The OpenLCB node ID.

Definition at line 349 of file TractionTrain.hxx.


The documentation for this class was generated from the following files: