![]() |
GM6000 Digital Heater Controller Build: 20 (Branch = develop)
SDX-1330
|
This class extends the Cpl::Itc::MailboxServer class to add periodic scheduling to an event based 'thread'. More...
This class extends the Cpl::Itc::MailboxServer class to add periodic scheduling to an event based 'thread'.
The timing resolution of the periodic scheduling is a determined by the 'timingTickInMsec' argument value in the class's constructor. For example if 'timingTickInMsec' is 10ms then no interval should have a interval duration less than 10ms.
The order of processing is:
#include <PeriodicScheduler.h>
Public Types | |
| typedef void(* | IdleFunc_T) (Cpl::System::ElapsedTime::Precision_T currentTick, bool atLeastOneIntervalExecuted) |
| Defines an optional method that is called every time the Runnable's object executes its event/scheduling loop. | |
Public Types inherited from Cpl::System::PeriodicScheduler | |
| typedef void(* | IntervalCallbackFunc_T) (ElapsedTime::Precision_T currentTick, ElapsedTime::Precision_T currentInterval, void *context) |
| Definition for an interval method. | |
| typedef void(* | ReportSlippageFunc_T) (Interval_T &intervalThatSlipped, ElapsedTime::Precision_T currentTick, ElapsedTime::Precision_T missedInterval) |
| Defines the method that is used to report to the Application when an Interval does not execute 'on time'. | |
| typedef ElapsedTime::Precision_T(* | NowFunc_T) () |
| Defines the function that returns current system. | |
| typedef void(* | Hook_T) (ElapsedTime::Precision_T currentTick) |
| Defines the optional functions that are used to provide hooks during startup/shutdown of the thread/loop[ to perform application specific processing. | |
Public Member Functions | |
| PeriodicScheduler (Interval_T intervals[], Hook_T beginThreadProcessing=nullptr, Hook_T endThreadProcessing=nullptr, ReportSlippageFunc_T slippageFunc=nullptr, NowFunc_T nowFunc=Cpl::System::ElapsedTime::precision, IdleFunc_T idleFunc=nullptr, unsigned long timingTickInMsec=OPTION_CPL_SYSTEM_EVENT_LOOP_TIMEOUT_PERIOD, Cpl::System::SharedEventHandlerApi *eventHandler=0) noexcept | |
| Constructor. | |
| void | appRun () |
| See Cpl::System::Runnable. | |
Public Member Functions inherited from Cpl::Itc::MailboxServer | |
| MailboxServer (unsigned long timingTickInMsec=OPTION_CPL_SYSTEM_EVENT_LOOP_TIMEOUT_PERIOD, Cpl::System::SharedEventHandlerApi *eventHandler=0) noexcept | |
| Constructor. | |
Public Member Functions inherited from Cpl::Itc::Mailbox | |
| Mailbox (Cpl::System::Signable &myEventLoop) | |
| Constructor. | |
| void | post (Message &msg) noexcept |
| See Cpl::Itc::PostApi. | |
| void | postSync (Message &msg) noexcept |
| See Cpl::Itc::PostApi. | |
Public Member Functions inherited from Cpl::Itc::PostApi | |
| virtual | ~PostApi () |
| Virtual destructor. | |
Public Member Functions inherited from Cpl::Container::SList< Message > | |
| SList () noexcept | |
| Public constructor initializes head and tail pointers. | |
| SList (const char *ignoreThisParameter_usedToCreateAUniqueConstructor) noexcept | |
| This is a special constructor for when the list is statically declared (i.e. | |
| void | move (SList< Message > &dst) noexcept |
| Moves the content of the this queue to the specified queue. | |
| void | clearTheList () noexcept |
| Empties the list. | |
| Message * | get (void) noexcept |
| Removes the first item in the list. | |
| void | put (Message &item) noexcept |
| Adds the item as the last item in the list. | |
| Message * | head (void) const noexcept |
| Return a pointer to the first item in the list. | |
| Message * | tail (void) const noexcept |
| Return a pointer to the last item in the list. | |
| Message * | pop (void) noexcept |
| Removes the top element from stack and return a pointer to it as a result. | |
| void | push (Message &item) noexcept |
| Adds the ITEM item to top of the stack. | |
| Message * | top (void) const noexcept |
| Return a pointer to the top ITEM item in the stack. | |
| Message * | getFirst (void) noexcept |
| Removes the first item in the list. | |
| Message * | getLast (void) noexcept |
| Removes the last item in the list. | |
| void | putFirst (Message &item) noexcept |
| Adds the item as the first item in the list. | |
| void | putLast (Message &item) noexcept |
| Adds the item as the last item in the list. | |
| bool | remove (Message &item) noexcept |
| Remove specified ITEM element from the list. | |
| void | insertAfter (Message &after, Message &item) noexcept |
| Insert the "item" ITEM into the list behind the "after" ITEM element. | |
| void | insertBefore (Message &before, Message &item) noexcept |
| Insert the "item" ITEM into the list ahead of the "before" ITEM element. | |
| bool | find (const Message &item) const noexcept |
| Returns true if the specified item is already in the list, else false. | |
| Message * | first (void) const noexcept |
| Return a pointer to the first item in the list. | |
| Message * | last (void) const noexcept |
| Return a pointer to the last item in the list. | |
| Message * | next (const Message &item) const noexcept |
| Return a pointer to the item after the item "item". | |
Public Member Functions inherited from Cpl::System::EventLoop | |
| EventLoop (unsigned long timeOutPeriodInMsec=OPTION_CPL_SYSTEM_EVENT_LOOP_TIMEOUT_PERIOD, SharedEventHandlerApi *eventHandler=0) | |
| Constructor. | |
| virtual | ~EventLoop () |
| Virtual destructor. | |
| int | signal (void) noexcept |
| See Cpl::System::Signable. | |
| int | su_signal (void) noexcept |
| See Cpl::System::Signable. | |
| void | pleaseStop () |
| See Cpl::System::Runnable. | |
| void | notifyEvents (Cpl_System_EventFlag_T events) noexcept |
| See Cpl::System::EventFlag. | |
| void | notify (uint8_t eventNumber) noexcept |
| See Cpl::System::EventFlag. | |
| void | su_notifyEvents (Cpl_System_EventFlag_T events) noexcept |
| See Cpl::System::EventFlag. | |
| void | su_notify (uint8_t eventNumber) noexcept |
| See Cpl::System::EventFlag. | |
| void | setThreadOfExecution_ (Thread *myThreadPtr) |
| See Cpl::System::Runnable. | |
Public Member Functions inherited from Cpl::System::Runnable | |
| virtual | ~Runnable () |
| Virtual destructor. | |
| virtual void | run () |
| This method is called when the Thread is started. | |
| virtual bool | isRunning () noexcept |
| This method returns true if the instance has 'entered' its run method; false is returned, i.e. | |
Public Member Functions inherited from Cpl::System::EventFlag | |
| virtual | ~EventFlag () |
| Virtual destructor. | |
Public Member Functions inherited from Cpl::System::Signable | |
| virtual | ~Signable () |
| Virtual destructor. | |
Public Member Functions inherited from Cpl::Container::Item | |
| bool | insert_ (void *newContainerPtr) |
| Helper method to trap when inserting an item in multiple containers. | |
| bool | isInContainer_ (const void *containerPtr) const noexcept |
| Returns 'true' if the instance is in the specified container. | |
Public Member Functions inherited from Cpl::System::TimerManager | |
| TimerManager () | |
| Constructor. | |
| void | startManager (void) noexcept |
| This method starts the Timer Manager. | |
| void | processTimers (void) noexcept |
| This method processes the current active timer lists. | |
| bool | areActiveTimers (void) noexcept |
| Returns true if there are NO active timers. | |
| void | attach (CounterCallback_ &clientToCallback) noexcept |
| See Cpl::System::CounterCallback_. | |
| bool | detach (CounterCallback_ &clientToCallback) noexcept |
| See Cpl::System::CounterCallback_. | |
| unsigned long | msecToCounts (unsigned long milliseconds) noexcept |
| See Cpl::System::CounterCallback_. | |
Public Member Functions inherited from Cpl::System::CounterSource_ | |
| virtual | ~CounterSource_ () |
| Virtual Destructor. | |
Public Member Functions inherited from Cpl::System::PeriodicScheduler | |
| PeriodicScheduler (Interval_T intervals[], Hook_T beginThreadProcessing=nullptr, Hook_T endThreadProcessing=nullptr, ReportSlippageFunc_T slippageFunc=nullptr, NowFunc_T nowFunc=ElapsedTime::precision) | |
| Constructor. | |
| virtual | ~PeriodicScheduler () |
| Virtual destructor. | |
| virtual bool | executeScheduler () |
| This method is used to invoke the scheduler. | |
| virtual void | beginLoop () |
| This method is expected to be called ONCE when the 'thread' is started and prior to the thread entering its 'forever' loop. | |
| virtual void | endLoop () |
| This method is expected to be called ONCE when the 'thread' has exited its 'forever' loop (but before the thread has actually terminated) | |
Protected Attributes | |
| IdleFunc_T | m_idleFunc |
| Cache the Idle function pointer. | |
Protected Attributes inherited from Cpl::Itc::Mailbox | |
| Cpl::System::Signable & | m_eventLoop |
| The EventLoop that I wait-on/dispatch-msgs-from. | |
Protected Attributes inherited from Cpl::System::EventLoop | |
| Thread * | m_myThreadPtr |
| A pointer to the thread the Event Loop executes in. | |
| SharedEventHandlerApi * | m_eventHandler |
| My shared event handler (if I have one) | |
| Cpl::System::Semaphore | m_sema |
| Semaphore associated with the mailbox (note: the Thread semaphore is NOT used) | |
| unsigned long | m_timeout |
| Timeout period for waiting on the next event. | |
| unsigned long | m_timeStartOfLoop |
| Timestamp, in milliseconds, of start of event/wait loop. | |
| Cpl_System_EventFlag_T | m_events |
| The variable holds the current state of all Event Flags. | |
| bool | m_run |
| Flag used to help with the pleaseStop() request. | |
Protected Attributes inherited from Cpl::System::Runnable | |
| bool | m_running |
| Tracks the run state of the instance. | |
Protected Attributes inherited from Cpl::System::TimerManager | |
| Cpl::Container::DList< CounterCallback_ > | m_counters |
| List of active counters. | |
| Cpl::Container::DList< CounterCallback_ > | m_pendingAttach |
| List of Pending-to-attach counters (this happens when timers attach from the timer-expired-callbacks) | |
| unsigned long | m_timeMark |
| Elapsed time of the previous processing cycle. | |
| unsigned long | m_timeNow |
| Elapsed time of the current processing cycle. | |
| bool | m_inTickCall |
| Flag to tracks when I am actively processing/consuming ticks. | |
Protected Attributes inherited from Cpl::System::PeriodicScheduler | |
| Interval_T * | m_intervals |
| List of Intervals Pointers. | |
| ReportSlippageFunc_T | m_reportSlippage |
| Report slippage method. | |
| NowFunc_T | m_nowFunc |
| Current system callback. | |
| Hook_T | m_beginThreadFunc |
| Application hook during thread start-up. | |
| Hook_T | m_endThreadFunc |
| Application hook during thread shutdown. | |
| bool | m_firstExecution |
| Flag to managing the 'first' execution. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Cpl::Container::Item | |
| static void | remove_ (Item *itemPtr) noexcept |
| Helper method to do the proper 'clean-up' for the multiple-containers-error-trap when removing an item from a container. | |
Public Attributes inherited from Cpl::Container::Item | |
| void * | m_nextPtr_ |
| The link field. | |
| void * | m_inListPtr_ |
| Debug field. | |
Protected Member Functions inherited from Cpl::Itc::Mailbox | |
| virtual void | processMessages () noexcept |
| This operation is used process any pending messages. | |
| bool | isPendingMessage () noexcept |
| This method IS thread safe. | |
Protected Member Functions inherited from Cpl::System::EventLoop | |
| virtual void | startEventLoop () noexcept |
| This method is used to initialize the Event Loop's thread has started to executed. | |
| virtual bool | waitAndProcessEvents (bool skipWait=false) noexcept |
| This method is used to wait (and process) the next event(s). | |
| virtual void | stopEventLoop () noexcept |
| This method is used to clean-up the Event Loop's when the thread is being stopped. | |
| virtual void | processEventFlag (uint8_t eventNumber) noexcept |
| This method is used (by the concrete child class(es)) to process one or more Event Flags. | |
Protected Member Functions inherited from Cpl::System::Runnable | |
| Runnable () | |
| Constructor. | |
Protected Member Functions inherited from Cpl::Container::Item | |
| Item () | |
| Constructor. | |
| Item (const char *) | |
| Constructor used ONLY with the child class MapItem: -->special constructor to allow a Map to be statically allocated. | |
Protected Member Functions inherited from Cpl::System::TimerManager | |
| void | addToActiveList (CounterCallback_ &clientToCallback) noexcept |
| Helper method. | |
| virtual void | tick (unsigned long milliseconds=1) noexcept |
| This method is intended to be call by a the timing source and each call to this method represents that one tick has expired, i.e. | |
| virtual void | tickComplete (void) noexcept |
| This method is used by the Tick source to information the Timer Manager that there are no more ticks for the timing source's current tick cycle. | |
Protected Member Functions inherited from Cpl::System::PeriodicScheduler | |
| void | setTimeMarker (Interval_T &interval, ElapsedTime::Precision_T currentTick) noexcept |
| Helper method to Round DOWN to the nearest 'interval' boundary. | |
| typedef void(* Cpl::Itc::PeriodicScheduler::IdleFunc_T) (Cpl::System::ElapsedTime::Precision_T currentTick, bool atLeastOneIntervalExecuted) |
Defines an optional method that is called every time the Runnable's object executes its event/scheduling loop.
|
noexcept |
Constructor.
The argument 'timingTickInMsec' specifies the timing resolution that will be used for Cpl::Timer::Local Timers AND for the periodic scheduling.
|
virtual |
Reimplemented from Cpl::Itc::MailboxServer.
|
protected |
Cache the Idle function pointer.