36#ifndef _OPENLCB_MULTICONFIGUREDCONSUMER_HXX_
37#define _OPENLCB_MULTICONFIGUREDCONSUMER_HXX_
55 typedef ConsumerConfig config_entry_type;
75 const Gpio *
const *pins,
unsigned size,
108 for (
unsigned i = 0; i < size_; ++i)
110 const config_entry_type cfg_ref(grp_ref.entry(i));
111 EventId cfg_event_on = cfg_ref.event_on().read(fd);
112 EventId cfg_event_off = cfg_ref.event_off().read(fd);
124 for (
unsigned i = 0; i < size_; ++i)
126 grp_ref.entry(i).description().write(fd,
"");
133 void factory_reset_names(
int fd,
const char *basename)
136 for (
unsigned i = 0; i < size_; ++i)
141 unsigned_integer_to_buffer(i+1, buf);
143 grp_ref.entry(i).description().write(fd, v);
157 SendConsumerIdentified(registry_entry, event, done);
168 SendConsumerIdentified(registry_entry, event, done);
179 const bool is_on = (registry_entry.
user_arg & 1);
191 unsigned b1 = pins_[registry_entry.
user_arg >> 1]->is_set() ? 1 : 0;
192 unsigned b2 = registry_entry.
user_arg & 1;
197 event->event_write_helper<3>()->WriteAsync(node_, mti,
210 const Gpio *
const *pins_;
This class sends a notification in its destructor.
A BarrierNotifiable allows to create a number of child Notifiable and wait for all of them to finish.
void notify() override
Implementation of the barrier semantics.
Abstract class for components that need to receive configuration from EEPROM.
virtual void factory_reset(int fd)=0
Clears configuration file and resets the configuration settings to factory value.
UpdateAction
Specifies what additional steps are needed to apply the new configuration.
@ REINIT_NEEDED
Need to perform application-level reinitialization.
virtual UpdateAction apply_configuration(int fd, bool initial_load, BarrierNotifiable *done)=0
Notifies the component that there is new configuration available for loading.
virtual void register_update_listener(ConfigUpdateListener *listener)=0
Adds a config update listener to be called upon configuration updates.
virtual void unregister_update_listener(ConfigUpdateListener *listener)=0
Removes a config update listener.
OS-independent abstraction for GPIO.
virtual void write(Value new_state) const =0
Writes a GPIO output pin (set or clear to a specific state).
static ConfigUpdateService * instance()
Class representing a particular location in the configuration space.
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_event_report(const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done)=0
Called on incoming EventReport messages.
virtual void handle_identify_consumer(const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done)=0
Called on another node sending IdentifyConsumer.
Structure used in registering event handlers.
uint32_t user_arg
Opaque user argument.
EventId event
Stores the event ID or beginning of range for which to register the given handler.
Base class for NMRAnet nodes conforming to the asynchronous interface.
Defines a repeated group of a given type and a given number of repeats.
SimpleEventHandler ignores all non-essential callbacks.
#define OVERRIDE
Function attribute for virtual functions declaring that this funciton is overriding a funciton that s...
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.
Payload eventid_to_buffer(uint64_t eventid)
Converts an Event ID to a Payload suitable to be sent as an event report.
MTI
Known Message type indicators.
@ MTI_CONSUMER_IDENTIFIED_VALID
consumer broadcast, valid state
Shared notification structure that is assembled for each incoming event-related message,...
EventId event
The event ID from the incoming message.
Node * dst_node
nullptr for global messages; points to the specific virtual node for addressed events identify messag...