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

Default implementation of a train node. More...

#include <TractionTrain.hxx>

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

Public Member Functions

 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
virtual NodeID node_id ()=0
 
void initialize ()
 Callback from the simple stack to start the initialization process.
 

Protected Attributes

TrainServiceservice_
 Pointer to the traction service.
 
TrainImpltrain_
 Pointer to the train implementation object.
 

Private Attributes

unsigned isInitialized_: 1
 Node is initialized bit for startup transient.
 
NodeHandle controllerNodeId_
 Controller node that is assigned to run this train. 0 if none.
 

Additional Inherited Members

- Public Attributes inherited from openlcb::TrainNodeWithConsist
TypedQueue< ConsistEntryconsistSlaves_
 

Detailed Description

Default implementation of a train node.

Definition at line 258 of file TractionTrain.hxx.

Constructor & Destructor Documentation

◆ DefaultTrainNode()

openlcb::DefaultTrainNode::DefaultTrainNode ( TrainService service,
TrainImpl impl 
)

Definition at line 45 of file TractionTrain.cxx.

◆ ~DefaultTrainNode()

openlcb::DefaultTrainNode::~DefaultTrainNode ( )

Definition at line 65 of file TractionTrain.cxx.

Member Function Documentation

◆ clear_initialized()

void openlcb::DefaultTrainNode::clear_initialized ( )
inlineoverridevirtual

Callback from the simple stack when the node has to return to uninitialized state.

Implements openlcb::Node.

Definition at line 284 of file TractionTrain.hxx.

◆ get_controller()

NodeHandle openlcb::DefaultTrainNode::get_controller ( )
inlineoverridevirtual
Returns
the last stored controller node.

Implements openlcb::TrainNode.

Definition at line 264 of file TractionTrain.hxx.

◆ iface()

If * openlcb::DefaultTrainNode::iface ( )
overridevirtual

Implements openlcb::Node.

Definition at line 103 of file TractionTrain.cxx.

◆ is_initialized()

bool openlcb::DefaultTrainNode::is_initialized ( )
inlineoverridevirtual
Returns
true if the node is in the initialized state.

Nodes not in initialized state may not send traffic to the bus.

Implements openlcb::Node.

Definition at line 275 of file TractionTrain.hxx.

◆ set_controller()

void openlcb::DefaultTrainNode::set_controller ( NodeHandle  id)
inlineoverridevirtual
Parameters
idthe controller node of this train.

Implements openlcb::TrainNode.

Definition at line 269 of file TractionTrain.hxx.

◆ set_initialized()

void openlcb::DefaultTrainNode::set_initialized ( )
inlineoverridevirtual

Callback from the node initialization flow when the node finished initialization.

Nodes are not required to implement if they are not using NodeInitializationFlow.

Reimplemented from openlcb::Node.

Definition at line 279 of file TractionTrain.hxx.

◆ train()

TrainImpl * openlcb::DefaultTrainNode::train ( )
inlineoverridevirtual
Returns
the train implementation object for issuing control commands to this train.

Implements openlcb::TrainNode.

Definition at line 289 of file TractionTrain.hxx.

Member Data Documentation

◆ controllerNodeId_

NodeHandle openlcb::DefaultTrainNode::controllerNodeId_
private

Controller node that is assigned to run this train. 0 if none.

Definition at line 305 of file TractionTrain.hxx.

◆ isInitialized_

unsigned openlcb::DefaultTrainNode::isInitialized_
private

Node is initialized bit for startup transient.

Definition at line 302 of file TractionTrain.hxx.

◆ service_

TrainService* openlcb::DefaultTrainNode::service_
protected

Pointer to the traction service.

Definition at line 296 of file TractionTrain.hxx.

◆ train_

TrainImpl* openlcb::DefaultTrainNode::train_
protected

Pointer to the train implementation object.

Definition at line 298 of file TractionTrain.hxx.


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