Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::FixedEventProducer< EVENT_ID > Class Template Reference

Class that advertises an event ID to be produced. More...

#include <EventHandlerTemplates.hxx>

Inheritance diagram for openlcb::FixedEventProducer< EVENT_ID >:
openlcb::SimpleEventHandler openlcb::EventHandler

Public Member Functions

 FixedEventProducer (Node *node)
 
void handle_identify_global (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done) OVERRIDE
 Called on the need of sending out identification messages.
 
void handle_identify_producer (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done) OVERRIDE
 Called on another node sending IdentifyProducer.
 
- 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_event_report (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done)=0
 Called on incoming EventReport messages.
 
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_consumer (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done)=0
 Called on another node sending IdentifyConsumer.
 

Private Attributes

Nodenode_
 

Additional Inherited Members

- Public Types inherited from openlcb::EventHandler
using EventReport = openlcb::EventReport
 
using EventRegistryEntry = openlcb::EventRegistryEntry
 
using EventId = openlcb::EventId
 

Detailed Description

template<uint64_t EVENT_ID>
class openlcb::FixedEventProducer< EVENT_ID >

Class that advertises an event ID to be produced.

It does not do anything else. This feature is used by certain protocols to find nodes supporting a given feature, such as IsTrain and IsCommandStation in the traction protocol.

usage:

static const uint64_t IS_TRAIN_EVENT_ID = 0x0101000000000303ULL; FixedEventProducer<IS_TRAIN_EVENT_ID> train_event_producer(&train_node);

The eventID constant must be available at compile time.

Definition at line 130 of file EventHandlerTemplates.hxx.

Constructor & Destructor Documentation

◆ FixedEventProducer()

template<uint64_t EVENT_ID>
openlcb::FixedEventProducer< EVENT_ID >::FixedEventProducer ( Node node)
inline

TODO (balazs.racz) move the event ID argument from the templates to a constructor argument; use the event registry entry value to send out messages to the bus.

Definition at line 133 of file EventHandlerTemplates.hxx.

◆ ~FixedEventProducer()

template<uint64_t EVENT_ID>
openlcb::FixedEventProducer< EVENT_ID >::~FixedEventProducer ( )
inline

Definition at line 142 of file EventHandlerTemplates.hxx.

Member Function Documentation

◆ handle_identify_global()

template<uint64_t EVENT_ID>
void openlcb::FixedEventProducer< EVENT_ID >::handle_identify_global ( const EventRegistryEntry registry_entry,
EventReport event,
BarrierNotifiable done 
)
inlinevirtual

Called on the need of sending out identification messages.

Parameters
eventis NULL. This happens on startup, or when a global or addressed IdentifyGlobal message arrives. Might have destination node id!
registry_entrygives the registry entry for which the current handler is being called.
donemust be notified when the processing is done.

Implements openlcb::EventHandler.

Definition at line 147 of file EventHandlerTemplates.hxx.

◆ handle_identify_producer()

template<uint64_t EVENT_ID>
void openlcb::FixedEventProducer< EVENT_ID >::handle_identify_producer ( const EventRegistryEntry registry_entry,
EventReport event,
BarrierNotifiable done 
)
inlinevirtual

Called on another node sending IdentifyProducer.

Parameters
eventstores information about the incoming message. Filled: src_node, event, mask=1. Not filled: state.
registry_entrygives the registry entry for which the current handler is being called.
donemust be notified when the processing is done.

Implements openlcb::EventHandler.

Definition at line 159 of file EventHandlerTemplates.hxx.

Member Data Documentation

◆ node_

template<uint64_t EVENT_ID>
Node* openlcb::FixedEventProducer< EVENT_ID >::node_
private

Definition at line 166 of file EventHandlerTemplates.hxx.


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