Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
YGps Class Reference

#include <yocto_gps.h>

Inheritance diagram for YGps:
Inheritance graph
[legend]

Public Member Functions

virtual int _invokeValueCallback (string value)
 
double altitude (void)
 
string command (void)
 
Y_COORDSYSTEM_enum coordSystem (void)
 
string dateTime (void)
 
double dilution (void)
 
double direction (void)
 
double get_altitude (void)
 
string get_command (void)
 
Y_COORDSYSTEM_enum get_coordSystem (void)
 
string get_dateTime (void)
 
double get_dilution (void)
 
double get_direction (void)
 
double get_groundSpeed (void)
 
Y_ISFIXED_enum get_isFixed (void)
 
string get_latitude (void)
 
string get_longitude (void)
 
s64 get_satCount (void)
 
s64 get_unixTime (void)
 
int get_utcOffset (void)
 
double groundSpeed (void)
 
Y_ISFIXED_enum isFixed (void)
 
string latitude (void)
 
string longitude (void)
 
YGpsnext (void)
 
YGpsnextGps (void)
 
virtual int registerValueCallback (YGpsValueCallback callback)
 
s64 satCount (void)
 
int set_command (const string &newval)
 
int set_coordSystem (Y_COORDSYSTEM_enum newval)
 
int set_utcOffset (int newval)
 
int setCommand (const string &newval)
 
int setCoordSystem (Y_COORDSYSTEM_enum newval)
 
int setUtcOffset (int newval)
 
s64 unixTime (void)
 
int utcOffset (void)
 
 ~YGps ()
 
- Public Member Functions inherited from YFunction
void _clearDataStreamCache ()
 
string _decode_json_string (const string &json)
 
string _download (const string &url)
 
YDataStream_findDataStream (YDataSet &dataset, const string &def)
 
string _get_json_path (const string &json, const string &path)
 
vector< string > _json_get_array (const string &json)
 
string _json_get_key (const string &json, const string &data)
 
string _json_get_string (const string &json)
 
int _parseEx (yJsonStateMachine &j)
 
virtual int _parserHelper (void)
 
string _parseString (yJsonStateMachine &j)
 
string _request (const string &request)
 
string _requestEx (int tcpchan, const string &request, yapiRequestProgressCallback callback, void *context)
 
void _throw (YRETCODE errType, string errMsg)
 
YRETCODE _upload (const string &path, const string &content)
 
YRETCODE _uploadWithProgress (const string &path, const string &content, yapiRequestProgressCallback callback, void *context)
 
string advertisedValue (void)
 
void clearCache ()
 
string describe (void)
 
string errMessage (void)
 
string errorMessage (void)
 
YRETCODE errorType (void)
 
YRETCODE errType (void)
 
YFUN_DESCR functionDescriptor (void)
 
string get_advertisedValue (void)
 
string get_errorMessage (void)
 
YRETCODE get_errorType (void)
 
virtual string get_friendlyName (void)
 
YFUN_DESCR get_functionDescriptor (void)
 
string get_functionId (void)
 
string get_hardwareId (void)
 
string get_hubSerial ()
 
string get_logicalName (void)
 
YModuleget_module (void)
 
void * get_userData (void)
 
bool isOnline (void)
 
YRETCODE load (int msValidity)
 
virtual string loadAttribute (string attrName)
 
string logicalName (void)
 
YModulemodule (void)
 
virtual int muteValueCallbacks (void)
 
YFunctionnext (void)
 
YFunctionnextFunction (void)
 
virtual int registerValueCallback (YFunctionValueCallback callback)
 
int set_advertisedValue (const string &newval)
 
int set_logicalName (const string &newval)
 
void set_userData (void *data)
 
int setAdvertisedValue (const string &newval)
 
int setLogicalName (const string &newval)
 
void setUserData (void *data)
 
virtual int unmuteValueCallbacks (void)
 
void * userData (void)
 
virtual ~YFunction ()
 

