10#include <DialogYesNoBack.h>
12#include <RotaryEncoder.h>
76 : lcd::ViewBase(
display,
"SetTimerView")
116 virtual void tick(
const bool& forceRedraw) {
117 bool redraw = forceRedraw;
128 display->print(
"Set Lock Timer:");
135 "%s%d%chours %s%d%cminutes ",
148 static time_t lastDisplayedTime = 0;
149 if (redraw || (setTime != lastDisplayedTime)) {
152 strftime(buf, 20,
"(%d.%m.%Y %R)", localtime_r(&setTime, &tmBuf));
156 lastDisplayedTime = setTime;
168 auto direction =
encoder->getDirection();
171 if (direction == RotaryEncoder::Direction::CLOCKWISE) {
193 if (direction == RotaryEncoder::Direction::COUNTERCLOCKWISE) {
233 time_t endDate = time(NULL) +
237 strftime(buf, 61,
"Are you sure to lock\nuntil\n%d.%m.%Y %R?", localtime_r(&endDate, &tmBuf));
241 .showModal(lcd::DialogYesNoBack::DialogResult::no)) {
242 case lcd::DialogYesNoBack::DialogResult::yes:
247 case lcd::DialogYesNoBack::DialogResult::no:
249 case lcd::DialogYesNoBack::DialogResult::back:
251 activatePreviousView();
static void setCachedEndDate(const time_t &cachedEndDate)
Set the Cached End Date.
Definition: LockState.h:403
View used to set a manual timer without EmlaLock in the background.
Definition: SetTimerView.h:19
SetTimerView(const SetTimerView &other)=delete
Copy constructor - not available.
const int numberOfColumns
Number of display-columns.
Definition: SetTimerView.h:30
virtual void activate()
called as soon as the view becomes active
Definition: SetTimerView.h:97
uint8_t numberOfMinutes
current selection of the number of minutes
Definition: SetTimerView.h:54
SetTimerView(LiquidCrystal_PCF8574 *display, RotaryEncoder *encoder, const int &numberOfColumns, const int &numberOfRows)
Construct the new set timer view.
Definition: SetTimerView.h:75
const int numberOfRows
Number of display-rows.
Definition: SetTimerView.h:36
uint8_t numberOfHours
current selection of the number of hours
Definition: SetTimerView.h:48
void handleEncoderRotation(bool &redraw)
handles if the encoder was rotated
Definition: SetTimerView.h:166
RotaryEncoder * encoder
pointer to the encoder instance
Definition: SetTimerView.h:24
bool handleEncoderClick(bool &redraw)
handles if the encoder was rotated
Definition: SetTimerView.h:223
virtual void tick(const bool &forceRedraw)
called during the loop function
Definition: SetTimerView.h:116
SetTimerView(SetTimerView &&other) noexcept=delete
Move constructor - not available.
uint8_t numberOfDays
current selection of the number of days
Definition: SetTimerView.h:42
uint8_t editIndex
selection what field can be changed:
Definition: SetTimerView.h:64
static bool activateView(const ViewId &id)
activates the view described by the id
Definition: ViewStore.h:98
@ SelectDisplayTimePassed
Definition: ViewStore.h:34
views::ConfigurationServerView configurationServerView & display
Definition: main.cpp:57
Definition: ConfigurationServerView.h:10