C027 updated to work with latest mBed libraries
Dependents: Cellular_HelloMQTT UBLOXModemDriver UBLOXMQTTDriver
Fork of C027_Support by
GPSParser Class Reference
basic gps parser class More...
#include <GPS.h>
Inherited by GPSI2C, and GPSSerial.
Public Types | |
enum | { WAIT = -1, NOT_FOUND = 0 } |
Public Member Functions | |
virtual bool | init (PinName pn)=0 |
Power on / Wake up the gps. | |
virtual int | getMessage (char *buf, int len)=0 |
Get a line from the physical interface. | |
virtual int | send (const char *buf, int len) |
send a buffer | |
virtual int | sendNmea (const char *buf, int len) |
send a NMEA message, this function just takes the payload and calculates and adds checksum. | |
virtual int | sendUbx (unsigned char cls, unsigned char id, const void *buf=NULL, int len=0) |
send a UBX message, this function just takes the payload and calculates and adds checksum. | |
void | powerOff (void) |
Power off the gps, it can be again woken up by an edge on the serial port on the external interrupt pin. | |
Static Public Member Functions | |
static const char * | findNmeaItemPos (int ix, const char *start, const char *end) |
get the first character of a NMEA field | |
static bool | getNmeaItem (int ix, char *buf, int len, double &val) |
extract a double value from a buffer containing a NMEA message | |
static bool | getNmeaItem (int ix, char *buf, int len, int &val, int base) |
extract a interger value from a buffer containing a NMEA message | |
static bool | getNmeaItem (int ix, char *buf, int len, char &val) |
extract a char value from a buffer containing a NMEA message | |
static bool | getNmeaAngle (int ix, char *buf, int len, double &val) |
extract a latitude/longitude value from a buffer containing a NMEA message | |
Protected Member Functions | |
virtual int | _send (const void *buf, int len)=0 |
Write bytes to the physical interface. | |
Static Protected Member Functions | |
static int | _getMessage (Pipe< char > *pipe, char *buf, int len) |
Get a line from the physical interface. | |
static int | _parseNmea (Pipe< char > *pipe, int len) |
Check if the current offset of the pipe contains a NMEA message. | |
static int | _parseUbx (Pipe< char > *pipe, int len) |
Check if the current offset of the pipe contains a UBX message. | |
Static Protected Attributes | |
static const char | toHex [16] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' } |
num to hex conversion |
Detailed Description
basic gps parser class
Definition at line 15 of file GPS.h.
Member Enumeration Documentation
anonymous enum |
Member Function Documentation
int _getMessage | ( | Pipe< char > * | pipe, |
char * | buf, | ||
int | len | ||
) | [static, protected] |
int _parseNmea | ( | Pipe< char > * | pipe, |
int | len | ||
) | [static, protected] |
Check if the current offset of the pipe contains a NMEA message.
- Parameters:
-
pipe the receiveing pipe to parse messages len numer of bytes to parse at maximum
- Returns:
- length if something was found (including the NMEA frame) WAIT if not enough data is available NOT_FOUND if nothing was found
int _parseUbx | ( | Pipe< char > * | pipe, |
int | len | ||
) | [static, protected] |
Check if the current offset of the pipe contains a UBX message.
- Parameters:
-
pipe the receiveing pipe to parse messages len numer of bytes to parse at maximum
- Returns:
- length if something was found (including the UBX frame) WAIT if not enough data is available NOT_FOUND if nothing was found
virtual int _send | ( | const void * | buf, |
int | len | ||
) | [protected, pure virtual] |
const char * findNmeaItemPos | ( | int | ix, |
const char * | start, | ||
const char * | end | ||
) | [static] |
virtual int getMessage | ( | char * | buf, |
int | len | ||
) | [pure virtual] |
Get a line from the physical interface.
This fucntion needs to be implemented in the inherited class.
- Parameters:
-
buf the buffer to store it len size of the buffer
- Returns:
- type and length if something was found, WAIT if not enough data is available NOT_FOUND if nothing was found
bool getNmeaAngle | ( | int | ix, |
char * | buf, | ||
int | len, | ||
double & | val | ||
) | [static] |
extract a latitude/longitude value from a buffer containing a NMEA message
- Parameters:
-
ix the index of the field to extract (will extract ix and ix + 1) buf the NMEA message len the size of the NMEA message val the extracted latitude or longitude
- Returns:
- true if successful, false otherwise
bool getNmeaItem | ( | int | ix, |
char * | buf, | ||
int | len, | ||
int & | val, | ||
int | base | ||
) | [static] |
extract a interger value from a buffer containing a NMEA message
- Parameters:
-
ix the index of the field to extract buf the NMEA message len the size of the NMEA message val the extracted value base the numeric base to be used (e.g. 8, 10 or 16)
- Returns:
- true if successful, false otherwise
bool getNmeaItem | ( | int | ix, |
char * | buf, | ||
int | len, | ||
double & | val | ||
) | [static] |
bool getNmeaItem | ( | int | ix, |
char * | buf, | ||
int | len, | ||
char & | val | ||
) | [static] |
virtual bool init | ( | PinName | pn ) | [pure virtual] |
void powerOff | ( | void | ) |
int send | ( | const char * | buf, |
int | len | ||
) | [virtual] |
int sendNmea | ( | const char * | buf, |
int | len | ||
) | [virtual] |
int sendUbx | ( | unsigned char | cls, |
unsigned char | id, | ||
const void * | buf = NULL , |
||
int | len = 0 |
||
) | [virtual] |
send a UBX message, this function just takes the payload and calculates and adds checksum.
- Parameters:
-
cls the UBX class id id the UBX message id buf the message payload to write len size of the message payload to write
- Returns:
- total bytes written
Reimplemented in GPSI2C.
Field Documentation
Generated on Wed Jul 13 2022 10:41:46 by 1.7.2