Arduino Tinker Library
 All Classes Functions Variables
Public Member Functions | List of all members
Tinker::Timeout Class Reference

A class to handle timeout events. More...

#include <Timeout.h>

Public Member Functions

 Timeout ()
 Creates an empty timeout. More...
 
void setTimeout (unsigned long timeout)
 Sets a timeout threshold in milliseconds. More...
 
unsigned long timeout () const
 Returns current timeout threshold. More...
 
void refresh ()
 Refreshes the timeout. More...
 
bool timeoutReached () const
 Returns true if timeout is reached.
 
unsigned long timeToTimeout () const
 Returns the timer's remaining value in milliseconds left until the timeout.
 
unsigned long timeElapsedFromLastRefresh () const
 Returns the elapsed time from last refresh.
 
float percentage () const
 Returns the percentage of the timeout. More...
 

Detailed Description

A class to handle timeout events.

This class permits to handle in an easy way any timeout event

Author
Nicola Pezzotti

Constructor & Destructor Documentation

Tinker::Timeout::Timeout ( )
inline

Creates an empty timeout.

The timeout will be set to 0. Use setTimeout() to specify a timeout threshold

Member Function Documentation

float Tinker::Timeout::percentage ( ) const

Returns the percentage of the timeout.

Varies from 0 to 1.
0 -> timeout refreshed
1 -> timeout reached

void Tinker::Timeout::refresh ( )

Refreshes the timeout.

Resets the counter avoiding the timeout to be reached

void Tinker::Timeout::setTimeout ( unsigned long  timeout)
inline

Sets a timeout threshold in milliseconds.

Parameters
timeoutthreshold in milliseconds
unsigned long Tinker::Timeout::timeout ( ) const
inline

Returns current timeout threshold.

Returns
threshold in milliseconds

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