35#ifndef _OPENLCB_BROADCASTTIMESERVER_HXX_
36#define _OPENLCB_BROADCASTTIMESERVER_HXX_
44class BroadcastTimeServerTime;
45class BroadcastTimeServerSync;
46class BroadcastTimeServerSet;
47class BroadcastTimeServerAlarm;
111 event->event_write_helper<1>()->WriteAsync(
117 event->event_write_helper<2>()->WriteAsync(
136 event->event_write_helper<1>()->WriteAsync(
138 WriteHelper::global(),
153 event->event_write_helper<1>()->WriteAsync(
205 uint16_t shutdown_ : 1;
#define STATE(_fn)
Turns a function name into an argument to be supplied to functions expecting a state.
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.
BarrierNotifiable * new_child()
Call this for each child task.
Return type for a state flow callback.
void start_flow(Callback c)
Resets the flow to the specified state and starts it.
Action sleep_and_call(::Timer *timer, long long timeout_nsec, Callback c)
Suspends execution of this control flow for a specified time.
Specialization of the BroacastTimeAlarm to expire on the necessary clock minutes that must be produce...
State machine for sending the clock set sequence.
State machine for sending the clock sync sequence.
State machine for sending the clock time events.
Implementation of a Broadcast Time Protocol server.
~BroadcastTimeServer()
Destructor.
void handle_consumer_range_identified(const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) override
Called on another node sending ConsumerRangeIdentified.
void handle_event_report(const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override
Handle an incoming event report.
void handle_consumer_identified(const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override
Handle an incoming consumer identified.
void handle_identify_global(const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override
Handle requested identification message.
bool is_server_self() override
Test if this is a server.
Action query_response()
Respond to a query by scheduling a sync.
Action entry()
Entry to state machine.
virtual void set_shortcut(uint64_t event) override
Try the possible set event shortcut.
bool is_server_detected() override
Has a time server been detected?
time_t secondsRequested_
pending clock time in seconds
uint16_t updateRequested_
clock settings have change
void handle_identify_producer(const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override
Handle requested identification message.
void handle_identify_consumer(const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override
Handle requested identification message.
Implementation of Broadcast Time Protocol.
StateFlowTimer timer_
timer helper
Node * node()
Accessor method to get the Node reference.
NodeID clock_id()
Accessor method to get the (48-bit) Clock ID.
EventId eventBase_
48-bit unique identifier for the clock instance
Node * node_
OpenLCB node to export the consumer on.
Structure used in registering event handlers.
Base class for NMRAnet nodes conforming to the asynchronous interface.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.
uint64_t EncodeRange(uint64_t begin, unsigned size)
Creates a single encoded event range from the beginning of the range and the number fo events to cove...
uint64_t NodeID
48-bit NMRAnet Node ID type
Payload eventid_to_buffer(uint64_t eventid)
Converts an Event ID to a Payload suitable to be sent as an event report.
#define MSEC_TO_NSEC(_msec)
Convert a millisecond value to a nanosecond value.
@ MTI_PRODUCER_IDENTIFIED_RANGE
producer broadcast about a range of producers
@ MTI_CONSUMER_IDENTIFIED_RANGE
consumer broadcast about a range of consumers
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...