7#include "../configuration/Configuration.h"
29 : lcd::ViewBase(
display,
"TimeRestrictedView") {}
48 getBacklightTimeoutManager().delayTimeout();
59 virtual void tick(
const bool& forceRedraw) {
60 getBacklightTimeoutManager().delayTimeout();
62 activatePreviousView();
71 display->print(
"Open Time Restricted");
74 int h = restrictions.startTime / 3600;
75 int m = (restrictions.startTime / 60) % 60;
76 display->printf(
"Start Time: %02d:%02d", h, m);
78 h = restrictions.endTime / 3600;
79 m = (restrictions.startTime / 60) % 60;
80 display->printf(
"End Time: %02d:%02d", h, m);
83 display->print(
"Current Time: 00:00");
87 static time_t lastDisplayedCurrentTime = 0;
88 time_t currentTime = time(NULL);
89 if (forceRedraw || (lastDisplayedCurrentTime / 60 != currentTime / 60)) {
92 lastDisplayedCurrentTime = currentTime;
93 strftime(buf, 6,
"%R", localtime_r(¤tTime, &tmBuf));
const TimeRestrictions & getTimeRestrictions() const
get the timeout of display backlight in seconds
Definition: Configuration.h:354
static Configuration & getSingleton()
Get the Singleton object.
Definition: Configuration.h:162
View used when the safe should be opened but the time is not within the allowed range.
Definition: TimeRestrictedView.h:15
TimeRestrictedView(LiquidCrystal_PCF8574 *display)
Construct the view.
Definition: TimeRestrictedView.h:28
long activationMillis
Time when the view was activated.
Definition: TimeRestrictedView.h:20
virtual void tick(const bool &forceRedraw)
called during the loop function
Definition: TimeRestrictedView.h:59
TimeRestrictedView(const TimeRestrictedView &other)=delete
Copy constructor - not available.
TimeRestrictedView(TimeRestrictedView &&other) noexcept=delete
Move constructor.
virtual void activate()
called as soon as the view becomes active
Definition: TimeRestrictedView.h:47
views::ConfigurationServerView configurationServerView & display
Definition: main.cpp:57
Definition: ConfigurationServerView.h:10