41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "tilt" 53 ,_bandwidth(BANDWIDTH_INVALID)
55 ,_valueCallbackTilt(NULL)
56 ,_timedReportCallbackTilt(NULL)
72 if(json_val->
has(
"bandwidth")) {
75 if(json_val->
has(
"axis")) {
103 }
catch (std::exception) {
127 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
128 res =
_setAttr(
"bandwidth", rest_val);
129 }
catch (std::exception) {
151 }
catch (std::exception) {
196 obj =
new YTilt(func);
199 }
catch (std::exception) {
221 if (callback != NULL) {
228 if (callback != NULL && this->
isOnline()) {
262 if (callback != NULL) {
293 vector<YFUN_DESCR> v_fundescr;
295 string serial, funcId, funcName, funcVal, errmsg;
298 v_fundescr.size() == 0 ||
yCRITICAL_SECTION _this_cs
static void _UpdateTimedReportCallbackList(YFunction *func, bool add)
virtual int registerValueCallback(YTiltValueCallback callback)
YRETCODE _load_unsafe(int msValidity)
virtual int _parseAttr(YJSONObject *json_val)
YTiltValueCallback _valueCallbackTilt
static int DefaultCacheValidity
static const Y_AXIS_enum AXIS_INVALID
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
YTilt(const string &func)
void(* YTiltValueCallback)(YTilt *func, const string &functionValue)
int set_bandwidth(int newval)
int getInt(const string &key)
static YTilt * FindTilt(string func)
static u64 GetTickCount(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
virtual int registerTimedReportCallback(YTiltTimedReportCallback callback)
YTiltTimedReportCallback _timedReportCallbackTilt
virtual int _invokeTimedReportCallback(YMeasure value)
virtual int _invokeValueCallback(string value)
Y_AXIS_enum get_axis(void)
static YFunction * _FindFromCache(const string &classname, const string &func)
static YTilt * FirstTilt(void)
void(* YTiltTimedReportCallback)(YTilt *func, YMeasure measure)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
virtual int _parseAttr(YJSONObject *json_val)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
virtual int _invokeTimedReportCallback(YMeasure value)
static const int BANDWIDTH_INVALID
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
static void _UpdateValueCallbackList(YFunction *func, bool add)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
virtual int _invokeValueCallback(string value)