|
| | BroadcastTimeServer (Node *node, NodeID clock_id) |
| | Constructor.
|
| |
| | ~BroadcastTimeServer () |
| | Destructor.
|
| |
| bool | is_server_detected () override |
| | Has a time server been detected?
|
| |
| bool | is_server_self () override |
| | Test if this is a server.
|
| |
| virtual | ~BroadcastTime () |
| | Destructor.
|
| |
| void | set_time (int hours, int minutes) |
| | Set the time in seconds since the system Epoch.
|
| |
| void | set_date (int month, int day) |
| | Set the time in seconds since the system Epoch.
|
| |
| void | set_year (int year) |
| | Set the time in seconds since the system Epoch.
|
| |
| void | set_date_year_str (const char *date_year) |
| | Set the date and year from a C string.
|
| |
| void | set_rate_quarters (int16_t rate) |
| | Set Rate.
|
| |
| void | start () |
| | Start clock.
|
| |
| void | stop () |
| | Stop clock.
|
| |
| void | query () |
| | Query the current time.
|
| |
| UpdateSubscribeHandle | update_subscribe_add (TimeUpdateCallback callback) |
| | Register a callback for when the time synchronization is updated.
|
| |
| void | update_subscribe_remove (UpdateSubscribeHandle handle) |
| | Unregister a callback for when the time synchronization is updated.
|
| |
| Node * | node () |
| | Accessor method to get the Node reference.
|
| |
| NodeID | clock_id () |
| | Accessor method to get the (48-bit) Clock ID.
|
| |
| EventId | event_base () |
| | Access method to get the (64-bit) Event ID base.
|
| |
| const struct tm * | gmtime_recalculate () |
| | Recalculate the struct tm representation of time.
|
| |
| const struct tm * | gmtime_get () |
| | Get the last calculated reprentation of time.
|
| |
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_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.
|
| |
| void | run () override |
| | Callback from the executor.
|
| |
| void | notify () override |
| | Wakeup call arrived.
|
| |
| Service * | service () |
| | Return a pointer to the service I am bound to.
|
| |
| void | test_deletion () |
| |
| void | init () |
| | Initiailize a QMember, in place of a public placement construction.
|
| |
| void | sync (const TimeBase &other) |
| | Synchronizes this time with a different clock.
|
| |
| std::pair< time_t, int16_t > | time_and_rate_quarters () |
| | Get the time as a value of seconds relative to the system epoch.
|
| |
| time_t | compare_realtime (time_t t1, time_t t2) |
| | Get the difference in time scaled to real time.
|
| |
| time_t | time () |
| | Get the time as a value of seconds relative to the system epoch.
|
| |
| struct tm * | gmtime_r (struct tm *result) |
| | Get the time as a standard struct tm.
|
| |
| int | date (int *month, int *day) |
| | Get the date (month/day).
|
| |
| int | day_of_week () |
| | Get the day of the week.
|
| |
| int | day_of_year () |
| | Get the day of the year.
|
| |
| int | year () |
| | Get the year.
|
| |
| int16_t | get_rate_quarters () |
| | Report the clock rate as a 12-bit fixed point number (-512.00 to 511.75).
|
| |
| bool | is_running () |
| | Test of the clock is running.
|
| |
| bool | is_started () |
| | Test of the clock is started (rate could still be 0).
|
| |
| bool | fast_sec_to_real_nsec_period (int16_t rate, time_t fast_sec, long long *real_nsec) |
| | Convert fast clock period to a period in real nsec.
|
| |
| bool | real_nsec_to_fast_sec_period (int16_t rate, long long real_nsec, time_t *fast_sec) |
| | Convert period in real nsec to a fast clock period.
|
| |
| bool | real_nsec_until_fast_time_abs (time_t fast_sec, long long *real_nsec) |
| | Convert a fast time to absolute nsec until it will occur.
|
| |
| bool | fast_sec_to_real_nsec_period_abs (time_t fast_sec, long long *real_nsec) |
| | Convert fast clock absolute (negative or positive) period to a positive (absolute) period in real nsec.
|
| |
|
| typedef size_t | UpdateSubscribeHandle |
| | An opaque data element that is returned from update subscriber registration, and allows unregistering a subscriber.
|
| |
| typedef std::function< void(time_t old, time_t current)> | TimeUpdateCallback |
| | Callback type used for time update subscribers.
|
| |
Public Types inherited from openlcb::EventHandler |
| using | EventReport = openlcb::EventReport |
| |
| using | EventRegistryEntry = openlcb::EventRegistryEntry |
| |
| using | EventId = openlcb::EventId |
| |
| template<class T , typename... Args> |
| static void | invoke_subflow_and_ignore_result (FlowInterface< Buffer< T > > *target_flow, Args &&... args) |
| | Calls a helper flow to perform some actions.
|
| |
| typedef Action(StateFlowBase::* | Callback) () |
| | State Flow callback prototype.
|
| |
| | BroadcastTime (Node *node, NodeID clock_id) |
| | Constructor.
|
| |
| void | service_callbacks (time_t old, time_t current) |
| | Service all of the attached update subscribers.
|
| |
| | StateFlowBase (Service *service) |
| | Constructor.
|
| |
| | ~StateFlowBase () |
| | Destructor.
|
| |
| void | reset_flow (Callback c) |
| | Resets the flow to the specified state.
|
| |
| bool | is_state (Callback c) |
| |
| bool | is_terminated () |
| |
| void | start_flow (Callback c) |
| | Resets the flow to the specified state and starts it.
|
| |
| Action | again () |
| | Call the current state again via call_immediately.
|
| |
| Action | exit () |
| | Terminate current StateFlow activity.
|
| |
| Action | delete_this () |
| | Terminates the flow and deletes *this.
|
| |
| Action | set_terminated () |
| | Sets the flow to terminated state.
|
| |
| Action | call_immediately (Callback c) |
| | Imediately call the next state upon return.
|
| |
| Action | wait () |
| | Wait for an asynchronous call.
|
| |
| Action | wait_and_call (Callback c) |
| | Wait for resource to become available before proceeding to next state.
|
| |
| template<class T > |
| 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 | allocate_and_call (Callback c, QAsync *queue) |
| | Allocates an entry from an asynchronous queue, and transitions to a state once the allocation is complete.
|
| |
| template<class T > |
| Buffer< T > * | full_allocation_result (FlowInterface< Buffer< T > > *target_flow) |
| | Takes the result of the asynchronous allocation without resetting the object.
|
| |
| template<class T > |
| T * | full_allocation_result (TypedQAsync< T > *queue) |
| | Takes the result of the asynchronous allocation without resetting the object.
|
| |
| template<class T > |
| void | cast_allocation_result (T **member) |
| | Takes the result of the asynchronous allocation without resetting the object.
|
| |
| template<class T > |
| Buffer< T > * | get_allocation_result (FlowInterface< Buffer< T > > *target_flow) |
| | Takes the result of the asynchronous allocation.
|
| |
| Action | yield_and_call (Callback c) |
| | Place the current flow to the back of the executor, and transition to a new state after we get the CPU again.
|
| |
| Action | yield () |
| | Place the current flow to the back of the executor, and re-try the current state after we get the CPU again.
|
| |
| Action | sleep_and_call (::Timer *timer, long long timeout_nsec, Callback c) |
| | Suspends execution of this control flow for a specified time.
|
| |
| template<class T , typename... Args> |
| Action | invoke_subflow_and_wait (FlowInterface< Buffer< T > > *target_flow, Callback c, Args &&... args) |
| | Calls a helper flow to perform some actions.
|
| |
| Action | read_repeated (StateFlowSelectHelper *helper, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO) |
| | Blocks until size bytes are read and then invokes the next state.
|
| |
| Action | read_single (StateFlowSelectHelper *helper, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO) |
| | Attempts to read at most size_t bytes, and blocks the caller until at least one byte is read.
|
| |
| Action | read_nonblocking (StateFlowSelectHelper *helper, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO) |
| | Attempts to read at most size bytes, and then invokes the next state, even if only zero bytes are available right now.
|
| |
| Action | read_repeated_with_timeout (StateFlowTimedSelectHelper *helper, long long timeout_nsec, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO) |
| | Blocks until size bytes are read, or a timeout expires.
|
| |
| Action | internal_try_read () |
| | Implementation state that gets repeatedly called upon every wakeup and tries to make progress on reading.
|
| |
| Action | write_repeated (StateFlowSelectHelper *helper, int fd, const void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO) |
| | Writes some data into a file descriptor, repeating the operation as necessary until all bytes are written.
|
| |
| Action | internal_try_write () |
| | Implementation state that gets repeatedly called upon every wakeup and tries to make progress on writing.
|
| |
| | QMember () |
| | Constructor.
|
| |
| | ~QMember () |
| | Destructor.
|
| |
| void | lock () |
| |
| void | unlock () |
| |
| struct tm | tm_ |
| | the time we are last set to as a struct tm
|
| |
| Node * | node_ |
| | OpenLCB node to export the consumer on.
|
| |
| EventId | eventBase_ |
| | 48-bit unique identifier for the clock instance
|
| |
| WriteHelper | writer_ |
| | helper for sending event messages
|
| |
| StateFlowTimer | timer_ |
| | timer helper
|
| |
| std::vector< TimeUpdateCallback > | callbacks_ |
| | update subscribers
|
| |
| int16_t | rateRequested_ |
| | pending clock rate
|
| |
| QMember * | next |
| | pointer to the next member in the queue
|
| |
| long long | timestamp_ {OSTime::get_monotonic()} |
| | OS time at the last time update.
|
| |
| time_t | seconds_ {0} |
| | Clock time at the last time update.
|
| |
| int16_t | rate_ {0} |
| | effective clock rate
|
| |
| uint16_t | started_: 1 |
| | true if clock is started
|
| |
Implementation of a Broadcast Time Protocol server.
Note: A Broadcast Time server must produce all the individual time events for which there is an identified consumer. In order to guarantee that the server can identify all of the consumers, it is important to have an Event Identify Global message sent after the creation of the server object. In order to prevent unnecessary duplication of Event Identify Global messages, it is left to the application to send the Event Identify Global message. An application can use the openlcb::EventIdentifyGlobal object for production of an Event Identify Global message.
Definition at line 58 of file BroadcastTimeServer.hxx.