CppELib 1.7.0
Loading...
Searching...
No Matches
OSWrapper::PeriodicTimer Class Referenceabstract

Abstract class that has functions of common RTOS's periodic timer. More...

#include <PeriodicTimer.h>

Classes

class  UncaughtExceptionHandler
 Interface for handling uncaught exception. More...
 

Public Member Functions

virtual void start ()=0
 Start the timer.
 
virtual void stop ()=0
 Stop the timer.
 
virtual bool isStarted () const =0
 Return true if the timer is started.
 
virtual unsigned long getPeriodInMillis () const =0
 Get the timer period (in milliseconds)
 
virtual void setName (const char *name)=0
 Set the object's name.
 
virtual const char * getName () const =0
 Get the object's name.
 
void setUncaughtExceptionHandler (UncaughtExceptionHandler *handler)
 Set the UncaughtExceptionHandler for this PeriodicTimer.
 
UncaughtExceptionHandlergetUncaughtExceptionHandler () const
 Get the UncaughtExceptionHandler for this PeriodicTimer.
 

Static Public Member Functions

static void setDefaultUncaughtExceptionHandler (UncaughtExceptionHandler *handler)
 Set the default UncaughtExceptionHandler for all the PeriodicTimer.
 
static UncaughtExceptionHandlergetDefaultUncaughtExceptionHandler ()
 Get the default UncaughtExceptionHandler.
 
static PeriodicTimercreate (Runnable *r, unsigned long periodInMillis, const char *name="")
 Create a PeriodicTimer object.
 
static void destroy (PeriodicTimer *t)
 Destroy a PeriodicTimer object.
 

Protected Member Functions

 PeriodicTimer (Runnable *r)
 
virtual ~PeriodicTimer ()
 
void timerMain ()
 Common timer main method.
 

Detailed Description

Abstract class that has functions of common RTOS's periodic timer.

Constructor & Destructor Documentation

◆ PeriodicTimer()

OSWrapper::PeriodicTimer::PeriodicTimer ( Runnable r)
inlineexplicitprotected

◆ ~PeriodicTimer()

virtual OSWrapper::PeriodicTimer::~PeriodicTimer ( )
inlineprotectedvirtual

Member Function Documentation

◆ create()

PeriodicTimer * OSWrapper::PeriodicTimer::create ( Runnable r,
unsigned long  periodInMillis,
const char *  name = "" 
)
static

Create a PeriodicTimer object.

Parameters
rPointer of Runnable object
periodInMillisTimer period in milliseconds
nameName of the object
Returns
If this method succeeds then returns a pointer of PeriodicTimer object, else returns null pointer
Note
Created PeriodicTimer object is stopped. You need to call start() for the PeriodicTimer object.

◆ destroy()

void OSWrapper::PeriodicTimer::destroy ( PeriodicTimer t)
static

Destroy a PeriodicTimer object.

Parameters
tPointer of PeriodicTimer object created by PeriodicTimer::create()
Note
If t is null pointer, do nothing.

◆ getDefaultUncaughtExceptionHandler()

PeriodicTimer::UncaughtExceptionHandler * OSWrapper::PeriodicTimer::getDefaultUncaughtExceptionHandler ( )
static

Get the default UncaughtExceptionHandler.

Returns
The default UncaughtExceptionHandler object

◆ getName()

virtual const char * OSWrapper::PeriodicTimer::getName ( ) const
pure virtual

◆ getPeriodInMillis()

virtual unsigned long OSWrapper::PeriodicTimer::getPeriodInMillis ( ) const
pure virtual

Get the timer period (in milliseconds)

Returns
Timer period (in milliseconds)

Implemented in StdCppOSWrapper::StdCppPeriodicTimer, TestDoubleOSWrapper::TestDoublePeriodicTimer, and WindowsOSWrapper::WindowsPeriodicTimer.

◆ getUncaughtExceptionHandler()

PeriodicTimer::UncaughtExceptionHandler * OSWrapper::PeriodicTimer::getUncaughtExceptionHandler ( ) const

◆ isStarted()

virtual bool OSWrapper::PeriodicTimer::isStarted ( ) const
pure virtual

Return true if the timer is started.

Return values
trueThe timer is already started
falseThe timer is already stopped

Implemented in StdCppOSWrapper::StdCppPeriodicTimer, TestDoubleOSWrapper::TestDoublePeriodicTimer, and WindowsOSWrapper::WindowsPeriodicTimer.

◆ setDefaultUncaughtExceptionHandler()

void OSWrapper::PeriodicTimer::setDefaultUncaughtExceptionHandler ( PeriodicTimer::UncaughtExceptionHandler handler)
static

Set the default UncaughtExceptionHandler for all the PeriodicTimer.

Parameters
handlerPointer of UncaughtExceptionHandler object

◆ setName()

virtual void OSWrapper::PeriodicTimer::setName ( const char *  name)
pure virtual

Set the object's name.

Parameters
nameThe object's name

Implemented in StdCppOSWrapper::StdCppPeriodicTimer, TestDoubleOSWrapper::TestDoublePeriodicTimer, and WindowsOSWrapper::WindowsPeriodicTimer.

◆ setUncaughtExceptionHandler()

void OSWrapper::PeriodicTimer::setUncaughtExceptionHandler ( PeriodicTimer::UncaughtExceptionHandler handler)

Set the UncaughtExceptionHandler for this PeriodicTimer.

Parameters
handlerPointer of UncaughtExceptionHandler object
Note
If set UncaughtExceptionHandler by this method then the default UncaughtExceptionHandler is not called when an exception is not caught.

◆ start()

virtual void OSWrapper::PeriodicTimer::start ( )
pure virtual

Start the timer.

When the timer period elapses, the timer calls Runnable::run() specified at create(). The timer calls the Runnable::run() per period.

Note
If the timer is already started, do nothing.
If the timer is stopped, you can start() again.

Implemented in StdCppOSWrapper::StdCppPeriodicTimer, TestDoubleOSWrapper::TestDoublePeriodicTimer, and WindowsOSWrapper::WindowsPeriodicTimer.

◆ stop()

virtual void OSWrapper::PeriodicTimer::stop ( )
pure virtual

Stop the timer.

Note
If the timer is already stopped, do nothing.

Implemented in StdCppOSWrapper::StdCppPeriodicTimer, TestDoubleOSWrapper::TestDoublePeriodicTimer, and WindowsOSWrapper::WindowsPeriodicTimer.

◆ timerMain()

void OSWrapper::PeriodicTimer::timerMain ( )
protected

Common timer main method.

Note
Called in the concrete class derived from PeriodicTimer.

The documentation for this class was generated from the following files: