41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "current" 53 ,_enabled(ENABLED_INVALID)
54 ,_valueCallbackCurrent(NULL)
55 ,_timedReportCallbackCurrent(NULL)
71 if(json_val->
has(
"enabled")) {
92 }
catch (std::exception) {
106 rest_val = (newval>0 ?
"1" :
"0");
107 res =
_setAttr(
"enabled", rest_val);
108 }
catch (std::exception) {
156 }
catch (std::exception) {
178 if (callback != NULL) {
185 if (callback != NULL && this->
isOnline()) {
219 if (callback != NULL) {
250 vector<YFUN_DESCR> v_fundescr;
252 string serial, funcId, funcName, funcVal, errmsg;
255 v_fundescr.size() == 0 ||
yCRITICAL_SECTION _this_cs
static YCurrent * FirstCurrent(void)
static void _UpdateTimedReportCallbackList(YFunction *func, bool add)
YRETCODE _load_unsafe(int msValidity)
int set_enabled(Y_ENABLED_enum newval)
Y_ENABLED_enum get_enabled(void)
static int DefaultCacheValidity
YCurrentTimedReportCallback _timedReportCallbackCurrent
YCurrent(const string &func)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static const Y_ENABLED_enum ENABLED_INVALID
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
YCurrent * nextCurrent(void)
void(* YCurrentValueCallback)(YCurrent *func, const string &functionValue)
virtual int _invokeValueCallback(string value)
int getInt(const string &key)
virtual int _parseAttr(YJSONObject *json_val)
static u64 GetTickCount(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
virtual int _invokeTimedReportCallback(YMeasure value)
virtual int _invokeValueCallback(string value)
static YFunction * _FindFromCache(const string &classname, const string &func)
virtual int registerTimedReportCallback(YCurrentTimedReportCallback callback)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
virtual int registerValueCallback(YCurrentValueCallback callback)
virtual int _parseAttr(YJSONObject *json_val)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
YCurrentValueCallback _valueCallbackCurrent
void(* YCurrentTimedReportCallback)(YCurrent *func, YMeasure measure)
static YCurrent * FindCurrent(string func)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
virtual int _invokeTimedReportCallback(YMeasure value)
static void _UpdateValueCallbackList(YFunction *func, bool add)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)