Static Public Member Functions

static YGpsFind (string func)
 
static YGpsFindGps (string func)
 
static YGpsFirst (void)
 
static YGpsFirstGps (void)
 
- Static Public Member Functions inherited from YFunction
static void _ClearCache (void)
 
static YFunctionFind (string func)
 
static YFunctionFindFunction (string func)
 
static YFunctionFirst (void)
 
static YFunctionFirstFunction (void)
 

Static Public Attributes

static const double ALTITUDE_INVALID = YAPI_INVALID_DOUBLE
 
static const string COMMAND_INVALID = YAPI_INVALID_STRING
 
static const Y_COORDSYSTEM_enum COORDSYSTEM_GPS_D = Y_COORDSYSTEM_GPS_D
 
static const Y_COORDSYSTEM_enum COORDSYSTEM_GPS_DM = Y_COORDSYSTEM_GPS_DM
 
static const Y_COORDSYSTEM_enum COORDSYSTEM_GPS_DMS = Y_COORDSYSTEM_GPS_DMS
 
static const Y_COORDSYSTEM_enum COORDSYSTEM_INVALID = Y_COORDSYSTEM_INVALID
 
static const string DATETIME_INVALID = YAPI_INVALID_STRING
 
static const double DILUTION_INVALID = YAPI_INVALID_DOUBLE
 
static const double DIRECTION_INVALID = YAPI_INVALID_DOUBLE
 
static const double GROUNDSPEED_INVALID = YAPI_INVALID_DOUBLE
 
static const Y_ISFIXED_enum ISFIXED_FALSE = Y_ISFIXED_FALSE
 
static const Y_ISFIXED_enum ISFIXED_INVALID = Y_ISFIXED_INVALID
 
static const Y_ISFIXED_enum ISFIXED_TRUE = Y_ISFIXED_TRUE
 
static const string LATITUDE_INVALID = YAPI_INVALID_STRING
 
static const string LONGITUDE_INVALID = YAPI_INVALID_STRING
 
static const s64 SATCOUNT_INVALID = YAPI_INVALID_LONG
 
static const s64 UNIXTIME_INVALID = YAPI_INVALID_LONG
 
static const int UTCOFFSET_INVALID = YAPI_INVALID_INT
 
- Static Public Attributes inherited from YFunction
static const string ADVERTISEDVALUE_INVALID = YAPI_INVALID_STRING
 
static const string FRIENDLYNAME_INVALID = YAPI_INVALID_STRING
 
static const YFUN_DESCR FUNCTIONDESCRIPTOR_INVALID = Y_FUNCTIONDESCRIPTOR_INVALID
 
static const string FUNCTIONID_INVALID = YAPI_INVALID_STRING
 
static const string HARDWAREID_INVALID = YAPI_INVALID_STRING
 
static const string LOGICALNAME_INVALID = YAPI_INVALID_STRING
 

Protected Member Functions

virtual int _parseAttr (YJSONObject *json_val)
 
 YGps (const string &func)
 
- Protected Member Functions inherited from YFunction
YRETCODE _buildSetRequest (const string &changeattr, const string *changeval, string &request, string &errmsg)
 
string _escapeAttr (const string &changeval)
 
YRETCODE _getDescriptor (YFUN_DESCR &fundescr, string &errMsg)
 
YRETCODE _getDevice (YDevice *&dev, string &errMsg)
 
YRETCODE _load_unsafe (int msValidity)
 
YRETCODE _nextFunction (string &hwId)
 
int _parse (YJSONObject *j)
 
YRETCODE _setAttr (string attrname, string newvalue)
 
 YFunction (const string &func)
 

Protected Attributes

double _altitude
 
string _command
 
Y_COORDSYSTEM_enum _coordSystem
 
string _dateTime
 
double _dilution
 
double _direction
 
double _groundSpeed
 
Y_ISFIXED_enum _isFixed
 
string _latitude
 
string _longitude
 
s64 _satCount
 
