41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "pwmpowersource" 53 ,_powerMode(POWERMODE_INVALID)
54 ,_valueCallbackPwmPowerSource(NULL)
70 if(json_val->
has(
"powerMode")) {
99 }
catch (std::exception) {
129 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
130 res =
_setAttr(
"powerMode", rest_val);
131 }
catch (std::exception) {
179 }
catch (std::exception) {
201 if (callback != NULL) {
208 if (callback != NULL && this->
isOnline()) {
239 vector<YFUN_DESCR> v_fundescr;
241 string serial, funcId, funcName, funcVal, errmsg;
244 v_fundescr.size() == 0 ||
yCRITICAL_SECTION _this_cs
YRETCODE _load_unsafe(int msValidity)
virtual int _invokeValueCallback(string value)
virtual int _parseAttr(YJSONObject *json_val)
static YPwmPowerSource * FindPwmPowerSource(string func)
static int DefaultCacheValidity
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
YPwmPowerSource(const string &func)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
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 const Y_POWERMODE_enum POWERMODE_INVALID
Y_POWERMODE_enum _powerMode
static YFunction * _FindFromCache(const string &classname, const string &func)
virtual int registerValueCallback(YPwmPowerSourceValueCallback callback)
YPwmPowerSource * nextPwmPowerSource(void)
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)
YPwmPowerSourceValueCallback _valueCallbackPwmPowerSource
void(* YPwmPowerSourceValueCallback)(YPwmPowerSource *func, const string &functionValue)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
static void _UpdateValueCallbackList(YFunction *func, bool add)
int set_powerMode(Y_POWERMODE_enum newval)
bool has(const string &key)
Y_POWERMODE_enum get_powerMode(void)
YRETCODE _setAttr(string attrname, string newvalue)
static YPwmPowerSource * FirstPwmPowerSource(void)
virtual int _invokeValueCallback(string value)