7#include "../LockState.h"
9#include "../configuration/Configuration.h"
14#include <RotaryEncoder.h>
57 : lcd::ViewBase(
display,
"UnlockSafeView")
81 display->print(
"Verifying Emlalock");
99 virtual void tick(
const bool& forceRedraw) {
109 activatePreviousView();
119 activatePreviousView();
124 static unsigned long coilActivationTime = 0;
128 display->print(
"Safe unlocked");
129 coilActivationTime = millis();
136 for (
int i = 0; i < (millis() - coilActivationTime) / 500; i++) {
141 if ((millis() - coilActivationTime > 10000) || (
encoder->getNewClick())) {
143 activatePreviousView();
#define COIL_PIN
GPIO the coil of the safe is connected to.
Definition: HardwareConfiguration.h:10
#define SAFE_COIL_UNLOCKED
Value of the COIL_PIN if the coil should be unlocked.
Definition: HardwareConfiguration.h:30
#define SAFE_COIL_LOCKED
Value of the COIL_PIN if the coil should be locked.
Definition: HardwareConfiguration.h:25
static const time_t & getEndDate()
Get the End Date.
Definition: LockState.h:325
static const time_t & getLastUpdateTime()
Get the time of the last update over the emlalock api.
Definition: LockState.h:438
static const time_t & getCleaningEndDate()
Get the End Date of the current cleaning opening (or 0)
Definition: LockState.h:416
Static class accessing the configuration.
Definition: Configuration.h:20
const bool & getAutoLockHygieneOpeningTimeout() const
return if the safe should automatically lock after the time for hygiene opening is over....
Definition: Configuration.h:346
static Configuration & getSingleton()
Get the Singleton object.
Definition: Configuration.h:162
void triggerRefresh()
Triggers the client to reload the current state from the EmlaLock server.
Definition: EmlaLockApi.h:105
static EmlaLockApi & getSingleton(bool offlineMode=false)
Get the singleton instance of the API handler.
Definition: EmlaLockApi.h:71
View used to unlock the safe.
Definition: UnlockSafeView.h:22
UnlockSafeView(const UnlockSafeView &other)=delete
Copy constructor - not available.
virtual void tick(const bool &forceRedraw)
called during the loop function
Definition: UnlockSafeView.h:99
virtual void activate()
called as soon as the view becomes active
Definition: UnlockSafeView.h:78
const int numberOfRows
Number of display-rows.
Definition: UnlockSafeView.h:39
RotaryEncoder * encoder
pointer to the encoder instance
Definition: UnlockSafeView.h:27
const int numberOfColumns
Number of display-columns.
Definition: UnlockSafeView.h:33
UnlockSafeView(UnlockSafeView &&other) noexcept=delete
Move constructor - not available.
UnlockSafeView(LiquidCrystal_PCF8574 *display, RotaryEncoder *encoder, const int &numberOfColumns, const int &numberOfRows)
Construct the vie.
Definition: UnlockSafeView.h:56
time_t activationTime
Time when this view was activated.
Definition: UnlockSafeView.h:45
views::ConfigurationServerView configurationServerView & display
Definition: main.cpp:57
Definition: ConfigurationServerView.h:10