s64 _unixTime
 
int _utcOffset
 
YGpsValueCallback _valueCallbackGps
 
- Protected Attributes inherited from YFunction
string _advertisedValue
 
u64 _cacheExpiration
 
string _className
 
std::map< string, YDataStream * > _dataStreams
 
string _func
 
YFUN_DESCR _fundescr
 
string _funId
 
string _hwId
 
string _lastErrorMsg
 
YRETCODE _lastErrorType
 
string _logicalName
 
string _serial
 
yCRITICAL_SECTION _this_cs
 
void * _userData
 
YFunctionValueCallback _valueCallbackFunction
 

Friends

YGpsyFindGps (const string &func)
 
YGpsyFirstGps (void)
 

Additional Inherited Members

- Static Protected Member Functions inherited from YFunction
static void _AddToCache (const string &classname, const string &func, YFunction *obj)
 
static YFunction_FindFromCache (const string &classname, const string &func)
 
static void _UpdateTimedReportCallbackList (YFunction *func, bool add)
 
static void _UpdateValueCallbackList (YFunction *func, bool add)
 
- Static Protected Attributes inherited from YFunction
static std::map< string, YFunction * > _cache
 

Detailed Description

YGps Class: GPS function interface

The Gps function allows you to extract positionning data from the GPS device. This class can provides complete positionning information: However, if you whish to define callbacks on position changes, you should use the YLatitude et YLongitude classes.

Definition at line 95 of file yocto_gps.h.

Constructor & Destructor Documentation

YGps::YGps ( const string &  func)
protected

Definition at line 51 of file yocto_gps.cpp.

YGps::~YGps ( )

Definition at line 72 of file yocto_gps.cpp.

Member Function Documentation

int YGps::_invokeValueCallback ( string  value)
virtual

Reimplemented from YFunction.

Definition at line 659 of file yocto_gps.cpp.

int YGps::_parseAttr ( YJSONObject json_val)
protectedvirtual

Reimplemented from YFunction.

Definition at line 88 of file yocto_gps.cpp.

double YGps::altitude ( void  )
inline

Definition at line 251 of file yocto_gps.h.

string YGps::command ( void  )
inline

Definition at line 335 of file yocto_gps.h.

Y_COORDSYSTEM_enum YGps::coordSystem ( void  )
inline

Definition at line 186 of file yocto_gps.h.

string YGps::dateTime ( void  )
inline

Definition at line 303 of file yocto_gps.h.

double YGps::dilution ( void  )
inline

Definition at line 238 of file yocto_gps.h.

double YGps::direction ( void  )
inline

Definition at line 277 of file yocto_gps.h.

static YGps* YGps::Find ( string  func)
inlinestatic

Definition at line 388 of file yocto_gps.h.

YGps * YGps::FindGps ( string  func)
static

Retrieves a GPS for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the GPS is online at the time it is invoked. The returned object is nevertheless valid. Use the method YGps.isOnline() to test if the GPS is indeed online at a given time. In case of ambiguity when looking for a GPS by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.

If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.

Parameters
func: a string that uniquely characterizes the GPS
Returns
a YGps object allowing you to drive the GPS.

Definition at line 608 of file yocto_gps.cpp.

static YGps* YGps::First ( void  )
inlinestatic

Definition at line 412 of file yocto_gps.h.

YGps * YGps::FirstGps ( void  )
static

Starts the enumeration of GPS currently accessible. Use the method YGps.nextGps() to iterate on next GPS.

Returns
a pointer to a YGps object, corresponding to the first GPS currently online, or a NULL pointer if there are none.

Definition at line 679 of file yocto_gps.cpp.

double YGps::get_altitude ( void  )

Returns the current altitude. Beware: GPS technology is very inaccurate regarding altitude.

Returns
a floating point number corresponding to the current altitude

On failure, throws an exception or returns Y_ALTITUDE_INVALID.

Definition at line 345 of file yocto_gps.cpp.

string YGps::get_command ( void  )

