Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
PacketSource.hxx
Go to the documentation of this file.
1
36#ifndef _DCC_PACKETSOURCE_HXX_
37#define _DCC_PACKETSOURCE_HXX_
38
40
41namespace dcc {
42
43struct Packet;
46
52public:
58 virtual void get_next_packet(unsigned code, Packet* packet) = 0;
59};
60
64{
65private:
66 void set_speed(SpeedType speed) override
67 {
68 }
70 {
71 return SpeedType();
72 }
73 void set_emergencystop() override
74 {
75 }
76 bool get_emergencystop() override
77 {
78 return false;
79 }
80 void set_fn(uint32_t address, uint16_t value) override
81 {
82 }
83 uint16_t get_fn(uint32_t address) override
84 {
85 return 0;
86 }
87 uint32_t legacy_address() override
88 {
89 return 0;
90 }
92 {
93 return dcc::TrainAddressType::DCC_SHORT_ADDRESS;
94 }
95};
96
97} // namespace dcc
98
99
100#endif // _DCC_PACKETSOURCE_HXX_
Abstract class that is a packet source but not a TrainImpl.
uint32_t legacy_address() override
bool get_emergencystop() override
Get the current E-Stop state.
void set_speed(SpeedType speed) override
Sets the speed of the locomotive.
uint16_t get_fn(uint32_t address) override
void set_emergencystop() override
Sets the train to emergency stop.
void set_fn(uint32_t address, uint16_t value) override
Sets the value of a function.
dcc::TrainAddressType legacy_address_type() override
SpeedType get_speed() override
Abstract class for streams of DCC packets.
virtual void get_next_packet(unsigned code, Packet *packet)=0
Generates the next packet to send out to the track.
Abstract base class for train implementations.
This class provides a mechanism for working with velocity in different forms.
Definition Velocity.hxx:73
TrainAddressType
Which address type this legacy train node uses.
Definition dcc/Defs.hxx:46
Represents a command to be sent to the track driver.
Definition Packet.hxx:52