Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
dcc::PacketSource Class Referenceabstract

Abstract class for streams of DCC packets. More...

#include <PacketSource.hxx>

Inheritance diagram for dcc::PacketSource:
openlcb::TrainImpl dcc::AbstractTrain< Payload > dcc::AbstractTrain< MMNewPayload > dcc::AbstractTrain< MMOldPayload > dcc::AbstractTrain< P > dcc::NonTrainPacketSource dcc::DccTrain< Payload > dcc::MMNewTrain dcc::MMOldTrain ProgrammingTrackBackend

Public Member Functions

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 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 class for streams of DCC packets.

there will be typically one object of a child type for every decoder on the track voltage that needs an infinite set of repeating packets. This interface will be polled in a round-robin manner by the UpdateLoopBase.

Definition at line 51 of file PacketSource.hxx.

Member Function Documentation

◆ get_next_packet()

virtual void dcc::PacketSource::get_next_packet ( unsigned  code,
Packet packet 
)
pure virtual

Generates the next packet to send out to the track.

Parameters
codeif 0, then the next background refresh packet shold be generated. If non-zero, then it specifies a train-specific value that tells which recently changed value should be generated.
packetis the storage to set the outgoing packet in.

Implemented in ProgrammingTrackBackend, dcc::DccTrain< Payload >, dcc::MMOldTrain, and dcc::MMNewTrain.


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