Definition at line 543 of file yocto_gps.cpp.

Y_COORDSYSTEM_enum YGps::get_coordSystem ( void  )

Returns the representation system used for positioning data.

Returns
a value among Y_COORDSYSTEM_GPS_DMS, Y_COORDSYSTEM_GPS_DM and Y_COORDSYSTEM_GPS_D corresponding to the representation system used for positioning data

On failure, throws an exception or returns Y_COORDSYSTEM_INVALID.

Definition at line 200 of file yocto_gps.cpp.

string YGps::get_dateTime ( void  )

Returns the current time in the form "YYYY/MM/DD hh:mm:ss".

Returns
a string corresponding to the current time in the form "YYYY/MM/DD hh:mm:ss"

On failure, throws an exception or returns Y_DATETIME_INVALID.

Definition at line 465 of file yocto_gps.cpp.

double YGps::get_dilution ( void  )

Returns the current horizontal dilution of precision, the smaller that number is, the better .

Returns
a floating point number corresponding to the current horizontal dilution of precision, the smaller that number is, the better

On failure, throws an exception or returns Y_DILUTION_INVALID.

Definition at line 315 of file yocto_gps.cpp.

double YGps::get_direction ( void  )

Returns the current move bearing in degrees, zero is the true (geographic) north.

Returns
a floating point number corresponding to the current move bearing in degrees, zero is the true (geographic) north

On failure, throws an exception or returns Y_DIRECTION_INVALID.

Definition at line 405 of file yocto_gps.cpp.

double YGps::get_groundSpeed ( void  )

Returns the current ground speed in Km/h.

Returns
a floating point number corresponding to the current ground speed in Km/h

On failure, throws an exception or returns Y_GROUNDSPEED_INVALID.

Definition at line 374 of file yocto_gps.cpp.

Y_ISFIXED_enum YGps::get_isFixed ( void  )

Returns TRUE if the receiver has found enough satellites to work.

Returns
either Y_ISFIXED_FALSE or Y_ISFIXED_TRUE, according to TRUE if the receiver has found enough satellites to work

On failure, throws an exception or returns Y_ISFIXED_INVALID.

Definition at line 141 of file yocto_gps.cpp.

string YGps::get_latitude ( void  )

Returns the current latitude.

Returns
a string corresponding to the current latitude

On failure, throws an exception or returns Y_LATITUDE_INVALID.

Definition at line 255 of file yocto_gps.cpp.

string YGps::get_longitude ( void  )

Returns the current longitude.

Returns
a string corresponding to the current longitude

On failure, throws an exception or returns Y_LONGITUDE_INVALID.

Definition at line 284 of file yocto_gps.cpp.

s64 YGps::get_satCount ( void  )

Returns the count of visible satellites.

Returns
an integer corresponding to the count of visible satellites

On failure, throws an exception or returns Y_SATCOUNT_INVALID.

Definition at line 170 of file yocto_gps.cpp.

s64 YGps::get_unixTime ( void  )

Returns the current time in Unix format (number of seconds elapsed since Jan 1st, 1970).

Returns
an integer corresponding to the current time in Unix format (number of seconds elapsed since Jan 1st, 1970)

On failure, throws an exception or returns Y_UNIXTIME_INVALID.

Definition at line 436 of file yocto_gps.cpp.

int YGps::get_utcOffset ( void  )

Returns the number of seconds between current time and UTC time (time zone).

Returns
an integer corresponding to the number of seconds between current time and UTC time (time zone)

On failure, throws an exception or returns Y_UTCOFFSET_INVALID.

Definition at line 494 of file yocto_gps.cpp.

double YGps::groundSpeed ( void  )
inline

Definition at line 263 of file yocto_gps.h.

Y_ISFIXED_enum YGps::isFixed ( void  )
inline

Definition at line 161 of file yocto_gps.h.

string YGps::latitude ( void  )
inline

Definition at line 212 of file yocto_gps.h.

