41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "realtimeclock" 53 ,_unixTime(UNIXTIME_INVALID)
54 ,_dateTime(DATETIME_INVALID)
55 ,_utcOffset(UTCOFFSET_INVALID)
56 ,_timeSet(TIMESET_INVALID)
57 ,_valueCallbackRealTimeClock(NULL)
74 if(json_val->
has(
"unixTime")) {
77 if(json_val->
has(
"dateTime")) {
80 if(json_val->
has(
"utcOffset")) {
83 if(json_val->
has(
"timeSet")) {
112 }
catch (std::exception) {
135 char buf[32]; sprintf(buf,
"%u", (u32)newval); rest_val = string(buf);
136 res =
_setAttr(
"unixTime", rest_val);
137 }
catch (std::exception) {
166 }
catch (std::exception) {
195 }
catch (std::exception) {
219 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
220 res =
_setAttr(
"utcOffset", rest_val);
221 }
catch (std::exception) {
251 }
catch (std::exception) {
299 }
catch (std::exception) {
321 if (callback != NULL) {
328 if (callback != NULL && this->
isOnline()) {
359 vector<YFUN_DESCR> v_fundescr;
361 string serial, funcId, funcName, funcVal, errmsg;
364 v_fundescr.size() == 0 ||
yCRITICAL_SECTION _this_cs
virtual int registerValueCallback(YRealTimeClockValueCallback callback)
static YRealTimeClock * FirstRealTimeClock(void)
int set_utcOffset(int newval)
YRETCODE _load_unsafe(int msValidity)
virtual int _invokeValueCallback(string value)
Y_TIMESET_enum get_timeSet(void)
string get_dateTime(void)
static const string DATETIME_INVALID
static const s64 UNIXTIME_INVALID
static int DefaultCacheValidity
string getString(const string &key)
virtual int _parseAttr(YJSONObject *json_val)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
static const Y_TIMESET_enum TIMESET_INVALID
YRealTimeClock(const string &func)
#define YAPI_INVALID_STRING
virtual int _parseAttr(YJSONObject *json_val)
int getInt(const string &key)
static YRealTimeClock * FindRealTimeClock(string func)
static u64 GetTickCount(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
static const int UTCOFFSET_INVALID
static YFunction * _FindFromCache(const string &classname, const string &func)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
int set_unixTime(s64 newval)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
YRealTimeClockValueCallback _valueCallbackRealTimeClock
s64 getLong(const string &key)
YRealTimeClock * nextRealTimeClock(void)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
static void _UpdateValueCallbackList(YFunction *func, bool add)
void(* YRealTimeClockValueCallback)(YRealTimeClock *func, const string &functionValue)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
virtual int _invokeValueCallback(string value)