Kangaroo Library for Arduino
Use reliable Packet Serial to communicate with your Kangaroo.
Public Member Functions | List of all members
KangarooTimeout Class Reference

Encapsulates a starting time and duration. More...

Public Member Functions

 KangarooTimeout (int32_t timeoutMS)
 
boolean canExpire () const
 
boolean expired () const
 
void expire ()
 
void reset ()
 

Detailed Description

Encapsulates a starting time and duration.

The same KangarooTimeout can be reused between different calls.

Constructor & Destructor Documentation

KangarooTimeout::KangarooTimeout ( int32_t  timeoutMS)

Constructs a KangarooTimeout object. The starting time is captured.

Parameters
timeoutMSThe timeout duration, in milliseconds.

Member Function Documentation

boolean KangarooTimeout::canExpire ( ) const

Gets whether the timeout can expire. If the KangarooTimeout was created with a timeout of KANGAROO_INFINITE_TIMEOUT, it cannot expire.

Returns
True if the timeout can expire.
void KangarooTimeout::expire ( )

Causes the timeout to expire immediately.

boolean KangarooTimeout::expired ( ) const

Gets whether the timeout has expired.

Returns
True if the timeout has expired.
void KangarooTimeout::reset ( )

Captures the current time and uses it as the new starting time for the timeout.