string YGps::longitude ( void  )
inline

Definition at line 224 of file yocto_gps.h.

YGps* YGps::next ( void  )
inline

Definition at line 399 of file yocto_gps.h.

YGps * YGps::nextGps ( void  )

Continues the enumeration of GPS started using yFirstGps().

Returns
a pointer to a YGps object, corresponding to a GPS currently online, or a NULL pointer if there are no more GPS to enumerate.

Definition at line 669 of file yocto_gps.cpp.

int YGps::registerValueCallback ( YGpsValueCallback  callback)
virtual

Registers the callback function that is invoked on every change of advertised value. The callback is invoked only during the execution of ySleep or yHandleEvents. This provides control over the time when the callback is triggered. For good responsiveness, remember to call one of these two functions periodically. To unregister a callback, pass a NULL pointer as argument.

Parameters
callback: the callback function to call, or a NULL pointer. The callback function should take two arguments: the function object of which the value has changed, and the character string describing the new advertised value.

Definition at line 640 of file yocto_gps.cpp.

s64 YGps::satCount ( void  )
inline

Definition at line 173 of file yocto_gps.h.

int YGps::set_command ( const string &  newval)

Definition at line 565 of file yocto_gps.cpp.

int YGps::set_coordSystem ( Y_COORDSYSTEM_enum  newval)

Changes the representation system used for positioning data.

Parameters
newval: a value among Y_COORDSYSTEM_GPS_DMS, Y_COORDSYSTEM_GPS_DM and Y_COORDSYSTEM_GPS_D corresponding to the representation system used for positioning data
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 232 of file yocto_gps.cpp.

int YGps::set_utcOffset ( int  newval)

Changes the number of seconds between current time and UTC time (time zone). The timezone is automatically rounded to the nearest multiple of 15 minutes. If current UTC time is known, the current time is automatically be updated according to the selected time zone.

Parameters
newval: an integer corresponding to the number of seconds between current time and UTC time (time zone)
Returns
YAPI_SUCCESS if the call succeeds.

On failure, throws an exception or returns a negative error code.

Definition at line 527 of file yocto_gps.cpp.

int YGps::setCommand ( const string &  newval)
inline

Definition at line 339 of file yocto_gps.h.

int YGps::setCoordSystem ( Y_COORDSYSTEM_enum  newval)
inline

Definition at line 200 of file yocto_gps.h.

int YGps::setUtcOffset ( int  newval)
inline

Definition at line 330 of file yocto_gps.h.

s64 YGps::unixTime ( void  )
inline

Definition at line 291 of file yocto_gps.h.

int YGps::utcOffset ( void  )
inline

Definition at line 315 of file yocto_gps.h.

Friends And Related Function Documentation

YGps* yFindGps ( const string &  func)
friend

Retrieves a GPS for a given identifier. The identifier can be specified using several formats:

  • FunctionLogicalName
  • ModuleSerialNumber.FunctionIdentifier
  • ModuleSerialNumber.FunctionLogicalName
  • ModuleLogicalName.FunctionIdentifier
  • ModuleLogicalName.FunctionLogicalName

This function does not require that the GPS is online at the time it is invoked. The returned object is nevertheless valid. Use the method YGps.isOnline() to test if the GPS is indeed online at a given time. In case of ambiguity when looking for a GPS by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.

If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.

Parameters
func: a string that uniquely characterizes the GPS
Returns
a YGps object allowing you to drive the GPS.

Definition at line 449 of file yocto_gps.h.

YGps* yFirstGps ( void  )
friend

Starts the enumeration of GPS currently accessible. Use the method YGps.nextGps() to iterate on next GPS.

Returns
a pointer to a YGps object, corresponding to the first GPS currently online, or a NULL pointer if there are none.

Definition at line 460 of file yocto_gps.h.

Member Data Documentation

double YGps::_altitude
protected

Definition at line 109 of file yocto_gps.h.

string YGps::_command
protected

