|
SleepHelper
|
Works like AppCallback, but includes additional state data. More...
#include <SleepHelper.h>
Public Member Functions | |
| void | add (std::function< bool(AppCallbackState &, Types... args)> callback) |
| Adds a callback function. Zero or more callbacks can be defined. More... | |
| void | setState (int newState) |
| Set the state. More... | |
| void | setStartState () |
| Set the state to CALLBACK_STATE_START. More... | |
| bool | whileAnyTrue (Types... args) |
| Keeps calling the callback function while any callback returns true. More... | |
| bool | isEmpty () const |
| Returns true if there are no callbacks registered. More... | |
Data Fields | |
| std::vector< std::function< bool(AppCallbackState &, Types... args)> > | callbackFunctions |
| The callback functions. | |
| std::vector< AppCallbackState > | callbackState |
| The state for the callback functions. The array indexes match callbackFunctions. | |
Works like AppCallback, but includes additional state data.
This is used by data capture functions.
|
inline |
Adds a callback function. Zero or more callbacks can be defined.
| callback |
The callback always returns a bool, but the parameters are defined by the template.
|
inline |
Returns true if there are no callbacks registered.
|
inline |
Set the state to CALLBACK_STATE_START.
This is done on each wake cycle.
|
inline |
Set the state.
| newState | The state number, such as CALLBACK_STATE_START |
User code can use positive values for their own state
|
inline |
Keeps calling the callback function while any callback returns true.
| args | Parameters to pass to the callbacks |
Once your callback returns false it will not be called again for this wake cycle. Once all callbacks return false, this function returns false.