41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "poweroutput" 53 ,_voltage(VOLTAGE_INVALID)
54 ,_valueCallbackPowerOutput(NULL)
70 if(json_val->
has(
"voltage")) {
99 }
catch (std::exception) {
126 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
127 res =
_setAttr(
"voltage", rest_val);
128 }
catch (std::exception) {
176 }
catch (std::exception) {
198 if (callback != NULL) {
205 if (callback != NULL && this->
isOnline()) {
236 vector<YFUN_DESCR> v_fundescr;
238 string serial, funcId, funcName, funcVal, errmsg;
241 v_fundescr.size() == 0 ||
yCRITICAL_SECTION _this_cs
void(* YPowerOutputValueCallback)(YPowerOutput *func, const string &functionValue)
YRETCODE _load_unsafe(int msValidity)
Y_VOLTAGE_enum get_voltage(void)
static int DefaultCacheValidity
int set_voltage(Y_VOLTAGE_enum newval)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
virtual int registerValueCallback(YPowerOutputValueCallback callback)
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 YPowerOutput * FindPowerOutput(string func)
static const Y_VOLTAGE_enum VOLTAGE_INVALID
static YFunction * _FindFromCache(const string &classname, const string &func)
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)
virtual int _invokeValueCallback(string value)
YPowerOutputValueCallback _valueCallbackPowerOutput
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
YPowerOutput(const string &func)
virtual int _parseAttr(YJSONObject *json_val)
static void _UpdateValueCallbackList(YFunction *func, bool add)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
static YPowerOutput * FirstPowerOutput(void)
virtual int _invokeValueCallback(string value)
YPowerOutput * nextPowerOutput(void)