Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::TrainImpl Class Referenceabstract

Abstract base class for train implementations. More...

#include <TrainInterface.hxx>

Inheritance diagram for openlcb::TrainImpl:
dcc::PacketSource openlcb::LoggingTrain openlcb::MockTrain openlcb::TractionThrottleInterface traction_modem::ModemTrain dcc::AbstractTrain< Payload > dcc::AbstractTrain< MMNewPayload > dcc::AbstractTrain< MMOldPayload > dcc::AbstractTrain< P > dcc::NonTrainPacketSource openlcb::TractionThrottleBase dcc::DccTrain< Payload > dcc::MMNewTrain dcc::MMOldTrain ProgrammingTrackBackend openlcb::TractionThrottle

Public Member Functions

virtual void set_speed (SpeedType speed)=0
 Sets the speed of the locomotive.
 
virtual SpeedType get_speed ()=0
 
virtual SpeedType get_commanded_speed ()
 
virtual SpeedType get_actual_speed ()
 Returns the actual speed of the locomotive, as provided by feedback from the decoder.
 
virtual void set_emergencystop ()=0
 Sets the train to emergency stop.
 
virtual bool get_emergencystop ()=0
 Get the current E-Stop state.
 
virtual void set_fn (uint32_t address, uint16_t value)=0
 Sets the value of a function.
 
virtual uint16_t get_fn (uint32_t address)=0
 
virtual uint32_t legacy_address ()=0
 
virtual dcc::TrainAddressType legacy_address_type ()=0
 

Detailed Description

Abstract base class for train implementations.

This interface links the OpenLCB trains to the dcc packet sources.

Definition at line 50 of file TrainInterface.hxx.

Constructor & Destructor Documentation

◆ ~TrainImpl()

virtual openlcb::TrainImpl::~TrainImpl ( )
inlinevirtual

Definition at line 53 of file TrainInterface.hxx.

Member Function Documentation

◆ get_actual_speed()

virtual SpeedType openlcb::TrainImpl::get_actual_speed ( )
inlinevirtual

Returns the actual speed of the locomotive, as provided by feedback from the decoder.

Definition at line 68 of file TrainInterface.hxx.

◆ get_commanded_speed()

virtual SpeedType openlcb::TrainImpl::get_commanded_speed ( )
inlinevirtual
Returns
the commanded speed of the locomotive.

Reimplemented in dcc::AbstractTrain< P >, dcc::AbstractTrain< MMNewPayload >, dcc::AbstractTrain< MMOldPayload >, and dcc::AbstractTrain< Payload >.

Definition at line 63 of file TrainInterface.hxx.

◆ get_emergencystop()

virtual bool openlcb::TrainImpl::get_emergencystop ( )
pure virtual

◆ get_fn()

virtual uint16_t openlcb::TrainImpl::get_fn ( uint32_t  address)
pure virtual

◆ get_speed()

◆ legacy_address()

virtual uint32_t openlcb::TrainImpl::legacy_address ( )
pure virtual
Returns
the legacy (DCC) address of this train. This value is used in determining the train's NMRAnet NodeID.
Todo:
(balazs.racz) This function should not be here. Specifying the NodeID should be more generic, but it is not clear what would be the best interface for that.

Implemented in dcc::AbstractTrain< P >, dcc::AbstractTrain< MMNewPayload >, dcc::AbstractTrain< MMOldPayload >, dcc::AbstractTrain< Payload >, dcc::NonTrainPacketSource, openlcb::LoggingTrain, openlcb::TractionThrottle, and traction_modem::ModemTrain.

◆ legacy_address_type()

◆ set_emergencystop()

◆ set_fn()

virtual void openlcb::TrainImpl::set_fn ( uint32_t  address,
uint16_t  value 
)
pure virtual

Sets the value of a function.

Parameters
addressis a 24-bit address of the function to set. For legacy DCC locomotives, see TractionDefs for the address definitions (0=light, 1-28= traditional function buttons).
valueis the function value. For binary functions, any non-zero value sets the function to on, zero sets it to off.

Implemented in dcc::AbstractTrain< P >, dcc::AbstractTrain< MMNewPayload >, dcc::AbstractTrain< MMOldPayload >, dcc::AbstractTrain< Payload >, dcc::NonTrainPacketSource, openlcb::LoggingTrain, openlcb::TractionThrottle, and traction_modem::ModemTrain.

◆ set_speed()

virtual void openlcb::TrainImpl::set_speed ( SpeedType  speed)
pure virtual

Sets the speed of the locomotive.

Parameters
speedis the requested scale speed in m/s. The sign of the number means the direction.

Implemented in traction_modem::ModemTrain, dcc::AbstractTrain< P >, dcc::AbstractTrain< MMNewPayload >, dcc::AbstractTrain< MMOldPayload >, dcc::AbstractTrain< Payload >, dcc::NonTrainPacketSource, openlcb::LoggingTrain, and openlcb::TractionThrottle.


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