Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::DccAccyConsumer Class Reference

Specialized (DCC protocol) implementation of a DCC accessory consumer. More...

#include <DccAccyConsumer.hxx>

Inheritance diagram for openlcb::DccAccyConsumer:
openlcb::DccAccyConsumerBase openlcb::SimpleEventHandler openlcb::EventHandler

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 &registry_entry, EventReport *event, BarrierNotifiable *done)
 Called on another node sending ConsumerIdentified for this event.
 
virtual void handle_consumer_range_identified (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done)
 Called on another node sending ConsumerRangeIdentified.
 
virtual void handle_producer_identified (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done)
 Called on another node sending ProducerIdentified for this event.
 
virtual void handle_producer_range_identified (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done)
 Called on another node sending ProducerRangeIdentified for this event.
 
virtual void handle_identify_producer (const EventRegistryEntry &registry_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::TrackIftrack_
 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 &registry_entry, EventReport *event, BarrierNotifiable *done) OVERRIDE
 Called on the need of sending out identification messages.
 
void handle_event_report (const EventRegistryEntry &registry_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.
 
Nodenode_
 OpenLCB node to export the consumer on.
 

Detailed Description

Specialized (DCC protocol) implementation of a DCC accessory consumer.

Definition at line 229 of file DccAccyConsumer.hxx.

Constructor & Destructor Documentation

◆ DccAccyConsumer()

openlcb::DccAccyConsumer::DccAccyConsumer ( Node node,
dcc::TrackIf track 
)
inline

Constructs a listener for DCC accessory control.

Parameters
nodeis the virtual node that will be listening for events and responding to Identify messages.
trackis the interface through which we will be writing DCC accessory packets.

Definition at line 237 of file DccAccyConsumer.hxx.

◆ ~DccAccyConsumer()

openlcb::DccAccyConsumer::~DccAccyConsumer ( )
inline

Destructor.

Definition at line 244 of file DccAccyConsumer.hxx.

Member Function Documentation

◆ send_accy_command()

void openlcb::DccAccyConsumer::send_accy_command ( )
inlineoverrideprivatevirtual

Send the actual accessory command.

Implements openlcb::DccAccyConsumerBase.

Definition at line 250 of file DccAccyConsumer.hxx.

Member Data Documentation

◆ track_

dcc::TrackIf* openlcb::DccAccyConsumer::track_
private

Track to send DCC packets to.

Definition at line 260 of file DccAccyConsumer.hxx.


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