41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "gps" 53 ,_isFixed(ISFIXED_INVALID)
54 ,_satCount(SATCOUNT_INVALID)
55 ,_coordSystem(COORDSYSTEM_INVALID)
56 ,_latitude(LATITUDE_INVALID)
57 ,_longitude(LONGITUDE_INVALID)
58 ,_dilution(DILUTION_INVALID)
59 ,_altitude(ALTITUDE_INVALID)
60 ,_groundSpeed(GROUNDSPEED_INVALID)
61 ,_direction(DIRECTION_INVALID)
62 ,_unixTime(UNIXTIME_INVALID)
63 ,_dateTime(DATETIME_INVALID)
64 ,_utcOffset(UTCOFFSET_INVALID)
65 ,_command(COMMAND_INVALID)
66 ,_valueCallbackGps(NULL)
90 if(json_val->
has(
"isFixed")) {
93 if(json_val->
has(
"satCount")) {
96 if(json_val->
has(
"coordSystem")) {
99 if(json_val->
has(
"latitude")) {
102 if(json_val->
has(
"longitude")) {
105 if(json_val->
has(
"dilution")) {
108 if(json_val->
has(
"altitude")) {
111 if(json_val->
has(
"groundSpeed")) {
114 if(json_val->
has(
"direction")) {
117 if(json_val->
has(
"unixTime")) {
120 if(json_val->
has(
"dateTime")) {
123 if(json_val->
has(
"utcOffset")) {
126 if(json_val->
has(
"command")) {
155 }
catch (std::exception) {
184 }
catch (std::exception) {
214 }
catch (std::exception) {
238 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
239 res =
_setAttr(
"coordSystem", rest_val);
240 }
catch (std::exception) {
269 }
catch (std::exception) {
298 }
catch (std::exception) {
329 }
catch (std::exception) {
359 }
catch (std::exception) {
388 }
catch (std::exception) {
419 }
catch (std::exception) {
450 }
catch (std::exception) {
479 }
catch (std::exception) {
508 }
catch (std::exception) {
533 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
534 res =
_setAttr(
"utcOffset", rest_val);
535 }
catch (std::exception) {
557 }
catch (std::exception) {
572 res =
_setAttr(
"command", rest_val);
573 }
catch (std::exception) {
618 obj =
new YGps(func);
621 }
catch (std::exception) {
643 if (callback != NULL) {
650 if (callback != NULL && this->
isOnline()) {
681 vector<YFUN_DESCR> v_fundescr;
683 string serial, funcId, funcName, funcVal, errmsg;
686 v_fundescr.size() == 0 ||
static const Y_ISFIXED_enum ISFIXED_INVALID
static const string COMMAND_INVALID
double getDouble(const string &key)
yCRITICAL_SECTION _this_cs
static const double DIRECTION_INVALID
static const string DATETIME_INVALID
virtual int _parseAttr(YJSONObject *json_val)
static const string LATITUDE_INVALID
virtual int _invokeValueCallback(string value)
string get_longitude(void)
YRETCODE _load_unsafe(int msValidity)
Y_COORDSYSTEM_enum _coordSystem
double get_dilution(void)
void(* YGpsValueCallback)(YGps *func, const string &functionValue)
YGpsValueCallback _valueCallbackGps
static YGps * FirstGps(void)
static int DefaultCacheValidity
string getString(const string &key)
Y_COORDSYSTEM_enum get_coordSystem(void)
int set_utcOffset(int newval)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
static const int UTCOFFSET_INVALID
static const s64 SATCOUNT_INVALID
static const string LONGITUDE_INVALID
#define YAPI_INVALID_STRING
virtual int _parseAttr(YJSONObject *json_val)
double get_altitude(void)
int getInt(const string &key)
static u64 GetTickCount(void)
Y_ISFIXED_enum get_isFixed(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
#define YAPI_INVALID_DOUBLE
static YFunction * _FindFromCache(const string &classname, const string &func)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
static const double DILUTION_INVALID
double get_direction(void)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
static const double GROUNDSPEED_INVALID
s64 getLong(const string &key)
static const s64 UNIXTIME_INVALID
string get_latitude(void)
string get_dateTime(void)
int set_coordSystem(Y_COORDSYSTEM_enum newval)
static const double ALTITUDE_INVALID
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
static const Y_COORDSYSTEM_enum COORDSYSTEM_INVALID
static YGps * FindGps(string func)
static void _UpdateValueCallbackList(YFunction *func, bool add)
int set_command(const string &newval)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
virtual int registerValueCallback(YGpsValueCallback callback)
double get_groundSpeed(void)
virtual int _invokeValueCallback(string value)