|
SatCat5
|
Global coordinator for multiple Timer objects.
Polling this object regularly is required for SatCat5 operation.
This class also stores the pointer to the system TimeRef.
#include <polling.h>
Public Member Functions | |
| satcat5::util::TimeRef * | get_clock () const |
| Get the system time reference, if one is set. More... | |
| bool | clock_ready () const |
| Has a system time reference been provided? | |
| void | set_clock (satcat5::util::TimeRef *timer) |
| Immediately set the system time reference. More... | |
| void | suggest_clock (satcat5::util::TimeRef *timer) |
| Compare the provided reference to the current TimeRef, and keep whichever is "better" by an internal heuristic. More... | |
| bool | pre_test_reset () |
| Reset timekeeper state at the start of each unit test. More... | |
| void | request_poll () |
| Call this method to request polling at a later time. More... | |
| void | request_cancel () |
| Call this method to cancel a previous request_poll(). | |
Static Public Member Functions | |
| static unsigned | count_ondemand () |
| Count queued objects of this type (i.e., non-idle). | |
Protected Member Functions | |
| void | poll_demand () override |
| Deferred event handler, called after request(). More... | |
Protected Attributes | |
| satcat5::util::TimeVal | m_tref |
Private Attributes | |
| satcat5::poll::OnDemand * | m_next |
| bool | m_idle |
| satcat5::util::TimeRef * satcat5::poll::Timekeeper::get_clock | ( | ) | const |
Get the system time reference, if one is set.
Note: The SATCAT5_CLOCK macro is an alias for satcat5::poll::timekeeper.get_clock().
Definition at line 246 of file polling.cc.
|
overrideprotectedvirtual |
Deferred event handler, called after request().
Child class MUST override this method. (Call "request_poll" to enqueue a callback to this method.)
Implements satcat5::poll::OnDemand.
Definition at line 271 of file polling.cc.
| bool satcat5::poll::Timekeeper::pre_test_reset | ( | ) |
Reset timekeeper state at the start of each unit test.
(Unit testing only, should not be called in production.)
Definition at line 264 of file polling.cc.
|
inherited |
Call this method to request polling at a later time.
Safe to stack requests, but only one call to poll().
Definition at line 208 of file polling.cc.
| void satcat5::poll::Timekeeper::set_clock | ( | satcat5::util::TimeRef * | timer | ) |
Immediately set the system time reference.
(Use this if you're sure which reference you want to use.)
Definition at line 250 of file polling.cc.
| void satcat5::poll::Timekeeper::suggest_clock | ( | satcat5::util::TimeRef * | timer | ) |
Compare the provided reference to the current TimeRef, and keep whichever is "better" by an internal heuristic.
(Use this if there may be several possible references.)
Definition at line 257 of file polling.cc.