41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "humidity" 53 ,_relHum(RELHUM_INVALID)
54 ,_absHum(ABSHUM_INVALID)
55 ,_valueCallbackHumidity(NULL)
56 ,_timedReportCallbackHumidity(NULL)
74 if(json_val->
has(
"relHum")) {
75 _relHum = floor(json_val->
getDouble(
"relHum") * 1000.0 / 65536.0 + 0.5) / 1000.0;
77 if(json_val->
has(
"absHum")) {
78 _absHum = floor(json_val->
getDouble(
"absHum") * 1000.0 / 65536.0 + 0.5) / 1000.0;
107 }
catch (std::exception) {
136 }
catch (std::exception) {
165 }
catch (std::exception) {
213 }
catch (std::exception) {
235 if (callback != NULL) {
242 if (callback != NULL && this->
isOnline()) {
276 if (callback != NULL) {
307 vector<YFUN_DESCR> v_fundescr;
309 string serial, funcId, funcName, funcVal, errmsg;
312 v_fundescr.size() == 0 ||
YHumidityValueCallback _valueCallbackHumidity
double getDouble(const string &key)
yCRITICAL_SECTION _this_cs
void(* YHumidityValueCallback)(YHumidity *func, const string &functionValue)
void(* YHumidityTimedReportCallback)(YHumidity *func, YMeasure measure)
static void _UpdateTimedReportCallbackList(YFunction *func, bool add)
YRETCODE _load_unsafe(int msValidity)
virtual int _invokeValueCallback(string value)
YHumidity(const string &func)
static int DefaultCacheValidity
static YHumidity * FindHumidity(string func)
virtual int _invokeTimedReportCallback(YMeasure value)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
virtual int registerTimedReportCallback(YHumidityTimedReportCallback callback)
static const double RELHUM_INVALID
YHumidity * nextHumidity(void)
static u64 GetTickCount(void)
static YHumidity * FirstHumidity(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
#define YAPI_INVALID_DOUBLE
virtual int _invokeTimedReportCallback(YMeasure value)
virtual int _invokeValueCallback(string value)
static YFunction * _FindFromCache(const string &classname, const string &func)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
virtual int _parseAttr(YJSONObject *json_val)
int set_unit(const string &newval)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
YHumidityTimedReportCallback _timedReportCallbackHumidity
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
virtual int _parseAttr(YJSONObject *json_val)
static void _UpdateValueCallbackList(YFunction *func, bool add)
virtual int registerValueCallback(YHumidityValueCallback callback)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
static const double ABSHUM_INVALID