27#ifndef _OPENLCB_OLCBNETWORKSTATE_HXX_
28#define _OPENLCB_OLCBNETWORKSTATE_HXX_
45 uint64_t event_on, uint64_t event_off)
47 ,
bit_(node, event_on, event_off, true)
86 case EventState::VALID:
88 case EventState::INVALID:
A BarrierNotifiable allows to create a number of child Notifiable and wait for all of them to finish.
"Abstract" interface for a binary network state.
@ INVALID
state is "invalid"
@ UNKNOWN
state is "unknown"
An object that can schedule itself on an executor to run.
void SendEventReport(WriteHelper *writer, Notifiable *done)
Requests the event associated with the current value of the bit to be produced (unconditionally): sen...
Producer-Consumer event handler for a single bit represented by two event IDs.
void SendQueryConsumer(WriteHelper *writer, BarrierNotifiable *done)
Queries consumer and acquires the current state of the bit.
Speciallization of NetworkInitializedBit that adds callback support when the state changes.
void reset()
Call this function in order to reset the network state to unknown.
void set_state(bool new_value) override
Call from the network stack (or the client before notifying the network stack) to set the state.
void set_change_callback(std::function< void()> cb)
Specifies the change notifier.
bool is_network_state_known()
EventState get_current_state() override
Accessor from the network stack to return the current state.
void toggle_state()
Invert the current state.
OpenLCB implementation of a binary network state.
NetworkState(Node *node, WriteHelper *write_helper, uint64_t event_on, uint64_t event_off)
Constructor.
State get_state() override
Get the current state.
bool is_state_known() override
Get an indication as to if the state is known.
void initiate_query(BarrierNotifiable *done) override
Queries and acquires the current state of the bit.
WriteHelper * writeHelper_
helper for generating events
CallbackNetworkInitializedBit bit_
bit (dual event) container
BitEventPC bitPC_
bit event producer/consumer
void reset() override
Reset the network state to unknown.
void toggle(Notifiable *done) override
Toggle the state.
void set_callback(std::function< void()> cb) override
Set the change notification callback.
void set_state(bool state, Notifiable *done) override
Set the state.
Base class for NMRAnet nodes conforming to the asynchronous interface.
A statically allocated buffer for sending one message to the OpenLCB bus.