|
Open Model Railroad Network (OpenMRN)
|
Specialized (DCC protocol) implementation of a DCC accessory consumer. More...
#include <DccAccyConsumer.hxx>
Public Member Functions | |
| DccAccyConsumer (Node *node, dcc::TrackIf *track) | |
| Constructs a listener for DCC accessory control. | |
| ~DccAccyConsumer () | |
| Destructor. | |
Public Member Functions inherited from openlcb::SimpleEventHandler | |
| IGNOREFN (handle_event_report) | |
| IGNOREFN (handle_consumer_identified) | |
| IGNOREFN (handle_consumer_range_identified) | |
| IGNOREFN (handle_producer_identified) | |
| IGNOREFN (handle_producer_range_identified) | |
| IGNOREFN (handle_identify_consumer) | |
| IGNOREFN (handle_identify_producer) | |
Public Member Functions inherited from openlcb::EventHandler | |
| virtual void | handle_consumer_identified (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) |
| Called on another node sending ConsumerIdentified for this event. | |
| virtual void | handle_consumer_range_identified (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) |
| Called on another node sending ConsumerRangeIdentified. | |
| virtual void | handle_producer_identified (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) |
| Called on another node sending ProducerIdentified for this event. | |
| virtual void | handle_producer_range_identified (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) |
| Called on another node sending ProducerRangeIdentified for this event. | |
| virtual void | handle_identify_producer (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done)=0 |
| Called on another node sending IdentifyProducer. | |
Private Member Functions | |
| void | send_accy_command () override |
| Send the actual accessory command. | |
Private Attributes | |
| dcc::TrackIf * | track_ |
| Track to send DCC packets to. | |
Additional Inherited Members | |
Public Types inherited from openlcb::EventHandler | |
| using | EventReport = openlcb::EventReport |
| using | EventRegistryEntry = openlcb::EventRegistryEntry |
| using | EventId = openlcb::EventId |
Protected Member Functions inherited from openlcb::DccAccyConsumerBase | |
| DccAccyConsumerBase (Node *node) | |
| Constructs a listener for DCC accessory control. | |
| ~DccAccyConsumerBase () | |
| Destructor. | |
| void | handle_identify_global (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) OVERRIDE |
| Called on the need of sending out identification messages. | |
| void | handle_event_report (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) override |
| Called on incoming EventReport messages. | |
| void | handle_identify_consumer (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override |
| Called on another node sending IdentifyConsumer. | |
| bool | parse_event (EventId event) |
| Parses an event into an openlcb accessory offset. | |
Protected Attributes inherited from openlcb::DccAccyConsumerBase | |
| unsigned | onOff_: 1 |
| Parsed event state: 1 = activate (C=1), 2 = deactivate (C=0). | |
| unsigned | normalReverse_: 1 |
| Parsed event state: 1 = normal (D0=1), 0 = reversed (D0=0). | |
| unsigned | dccAddress_: 12 |
| Parsed event state: dcc address (0..4095) without inverting or encoding. | |
| unsigned | eventOfs_: 6 |
| Parsed event state: offset in the state_ array. | |
| unsigned | eventMask_: 5 |
| Parsed event state: bit index (0..31) in the uint32 in the state_ array entry pointed to by eventOfs_. | |
| uint32_t | lastSetState_ [64] |
| each bit determines what the last command sent to the accessory address was. | |
| uint32_t | isStateKnown_ [64] |
| each bit determines whether we've sent a command to that accessory address yet or not. | |
| Node * | node_ |
| OpenLCB node to export the consumer on. | |
Specialized (DCC protocol) implementation of a DCC accessory consumer.
Definition at line 229 of file DccAccyConsumer.hxx.
|
inline |
Constructs a listener for DCC accessory control.
| node | is the virtual node that will be listening for events and responding to Identify messages. |
| track | is the interface through which we will be writing DCC accessory packets. |
Definition at line 237 of file DccAccyConsumer.hxx.
|
inline |
Destructor.
Definition at line 244 of file DccAccyConsumer.hxx.
|
inlineoverrideprivatevirtual |
Send the actual accessory command.
Implements openlcb::DccAccyConsumerBase.
Definition at line 250 of file DccAccyConsumer.hxx.
|
private |
Track to send DCC packets to.
Definition at line 260 of file DccAccyConsumer.hxx.