4#ifndef SRC_SUPLA_CLOCK_CLOCK_H_
5#define SRC_SUPLA_CLOCK_CLOCK_H_
7#include <supla-common/proto.h>
8#include <supla/element.h>
10#include <supla/control/hvac_base.h>
14const char AutomaticTimeSyncCfgTag[] =
"timesync_auto";
94 static time_t GetTimeStamp();
95 static bool GetLocalTime(
struct tm *timeInfo);
107 virtual bool isReady();
108 virtual int getYear();
109 virtual int getMonth();
110 virtual int getDay();
111 virtual int getDayOfWeek();
112 virtual enum DayOfWeek getHvacDayOfWeek();
113 virtual int getHour();
114 virtual int getQuarter();
115 virtual int getMin();
116 virtual int getSec();
117 virtual time_t getTimeStamp();
118 virtual bool getLocalTime(
struct tm *timeInfo);
127 void setUseAutomaticTimeSyncRemoteConfig(
bool value);
128 void printCurrentTime(
const char *prefix =
nullptr);
130 void setAutomaticTimeSync(
bool value) { automaticTimeSync = value; }
133 void setSystemTime(time_t newTime);
134 time_t localtime = {};
135 uint32_t lastServerUpdate = 0;
136 uint32_t lastMillis = 0;
137 bool isClockReady =
false;
138 bool automaticTimeSync =
true;
139 bool useAutomaticTimeSyncRemoteConfig =
true;
Definition SuplaDevice.h:167
static int GetMonth()
Returns month from Clock (if is set and ready).
Definition clock.cpp:36
static enum DayOfWeek GetHvacDayOfWeek()
Returns day of week from Clock to HVAC (if is set and ready).
Definition clock.cpp:57
bool iterateConnected() override
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition clock.cpp:238
static Clock * GetInstance()
Returns pointer of Clock.
Definition clock.cpp:103
static int GetHour()
Returns hour from Clock (if is set and ready).
Definition clock.cpp:64
static int GetYear()
Returns year from Clock (if is set and ready).
Definition clock.cpp:29
static int GetDayOfWeek()
Returns day of week from Clock (if is set and ready).
Definition clock.cpp:50
static bool IsReady()
Checks if Clock is set and ready.
Definition clock.cpp:22
void onTimer() override
Method called on timer interupt.
Definition clock.cpp:222
static int GetDay()
Returns day from Clock (if is set and ready).
Definition clock.cpp:43
void onLoadConfig(SuplaDeviceClass *sdc) override
First method called on element in SuplaDevice.begin().
Definition clock.cpp:255
static int GetSec()
Returns seconds from Clock (if is set and ready).
Definition clock.cpp:85
void onDeviceConfigChange(uint64_t fieldBit) override
Method called when device config is changed.
Definition clock.cpp:279
static int GetMin()
Returns minutes from Clock (if is set and ready).
Definition clock.cpp:78
static int GetQuarter()
Returns quarter from Clock (if is set and ready).
Definition clock.cpp:71
Base class for all elements of SuplaDevice.
Definition element.h:30