35#ifndef _OPENLCB_EVENTIDENTIFYGLOBAL_HXX_
36#define _OPENLCB_EVENTIDENTIFYGLOBAL_HXX_
82 void arm(
bool delete_self =
false)
107 uint64_t h =
node_->node_id() * 0x1c19a66d;
108 uint32_t hh = h ^ (h >> 32);
109 hh = hh ^ (hh >> 12) ^ (hh >> 24);
110 long long timeout_msec = 1500 + (hh & 0x1FF);
#define STATE(_fn)
Turns a function name into an argument to be supplied to functions expecting a state.
See OSMutexLock in os/OS.hxx.
Lightweight locking class for protecting small critical sections.
Base class for all QMember types that hold data in an expandable format.
void unref()
Decrement count.
void register_handler(HandlerType *handler, ID id, ID mask)
Adds a new handler to this dispatcher.
void unregister_handler(HandlerType *handler, ID id, ID mask)
Removes a specific instance of a handler from this dispatcher.
virtual void send(MessageType *message, unsigned priority=UINT_MAX)=0
Entry point to the flow.
Return type for a state flow callback.
Use this timer class to deliver the timeout notification to a stateflow.
Base class for state machines.
Action allocate_and_call(FlowInterface< Buffer< T > > *target_flow, Callback c, Pool *pool=nullptr)
Allocates a buffer from a pool and proceed to the next state when allocation is successful.
Action delete_this()
Terminates the flow and deletes *this.
Action exit()
Terminate current StateFlow activity.
void start_flow(Callback c)
Resets the flow to the specified state and starts it.
Buffer< T > * get_allocation_result(FlowInterface< Buffer< T > > *target_flow)
Takes the result of the asynchronous allocation.
Action call_immediately(Callback c)
Imediately call the next state upon return.
Action sleep_and_call(::Timer *timer, long long timeout_nsec, Callback c)
Suspends execution of this control flow for a specified time.
Helper object for producing an Event Identify Global message.
StateFlowTimer timer_
timer object for handling the timeout
uint8_t deleteSelf_
delete object upon state flow exit (one-shot)
EventIdentifyGlobal(Node *node)
Constructor.
Node * node_
node to send message from
void handle_incoming_event_identify_global(Buffer< GenMessage > *msg)
Callback upon receiving a Defs::MTI_EVENTS_IDENTIFY_GLOBAL message.
void arm(bool delete_self=false)
Arm the EventIdentifyGlobal request.
MessageHandler::GenericHandler eventIdentifyGlobalHandler_
handler for incoming messages
Action fill_buffer()
Fill in allocated buffer and send Event Identify Global message.
~EventIdentifyGlobal()
Destructor.
uint8_t aborted_
true if message received, abort need to send
Action timeout()
Will be called on the executor of the timer.
Action entry()
Entry/reset point into state machine.
MessageHandler * global_message_write_flow()
MessageDispatchFlow * dispatcher()
Base class for NMRAnet nodes conforming to the asynchronous interface.
virtual bool is_initialized()=0
string EMPTY_PAYLOAD
A global class / variable for empty or not-yet-initialized payloads.
#define MSEC_TO_NSEC(_msec)
Convert a millisecond value to a nanosecond value.
@ MTI_EVENTS_IDENTIFY_GLOBAL
request identify all of every node's events
@ MTI_EXACT
match mask for a single MTI