EmlaLockSafe
|
Singleton class managing the current lock state. The class also automatically saves the lock state to flash so we know what's going on after a reboot even if there is no wifi. More...
#include <LockState.h>
Public Types | |
enum class | Mode : enumBaseType { emlalock = 0 , manual = 1 } |
Current mode of the safe. More... | |
enum class | DisplayTimePassed : enumBaseType { no = 0 , yes = 1 } |
States for the selection how the passed time should be displayed. More... | |
enum class | DisplayTimeLeft : enumBaseType { no = 0 , yes = 1 , temperature = 2 , timeWithPenalty = 3 , timeWithRandomPenalty = 4 } |
States for the selection how the time left should be displayed. More... | |
using | enumBaseType = uint8_t |
Enum basetype used for saving to the flash. More... | |
Static Public Member Functions | |
static const Mode & | getMode () |
Get the mode. More... | |
static void | setMode (const Mode &mode) |
Set the mode. More... | |
static const DisplayTimePassed & | getDisplayTimePassed () |
Get how the time passed should be displayed. More... | |
static void | setDisplayTimePassed (const DisplayTimePassed &displayTimePassed) |
Set how the time passed should be displayed. More... | |
static const DisplayTimeLeft & | getDisplayTimeLeft () |
Get how the time left should be displayed. More... | |
static void | setDisplayTimeLeft (const DisplayTimeLeft &displayTimeLeft) |
Set how the time left should be displayed. More... | |
static const time_t & | getStartDate () |
Get the Start Date. More... | |
static void | setStartDate (const time_t &startDate) |
Set the Start Date. More... | |
static const time_t & | getEndDate () |
Get the End Date. More... | |
static void | setEndDate (const time_t &endDate) |
Set the End Date. More... | |
static const uint32_t & | getNumberOfFailedSessions () |
Get the number of failed sessions. More... | |
static void | setNumberOfFailedSessions (const uint32_t &numberOfFailedSessions) |
Set the number of failed sessions. More... | |
static const String & | getTemperatureString () |
Get the temperature string. More... | |
static void | setTemperatureString (const String &temperatureString) |
Set the temperature string. More... | |
static const time_t & | getCachedEndDate () |
Get the Cached End Date. More... | |
static void | setCachedEndDate (const time_t &cachedEndDate) |
Set the Cached End Date. More... | |
static const time_t & | getCleaningEndDate () |
Get the End Date of the current cleaning opening (or 0) More... | |
static void | setCleaningEndDate (const time_t &cleaningEndDate) |
Set the End Date of the current cleaning opening. More... | |
static const time_t & | getLastUpdateTime () |
Get the time of the last update over the emlalock api. More... | |
static void | setLastUpdateTime (const time_t &lastUpdateTime) |
Set the time of the last update over the emlalock api. More... | |
Protected Member Functions | |
LockState () | |
Constructs the lock state by trying to reading the state from flash. More... | |
void | loadData () |
Loads the current state of the object to the flash. More... | |
void | saveData () |
Saves the current state of the object to the flash. More... | |
Static Protected Member Functions | |
static LockState & | getSingleton () |
Get the singleton instance. More... | |
Protected Attributes | |
std::mutex | mtx |
mutex used to synchronize the data access More... | |
Mode | mode |
The mode. More... | |
DisplayTimePassed | displayTimePassed |
how the passed time should be displayed More... | |
DisplayTimeLeft | displayTimeLeft |
how the passed time should be displayed More... | |
time_t | startDate |
start date of the current session More... | |
time_t | endDate |
end date of the current session More... | |
String | temperatureString |
temperature string More... | |
uint32_t | numberOfFailedSessions |
The number of failed session. More... | |
time_t | cachedEndDate |
chache for the end date of the session which is currently configured. This value won't be saved to the flash! More... | |
time_t | cleaningEndDate |
end date of the current cleaning opening or 0 if not opened for cleaning. This value won't be saved to the flash! More... | |
time_t | lastUpdateTime |
time of the last update More... | |
Singleton class managing the current lock state. The class also automatically saves the lock state to flash so we know what's going on after a reboot even if there is no wifi.
For more details see secLockstate
Access to this class is thread-safe
using LockState::enumBaseType = uint8_t |
Enum basetype used for saving to the flash.
|
strong |
|
strong |
|
strong |
|
inlineprotected |
Constructs the lock state by trying to reading the state from flash.
|
inlinestatic |
Get the Cached End Date.
|
inlinestatic |
Get the End Date of the current cleaning opening (or 0)
|
inlinestatic |
Get how the time left should be displayed.
|
inlinestatic |
Get how the time passed should be displayed.
|
inlinestatic |
Get the End Date.
|
inlinestatic |
Get the time of the last update over the emlalock api.
|
inlinestatic |
Get the mode.
|
inlinestatic |
Get the number of failed sessions.
|
inlinestaticprotected |
Get the singleton instance.
|
inlinestatic |
Get the Start Date.
|
inlinestatic |
Get the temperature string.
|
inlineprotected |
Loads the current state of the object to the flash.
|
inlineprotected |
Saves the current state of the object to the flash.
|
inlinestatic |
Set the Cached End Date.
|
inlinestatic |
Set the End Date of the current cleaning opening.
|
inlinestatic |
Set how the time left should be displayed.
|
inlinestatic |
Set how the time passed should be displayed.
|
inlinestatic |
Set the End Date.
|
inlinestatic |
Set the time of the last update over the emlalock api.
|
inlinestatic |
Set the mode.
|
inlinestatic |
Set the number of failed sessions.
|
inlinestatic |
Set the Start Date.
|
inlinestatic |
Set the temperature string.
|
protected |
chache for the end date of the session which is currently configured. This value won't be saved to the flash!
|
protected |
end date of the current cleaning opening or 0 if not opened for cleaning. This value won't be saved to the flash!
|
protected |
how the passed time should be displayed
|
protected |
how the passed time should be displayed
|
protected |
end date of the current session
|
protected |
time of the last update
|
protected |
The mode.
|
protected |
mutex used to synchronize the data access
|
protected |
The number of failed session.
|
protected |
start date of the current session
|
protected |
temperature string