|
Open Model Railroad Network (OpenMRN)
|
Base (generic protocol) implementation of the DCC extended accessory consumer. More...
#include <DccAccyConsumer.hxx>
Protected Member Functions | |
| DccExtAccyConsumerBase (Node *node) | |
| Constructs a listener for DCC extended accessory control. | |
| ~DccExtAccyConsumerBase () | |
| 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. | |
| virtual void | send_accy_command ()=0 |
| Send the actual accessory command. | |
| bool | parse_event (EventId event) |
| Parses an event into an openlcb accessory offset. | |
Protected Attributes | |
| unsigned | dccAddress_: 11 |
| Parsed event state: dcc address (0..2047) without inverting or encoding. | |
| unsigned | aspect_: 8 |
| Parsed event state: the aspect commanded. | |
| Node * | node_ |
| OpenLCB node to export the consumer on. | |
Static Protected Attributes | |
| static constexpr unsigned | NUM_ADDRESS = 2048 |
| How may addresses are there for extended accessories. | |
| static constexpr unsigned | NUM_ASPECT = 256 |
| How may aspects are supported per accessory. | |
| static constexpr unsigned | NUM_EVENT = NUM_ASPECT * NUM_ADDRESS |
| Total number of events we are listening for. | |
Additional Inherited Members | |
Public Types inherited from openlcb::EventHandler | |
| using | EventReport = openlcb::EventReport |
| using | EventRegistryEntry = openlcb::EventRegistryEntry |
| using | EventId = openlcb::EventId |
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. | |
Base (generic protocol) implementation of the DCC extended accessory consumer.
Unlike the basic accessory version, this one does not remember the last set state.
Definition at line 266 of file DccAccyConsumer.hxx.
|
inlineprotected |
Constructs a listener for DCC extended accessory control.
| node | is the virtual node that will be listening for events and responding to Identify messages. |
Definition at line 279 of file DccAccyConsumer.hxx.
|
inlineprotected |
Destructor.
Definition at line 289 of file DccAccyConsumer.hxx.
|
inlineoverrideprotectedvirtual |
Called on incoming EventReport messages.
| event | stores information about the incoming message. Filled: src_node, event. Mask is always 1 (filled in). state is not filled in. |
| registry_entry | gives the registry entry for which the current handler is being called. |
| done | must be notified when the processing is done. |
Implements openlcb::EventHandler.
Definition at line 309 of file DccAccyConsumer.hxx.
|
inlineoverrideprotectedvirtual |
Called on another node sending IdentifyConsumer.
| event | stores information about the incoming message. Filled: src_node, event, mask=1. Not filled: state. |
| registry_entry | gives the registry entry for which the current handler is being called. |
| done | must be notified when the processing is done. |
Implements openlcb::EventHandler.
Definition at line 320 of file DccAccyConsumer.hxx.
|
inlineprotectedvirtual |
Called on the need of sending out identification messages.
| event | is NULL. This happens on startup, or when a global or addressed IdentifyGlobal message arrives. Might have destination node id! |
| registry_entry | gives the registry entry for which the current handler is being called. |
| done | must be notified when the processing is done. |
Implements openlcb::EventHandler.
Definition at line 294 of file DccAccyConsumer.hxx.
|
inlineprotected |
Parses an event into an openlcb accessory offset.
| on_off | will be set to true if this is an activate event, false if it is an inactivate event. |
| ofs | will be set to the offset in the state_ arrays. |
| mask | will be set to a single bit value that marks the location in the state_ arrays. |
Definition at line 344 of file DccAccyConsumer.hxx.
|
protectedpure virtual |
Send the actual accessory command.
Implemented in openlcb::DccExtAccyConsumer.
|
protected |
Parsed event state: the aspect commanded.
Definition at line 364 of file DccAccyConsumer.hxx.
|
protected |
Parsed event state: dcc address (0..2047) without inverting or encoding.
Definition at line 362 of file DccAccyConsumer.hxx.
|
protected |
OpenLCB node to export the consumer on.
Definition at line 367 of file DccAccyConsumer.hxx.
|
staticconstexprprotected |
How may addresses are there for extended accessories.
Definition at line 270 of file DccAccyConsumer.hxx.
|
staticconstexprprotected |
How may aspects are supported per accessory.
Definition at line 272 of file DccAccyConsumer.hxx.
|
staticconstexprprotected |
Total number of events we are listening for.
Definition at line 274 of file DccAccyConsumer.hxx.