Definition at line 115 of file yocto_gps.h.

Y_COORDSYSTEM_enum YGps::_coordSystem
protected

Definition at line 105 of file yocto_gps.h.

string YGps::_dateTime
protected

Definition at line 113 of file yocto_gps.h.

double YGps::_dilution
protected

Definition at line 108 of file yocto_gps.h.

double YGps::_direction
protected

Definition at line 111 of file yocto_gps.h.

double YGps::_groundSpeed
protected

Definition at line 110 of file yocto_gps.h.

Y_ISFIXED_enum YGps::_isFixed
protected

Definition at line 103 of file yocto_gps.h.

string YGps::_latitude
protected

Definition at line 106 of file yocto_gps.h.

string YGps::_longitude
protected

Definition at line 107 of file yocto_gps.h.

s64 YGps::_satCount
protected

Definition at line 104 of file yocto_gps.h.

s64 YGps::_unixTime
protected

Definition at line 112 of file yocto_gps.h.

int YGps::_utcOffset
protected

Definition at line 114 of file yocto_gps.h.

YGpsValueCallback YGps::_valueCallbackGps
protected

Definition at line 116 of file yocto_gps.h.

const double YGps::ALTITUDE_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 143 of file yocto_gps.h.

const string YGps::COMMAND_INVALID = YAPI_INVALID_STRING
static

Definition at line 149 of file yocto_gps.h.

const Y_COORDSYSTEM_enum YGps::COORDSYSTEM_GPS_D = Y_COORDSYSTEM_GPS_D
static

Definition at line 138 of file yocto_gps.h.

const Y_COORDSYSTEM_enum YGps::COORDSYSTEM_GPS_DM = Y_COORDSYSTEM_GPS_DM
static

Definition at line 137 of file yocto_gps.h.

const Y_COORDSYSTEM_enum YGps::COORDSYSTEM_GPS_DMS = Y_COORDSYSTEM_GPS_DMS
static

Definition at line 136 of file yocto_gps.h.

const Y_COORDSYSTEM_enum YGps::COORDSYSTEM_INVALID = Y_COORDSYSTEM_INVALID
static

Definition at line 139 of file yocto_gps.h.

const string YGps::DATETIME_INVALID = YAPI_INVALID_STRING
static

Definition at line 147 of file yocto_gps.h.

const double YGps::DILUTION_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 142 of file yocto_gps.h.

const double YGps::DIRECTION_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 145 of file yocto_gps.h.

const double YGps::GROUNDSPEED_INVALID = YAPI_INVALID_DOUBLE
static

Definition at line 144 of file yocto_gps.h.

const Y_ISFIXED_enum YGps::ISFIXED_FALSE = Y_ISFIXED_FALSE
static

Definition at line 132 of file yocto_gps.h.

const Y_ISFIXED_enum YGps::ISFIXED_INVALID = Y_ISFIXED_INVALID
static

Definition at line 134 of file yocto_gps.h.

const Y_ISFIXED_enum YGps::ISFIXED_TRUE = Y_ISFIXED_TRUE
static

Definition at line 133 of file yocto_gps.h.

const string YGps::LATITUDE_INVALID = YAPI_INVALID_STRING
static

Definition at line 140 of file yocto_gps.h.

const string YGps::LONGITUDE_INVALID = YAPI_INVALID_STRING
static

Definition at line 141 of file yocto_gps.h.

const s64 YGps::SATCOUNT_INVALID = YAPI_INVALID_LONG
static

Definition at line 135 of file yocto_gps.h.

const s64 YGps::UNIXTIME_INVALID = YAPI_INVALID_LONG
static

Definition at line 146 of file yocto_gps.h.

const int YGps::UTCOFFSET_INVALID = YAPI_INVALID_INT
static

Definition at line 148 of file yocto_gps.h.


The documentation for this class was generated from the following files:


yoctopuce_altimeter
Author(s): Anja Sheppard
autogenerated on Mon Jun 10 2019 15:49:13