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

Abstract class that has functions of common RTOS's one-shot timer. More...

#include <OneShotTimer.h>

Classes

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

Public Member Functions

virtual void start (unsigned long timeInMillis)=0
 Start the timer.
 
virtual void stop ()=0
 Stop the timer.
 
virtual bool isStarted () const =0
 Return true if the timer is started.
 
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 OneShotTimer.
 
UncaughtExceptionHandlergetUncaughtExceptionHandler () const
 Get the UncaughtExceptionHandler for this OneShotTimer.
 

Static Public Member Functions

static void setDefaultUncaughtExceptionHandler (UncaughtExceptionHandler *handler)
 Set the default UncaughtExceptionHandler for all the OneShotTimer.
 
static UncaughtExceptionHandlergetDefaultUncaughtExceptionHandler ()
 Get the default UncaughtExceptionHandler.
 
static OneShotTimercreate (Runnable *r, const char *name="")
 Create an OneShotTimer object.
 
static void destroy (OneShotTimer *t)
 Destroy an OneShotTimer object.
 

Protected Member Functions

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

Detailed Description

Abstract class that has functions of common RTOS's one-shot timer.

Constructor & Destructor Documentation

◆ OneShotTimer()

OSWrapper::OneShotTimer::OneShotTimer ( Runnable r)
inlineexplicitprotected

◆ ~OneShotTimer()

virtual OSWrapper::OneShotTimer::~OneShotTimer ( )
inlineprotectedvirtual

Member Function Documentation

◆ create()

OneShotTimer * OSWrapper::OneShotTimer::create ( Runnable r,
const char *  name = "" 
)
static

Create an OneShotTimer object.

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

◆ destroy()

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

Destroy an OneShotTimer object.

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

◆ getDefaultUncaughtExceptionHandler()

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

Get the default UncaughtExceptionHandler.

Returns
The default UncaughtExceptionHandler object

◆ getName()

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

◆ getUncaughtExceptionHandler()

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

Get the UncaughtExceptionHandler for this OneShotTimer.

Returns
The UncaughtExceptionHandler object

◆ isStarted()

virtual bool OSWrapper::OneShotTimer::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::StdCppOneShotTimer, TestDoubleOSWrapper::TestDoubleOneShotTimer, and WindowsOSWrapper::WindowsOneShotTimer.

◆ setDefaultUncaughtExceptionHandler()

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

Set the default UncaughtExceptionHandler for all the OneShotTimer.

Parameters
handlerPointer of UncaughtExceptionHandler object

◆ setName()

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

Set the object's name.

Parameters
nameThe object's name

Implemented in StdCppOSWrapper::StdCppOneShotTimer, TestDoubleOSWrapper::TestDoubleOneShotTimer, and WindowsOSWrapper::WindowsOneShotTimer.

◆ setUncaughtExceptionHandler()

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

Set the UncaughtExceptionHandler for this OneShotTimer.

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::OneShotTimer::start ( unsigned long  timeInMillis)
pure virtual

Start the timer.

After the timeInMillis elapses, the timer calls Runnable::run() specified at create(). When the timer is fired one time, the timer is stopped.

Parameters
timeInMillisTime in milliseconds until the timer is fired
Note
If the timer is already started, do nothing.
If the timer is stopped, you can start() again.

Implemented in StdCppOSWrapper::StdCppOneShotTimer, TestDoubleOSWrapper::TestDoubleOneShotTimer, and WindowsOSWrapper::WindowsOneShotTimer.

◆ stop()

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

Stop the timer.

Before the timer is fired, it stops the timer.

Note
If the timer is already stopped, do nothing.

Implemented in StdCppOSWrapper::StdCppOneShotTimer, TestDoubleOSWrapper::TestDoubleOneShotTimer, and WindowsOSWrapper::WindowsOneShotTimer.

◆ timerMain()

void OSWrapper::OneShotTimer::timerMain ( )
protected

Common timer main method.

Note
Called in the concrete class derived from OneShotTimer.

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