EmlaLockSafe
EmergencyMenu.h
Go to the documentation of this file.
1
5#pragma once
6
7#include "ViewStore.h"
8
9#include <MenuView.h>
10
11namespace views {
15class EmergencyMenu : public lcd::MenuView {
16public:
25 EmergencyMenu(LiquidCrystal_PCF8574* display, RotaryEncoder* encoder, const int& numberOfColumns, const int& numberOfRows)
26 : lcd::MenuView(display, "EmergencyMenu", encoder, "Emergency Menu", numberOfColumns, numberOfRows) {}
27
28public:
32 EmergencyMenu(const EmergencyMenu& other) = delete;
33
34public:
38 EmergencyMenu(EmergencyMenu&& other) noexcept = delete;
39
40protected:
44 virtual void activate() {
45 // is this the first time activate is called?
46 if (menuItems.empty()) {
47 // create menu items
48 createMenuItem("Unlock with key", [this](MenuItem*) {
50 });
51 createMenuItem("Start Wifi", [this](MenuItem*) {
53 });
54 createMenuItem("Offline Mode", [this](MenuItem*) {
55 if (LockState::getEndDate() > time(NULL)) {
57 }
58 else {
60 }
61 });
62 }
63 lcd::MenuView::activate();
64 }
65};
66} // namespace views
static const time_t & getEndDate()
Get the End Date.
Definition: LockState.h:325
Emergency menu.
Definition: EmergencyMenu.h:15
EmergencyMenu(LiquidCrystal_PCF8574 *display, RotaryEncoder *encoder, const int &numberOfColumns, const int &numberOfRows)
Construct a new main menu object.
Definition: EmergencyMenu.h:25
EmergencyMenu(const EmergencyMenu &other)=delete
Copy constructor - not available.
EmergencyMenu(EmergencyMenu &&other) noexcept=delete
Move constructor - not available otherwise we get problems with the callbacks.
virtual void activate()
called as soon as the view becomes active
Definition: EmergencyMenu.h:44
static bool activateView(const ViewId &id)
activates the view described by the id
Definition: ViewStore.h:98
@ EmergencyEnterKeyView
Definition: ViewStore.h:25
@ WifiConnectingView
Definition: ViewStore.h:39
@ LockedView
Definition: ViewStore.h:31
@ UnlockedMainMenu
Definition: ViewStore.h:37
views::ConfigurationServerView configurationServerView & display
Definition: main.cpp:57
RotaryEncoder encoder(ENCODER_PIN_CLK, ENCODER_PIN_DT, ENCODER_SWITCH)
Definition: ConfigurationServerView.h:10