41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "led" 53 ,_power(POWER_INVALID)
54 ,_luminosity(LUMINOSITY_INVALID)
55 ,_blinking(BLINKING_INVALID)
56 ,_valueCallbackLed(NULL)
72 if(json_val->
has(
"power")) {
75 if(json_val->
has(
"luminosity")) {
78 if(json_val->
has(
"blinking")) {
106 }
catch (std::exception) {
129 rest_val = (newval>0 ?
"1" :
"0");
131 }
catch (std::exception) {
160 }
catch (std::exception) {
183 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
184 res =
_setAttr(
"luminosity", rest_val);
185 }
catch (std::exception) {
215 }
catch (std::exception) {
239 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
240 res =
_setAttr(
"blinking", rest_val);
241 }
catch (std::exception) {
286 obj =
new YLed(func);
289 }
catch (std::exception) {
311 if (callback != NULL) {
318 if (callback != NULL && this->
isOnline()) {
349 vector<YFUN_DESCR> v_fundescr;
351 string serial, funcId, funcName, funcVal, errmsg;
354 v_fundescr.size() == 0 ||
virtual int _parseAttr(YJSONObject *json_val)
yCRITICAL_SECTION _this_cs
void(* YLedValueCallback)(YLed *func, const string &functionValue)
YRETCODE _load_unsafe(int msValidity)
static const Y_BLINKING_enum BLINKING_INVALID
static int DefaultCacheValidity
static const Y_POWER_enum POWER_INVALID
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static const int LUMINOSITY_INVALID
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
static YLed * FindLed(string func)
Y_POWER_enum get_power(void)
virtual int _parseAttr(YJSONObject *json_val)
static YLed * FirstLed(void)
Y_BLINKING_enum get_blinking(void)
int getInt(const string &key)
static u64 GetTickCount(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
int set_luminosity(int newval)
static YFunction * _FindFromCache(const string &classname, const string &func)
int set_blinking(Y_BLINKING_enum newval)
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)
YLedValueCallback _valueCallbackLed
int set_power(Y_POWER_enum newval)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
virtual int _invokeValueCallback(string value)
static void _UpdateValueCallbackList(YFunction *func, bool add)
virtual int registerValueCallback(YLedValueCallback callback)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
Y_BLINKING_enum _blinking
virtual int _invokeValueCallback(string value)