41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "daisychain" 53 ,_daisyState(DAISYSTATE_INVALID)
54 ,_childCount(CHILDCOUNT_INVALID)
55 ,_requiredChildCount(REQUIREDCHILDCOUNT_INVALID)
56 ,_valueCallbackDaisyChain(NULL)
72 if(json_val->
has(
"daisyState")) {
75 if(json_val->
has(
"childCount")) {
78 if(json_val->
has(
"requiredChildCount")) {
108 }
catch (std::exception) {
137 }
catch (std::exception) {
166 }
catch (std::exception) {
192 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
193 res =
_setAttr(
"requiredChildCount", rest_val);
194 }
catch (std::exception) {
242 }
catch (std::exception) {
264 if (callback != NULL) {
271 if (callback != NULL && this->
isOnline()) {
302 vector<YFUN_DESCR> v_fundescr;
304 string serial, funcId, funcName, funcVal, errmsg;
307 v_fundescr.size() == 0 ||
Y_DAISYSTATE_enum _daisyState
static const int REQUIREDCHILDCOUNT_INVALID
static const Y_DAISYSTATE_enum DAISYSTATE_INVALID
YDaisyChain * nextDaisyChain(void)
yCRITICAL_SECTION _this_cs
static YDaisyChain * FindDaisyChain(string func)
static const int CHILDCOUNT_INVALID
YRETCODE _load_unsafe(int msValidity)
virtual int registerValueCallback(YDaisyChainValueCallback callback)
int set_requiredChildCount(int newval)
static int DefaultCacheValidity
static YDaisyChain * FirstDaisyChain(void)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
Y_DAISYSTATE_enum get_daisyState(void)
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)
void(* YDaisyChainValueCallback)(YDaisyChain *func, const string &functionValue)
static YFunction * _FindFromCache(const string &classname, const string &func)
virtual int _invokeValueCallback(string value)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
YDaisyChain(const string &func)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
YDaisyChainValueCallback _valueCallbackDaisyChain
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
static void _UpdateValueCallbackList(YFunction *func, bool add)
virtual int _parseAttr(YJSONObject *json_val)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
int get_requiredChildCount(void)
virtual int _invokeValueCallback(string value)