|
Open Model Railroad Network (OpenMRN)
|
Base class for single-bit producer and consumer objects. More...
#include <EventHandlerTemplates.hxx>
Public Member Functions | |
| BitEventHandler (BitEventInterface *bit) | |
| void | SendEventReport (WriteHelper *writer, Notifiable *done) |
| Requests the event associated with the current value of the bit to be produced (unconditionally): sends an event report packet ot the bus. | |
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 ®istry_entry, EventReport *event, BarrierNotifiable *done)=0 |
| Called on incoming EventReport messages. | |
| 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_global (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done)=0 |
| Called on the need of sending out identification messages. | |
| virtual void | handle_identify_consumer (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done)=0 |
| Called on another node sending IdentifyConsumer. | |
| virtual void | handle_identify_producer (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done)=0 |
| Called on another node sending IdentifyProducer. | |
Protected Member Functions | |
| void | register_handler (uint64_t event_on, uint64_t event_off) |
| Registers this event handler with the global event manager. | |
| void | unregister_handler () |
| Removes this event handler from the global event manager. | |
| void | SendProducerIdentified (EventReport *event, BarrierNotifiable *done) |
| Sends off two packets using event_write_helper{1,2} of ProducerIdentified for handling a global identify events message. | |
| void | SendConsumerIdentified (EventReport *event, BarrierNotifiable *done) |
| Sends off two packets using event_write_helper{3,4} of ConsumerIdentified for handling a global identify events message. | |
| void | HandlePCIdentify (Defs::MTI mti_valid, EventReport *event, BarrierNotifiable *done) |
| Checks if the event in the report is something we are interested in, and if so, sends off a {Producer|Consumer}Identified{Valid|Invalid} message depending on the current state of the hardware bit. | |
Protected Attributes | |
| BitEventInterface * | bit_ |
Private Types | |
| enum | { EVENT_ON = 1 , EVENT_OFF = 2 , BOTH_ON_IS_ZERO = 4 , BOTH_OFF_IS_ZERO = 8 } |
| Bits defined in the user_data value for the registrations in this event handler. More... | |
Private Member Functions | |
| DISALLOW_COPY_AND_ASSIGN (BitEventHandler) | |
Additional Inherited Members | |
Public Types inherited from openlcb::EventHandler | |
| using | EventReport = openlcb::EventReport |
| using | EventRegistryEntry = openlcb::EventRegistryEntry |
| using | EventId = openlcb::EventId |
Base class for single-bit producer and consumer objects.
Contains helper functions for operations shared by event handlers.
Definition at line 531 of file EventHandlerTemplates.hxx.
|
private |
Bits defined in the user_data value for the registrations in this event handler.
Definition at line 583 of file EventHandlerTemplates.hxx.
| openlcb::BitEventHandler::BitEventHandler | ( | BitEventInterface * | bit | ) |
Definition at line 542 of file EventHandlerTemplates.cxx.
|
protected |
Checks if the event in the report is something we are interested in, and if so, sends off a {Producer|Consumer}Identified{Valid|Invalid} message depending on the current state of the hardware bit.
Uses event_write_helper<1>. Notifies done.
Definition at line 619 of file EventHandlerTemplates.cxx.
|
protected |
Registers this event handler with the global event manager.
Call this from the constructor of the derived class.
Definition at line 546 of file EventHandlerTemplates.cxx.
|
protected |
Sends off two packets using event_write_helper{3,4} of ConsumerIdentified for handling a global identify events message.
Allocates children from barrier done (but does not notify it).
@TODO: for consistency of API this function should be changed to notify the barrier. The caller should always use new_child.
Definition at line 589 of file EventHandlerTemplates.cxx.
| void openlcb::BitEventHandler::SendEventReport | ( | WriteHelper * | writer, |
| Notifiable * | done | ||
| ) |
Requests the event associated with the current value of the bit to be produced (unconditionally): sends an event report packet ot the bus.
| writer | is the output flow to be used. |
| done | is the notification callback. If it is NULL, the writer will be invoked inline and potentially block the calling thread. |
Definition at line 603 of file EventHandlerTemplates.cxx.
|
protected |
Sends off two packets using event_write_helper{1,2} of ProducerIdentified for handling a global identify events message.
Allocates children from barrier done (but does not notify it).
@TODO: for consistency of API this function should be changed to notify the barrier. The caller should always use new_child.
Definition at line 575 of file EventHandlerTemplates.cxx.
|
protected |
Removes this event handler from the global event manager.
Call this from the destructor of the derived class.
Definition at line 570 of file EventHandlerTemplates.cxx.
|
protected |
Definition at line 578 of file EventHandlerTemplates.hxx.