41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "oscontrol" 53 ,_shutdownCountdown(SHUTDOWNCOUNTDOWN_INVALID)
54 ,_valueCallbackOsControl(NULL)
70 if(json_val->
has(
"shutdownCountdown")) {
100 }
catch (std::exception) {
114 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
115 res =
_setAttr(
"shutdownCountdown", rest_val);
116 }
catch (std::exception) {
164 }
catch (std::exception) {
186 if (callback != NULL) {
193 if (callback != NULL && this->
isOnline()) {
238 vector<YFUN_DESCR> v_fundescr;
240 string serial, funcId, funcName, funcVal, errmsg;
243 v_fundescr.size() == 0 ||
yCRITICAL_SECTION _this_cs
static YOsControl * FirstOsControl(void)
virtual int _parseAttr(YJSONObject *json_val)
YRETCODE _load_unsafe(int msValidity)
static int DefaultCacheValidity
YOsControl(const string &func)
void(* YOsControlValueCallback)(YOsControl *func, const string &functionValue)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static const int SHUTDOWNCOUNTDOWN_INVALID
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
static YOsControl * FindOsControl(string func)
virtual int shutdown(int secBeforeShutDown)
virtual int _parseAttr(YJSONObject *json_val)
int getInt(const string &key)
static u64 GetTickCount(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
static YFunction * _FindFromCache(const string &classname, const string &func)
virtual int _invokeValueCallback(string value)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
YOsControl * nextOsControl(void)
int set_shutdownCountdown(int newval)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
static void _UpdateValueCallbackList(YFunction *func, bool add)
virtual int registerValueCallback(YOsControlValueCallback callback)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
int get_shutdownCountdown(void)
virtual int _invokeValueCallback(string value)
YOsControlValueCallback _valueCallbackOsControl