Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
dcc::NonTrainPacketSource Class Reference

Abstract class that is a packet source but not a TrainImpl. More...

#include <PacketSource.hxx>

Inheritance diagram for dcc::NonTrainPacketSource:
dcc::PacketSource openlcb::TrainImpl ProgrammingTrackBackend

Private Member Functions

void set_speed (SpeedType speed) override
 Sets the speed of the locomotive.
 
SpeedType get_speed () override
 
void set_emergencystop () override
 Sets the train to emergency stop.
 
bool get_emergencystop () override
 Get the current E-Stop state.
 
void set_fn (uint32_t address, uint16_t value) override
 Sets the value of a function.
 
uint16_t get_fn (uint32_t address) override
 
uint32_t legacy_address () override
 
dcc::TrainAddressType legacy_address_type () override
 

Additional Inherited Members

- Public Member Functions inherited from dcc::PacketSource
virtual void get_next_packet (unsigned code, Packet *packet)=0
 Generates the next packet to send out to the track.
 
- Public Member Functions inherited from openlcb::TrainImpl
virtual SpeedType get_commanded_speed ()
 
virtual SpeedType get_actual_speed ()
 Returns the actual speed of the locomotive, as provided by feedback from the decoder.
 

Detailed Description

Abstract class that is a packet source but not a TrainImpl.

Provides dummy implementations for the TrainImpl interface virtual functions.

Definition at line 63 of file PacketSource.hxx.

Member Function Documentation

◆ get_emergencystop()

bool dcc::NonTrainPacketSource::get_emergencystop ( )
inlineoverrideprivatevirtual

Get the current E-Stop state.

Returns
true if the train is E-Stopped, else false

Implements openlcb::TrainImpl.

Definition at line 76 of file PacketSource.hxx.

◆ get_fn()

uint16_t dcc::NonTrainPacketSource::get_fn ( uint32_t  address)
inlineoverrideprivatevirtual
Returns
the value of a function.

Implements openlcb::TrainImpl.

Definition at line 83 of file PacketSource.hxx.

◆ get_speed()

SpeedType dcc::NonTrainPacketSource::get_speed ( )
inlineoverrideprivatevirtual
Returns
the last set speed of the locomotive.

Implements openlcb::TrainImpl.

Definition at line 69 of file PacketSource.hxx.

◆ legacy_address()

uint32_t dcc::NonTrainPacketSource::legacy_address ( )
inlineoverrideprivatevirtual
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.

Implements openlcb::TrainImpl.

Definition at line 87 of file PacketSource.hxx.

◆ legacy_address_type()

dcc::TrainAddressType dcc::NonTrainPacketSource::legacy_address_type ( )
inlineoverrideprivatevirtual
Returns
the type of legacy protocol in use.

Implements openlcb::TrainImpl.

Definition at line 91 of file PacketSource.hxx.

◆ set_emergencystop()

void dcc::NonTrainPacketSource::set_emergencystop ( )
inlineoverrideprivatevirtual

Sets the train to emergency stop.

Implements openlcb::TrainImpl.

Definition at line 73 of file PacketSource.hxx.

◆ set_fn()

void dcc::NonTrainPacketSource::set_fn ( uint32_t  address,
uint16_t  value 
)
inlineoverrideprivatevirtual

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.

Implements openlcb::TrainImpl.

Definition at line 80 of file PacketSource.hxx.

◆ set_speed()

void dcc::NonTrainPacketSource::set_speed ( SpeedType  speed)
inlineoverrideprivatevirtual

Sets the speed of the locomotive.

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

Implements openlcb::TrainImpl.

Definition at line 66 of file PacketSource.hxx.


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