41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "altitude" 54 ,_technology(TECHNOLOGY_INVALID)
55 ,_valueCallbackAltitude(NULL)
56 ,_timedReportCallbackAltitude(NULL)
74 if(json_val->
has(
"qnh")) {
75 _qnh = floor(json_val->
getDouble(
"qnh") * 1000.0 / 65536.0 + 0.5) / 1000.0;
77 if(json_val->
has(
"technology")) {
100 char buf[32]; sprintf(buf,
"%d", (
int)floor(newval * 65536.0 + 0.5)); rest_val = string(buf);
101 res =
_setAttr(
"currentValue", rest_val);
102 }
catch (std::exception) {
129 char buf[32]; sprintf(buf,
"%d", (
int)floor(newval * 65536.0 + 0.5)); rest_val = string(buf);
131 }
catch (std::exception) {
162 }
catch (std::exception) {
193 }
catch (std::exception) {
241 }
catch (std::exception) {
263 if (callback != NULL) {
270 if (callback != NULL && this->
isOnline()) {
304 if (callback != NULL) {
335 vector<YFUN_DESCR> v_fundescr;
337 string serial, funcId, funcName, funcVal, errmsg;
340 v_fundescr.size() == 0 ||
YAltitude * nextAltitude(void)
double getDouble(const string &key)
yCRITICAL_SECTION _this_cs
static void _UpdateTimedReportCallbackList(YFunction *func, bool add)
virtual int _parseAttr(YJSONObject *json_val)
YRETCODE _load_unsafe(int msValidity)
virtual int registerValueCallback(YAltitudeValueCallback callback)
int set_currentValue(double newval)
YAltitude(const string &func)
static int DefaultCacheValidity
string getString(const string &key)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
void(* YAltitudeTimedReportCallback)(YAltitude *func, YMeasure measure)
static YAltitude * FindAltitude(string func)
#define YAPI_INVALID_STRING
static u64 GetTickCount(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)
virtual int _invokeValueCallback(string value)
virtual int _invokeTimedReportCallback(YMeasure value)
static YFunction * _FindFromCache(const string &classname, const string &func)
string get_technology(void)
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)
static YAltitude * FirstAltitude(void)
static const string TECHNOLOGY_INVALID
void(* YAltitudeValueCallback)(YAltitude *func, const string &functionValue)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
YAltitudeValueCallback _valueCallbackAltitude
static const double QNH_INVALID
static void _UpdateValueCallbackList(YFunction *func, bool add)
virtual int registerTimedReportCallback(YAltitudeTimedReportCallback callback)
bool has(const string &key)
YAltitudeTimedReportCallback _timedReportCallbackAltitude
YRETCODE _setAttr(string attrname, string newvalue)
int set_qnh(double newval)