41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "proximity" 53 ,_signalValue(SIGNALVALUE_INVALID)
54 ,_detectionThreshold(DETECTIONTHRESHOLD_INVALID)
55 ,_isPresent(ISPRESENT_INVALID)
56 ,_lastTimeApproached(LASTTIMEAPPROACHED_INVALID)
57 ,_lastTimeRemoved(LASTTIMEREMOVED_INVALID)
58 ,_pulseCounter(PULSECOUNTER_INVALID)
59 ,_pulseTimer(PULSETIMER_INVALID)
60 ,_proximityReportMode(PROXIMITYREPORTMODE_INVALID)
61 ,_valueCallbackProximity(NULL)
62 ,_timedReportCallbackProximity(NULL)
79 if(json_val->
has(
"signalValue")) {
82 if(json_val->
has(
"detectionThreshold")) {
85 if(json_val->
has(
"isPresent")) {
88 if(json_val->
has(
"lastTimeApproached")) {
91 if(json_val->
has(
"lastTimeRemoved")) {
94 if(json_val->
has(
"pulseCounter")) {
97 if(json_val->
has(
"pulseTimer")) {
100 if(json_val->
has(
"proximityReportMode")) {
128 }
catch (std::exception) {
160 }
catch (std::exception) {
186 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
187 res =
_setAttr(
"detectionThreshold", rest_val);
188 }
catch (std::exception) {
219 }
catch (std::exception) {
251 }
catch (std::exception) {
283 }
catch (std::exception) {
314 }
catch (std::exception) {
328 char buf[32]; sprintf(buf,
"%u", (u32)newval); rest_val = string(buf);
329 res =
_setAttr(
"pulseCounter", rest_val);
330 }
catch (std::exception) {
359 }
catch (std::exception) {
391 }
catch (std::exception) {
419 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
420 res =
_setAttr(
"proximityReportMode", rest_val);
421 }
catch (std::exception) {
469 }
catch (std::exception) {
491 if (callback != NULL) {
498 if (callback != NULL && this->
isOnline()) {
532 if (callback != NULL) {
575 vector<YFUN_DESCR> v_fundescr;
577 string serial, funcId, funcName, funcVal, errmsg;
580 v_fundescr.size() == 0 ||
double getDouble(const string &key)
yCRITICAL_SECTION _this_cs
static void _UpdateTimedReportCallbackList(YFunction *func, bool add)
YProximity * nextProximity(void)
YRETCODE _load_unsafe(int msValidity)
YProximityValueCallback _valueCallbackProximity
static const Y_ISPRESENT_enum ISPRESENT_INVALID
YProximityTimedReportCallback _timedReportCallbackProximity
int get_detectionThreshold(void)
Y_PROXIMITYREPORTMODE_enum get_proximityReportMode(void)
s64 get_lastTimeApproached(void)
static int DefaultCacheValidity
static YProximity * FirstProximity(void)
virtual int _parseAttr(YJSONObject *json_val)
static const s64 LASTTIMEAPPROACHED_INVALID
Y_ISPRESENT_enum _isPresent
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
double get_signalValue(void)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
virtual int registerTimedReportCallback(YProximityTimedReportCallback callback)
static const double SIGNALVALUE_INVALID
Y_PROXIMITYREPORTMODE_enum
int getInt(const string &key)
static u64 GetTickCount(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
static const s64 PULSECOUNTER_INVALID
#define YAPI_INVALID_DOUBLE
virtual int _invokeTimedReportCallback(YMeasure value)
virtual int _invokeValueCallback(string value)
YProximity(const string &func)
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_detectionThreshold(int newval)
s64 get_pulseCounter(void)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
virtual int resetCounter(void)
s64 getLong(const string &key)
int set_pulseCounter(s64 newval)
static const int DETECTIONTHRESHOLD_INVALID
static YProximity * FindProximity(string func)
virtual int _invokeTimedReportCallback(YMeasure value)
static const s64 LASTTIMEREMOVED_INVALID
static const s64 PULSETIMER_INVALID
virtual int registerValueCallback(YProximityValueCallback callback)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
Y_PROXIMITYREPORTMODE_enum _proximityReportMode
s64 get_lastTimeRemoved(void)
static void _UpdateValueCallbackList(YFunction *func, bool add)
static const Y_PROXIMITYREPORTMODE_enum PROXIMITYREPORTMODE_INVALID
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
virtual int _invokeValueCallback(string value)
void(* YProximityTimedReportCallback)(YProximity *func, YMeasure measure)
int set_proximityReportMode(Y_PROXIMITYREPORTMODE_enum newval)
void(* YProximityValueCallback)(YProximity *func, const string &functionValue)
Y_ISPRESENT_enum get_isPresent(void)