This class provides an API to communicate with a u-blox GNSS chip. The files here were originally part of the C027_Support library (https://developer.mbed.org/teams/ublox/code/C027_Support/ at revision 138:dafbbf31bf76) but have been separated out, primarily for use on the u-blox C030 board where the cellular interace portion of the C027_Support library will instead be provided through the new mbed Cellular API.
Dependents: example-ublox-at-cellular-interface-ext example-low-power-sleep example-C030-out-of-box-demo example-C030-out-of-box-demo ... more
GnssParser Class Reference
Basic GNSS parser class. More...
#include <gnss.h>
Inherited by GnssI2C, and GnssSerial.
Public Types | |
enum | { WAIT = -1, NOT_FOUND = 0 } |
Public Member Functions | |
GnssParser () | |
Constructor. | |
virtual | ~GnssParser (void) |
Destructor. | |
virtual bool | init (PinName pn)=0 |
Power-on/wake-up the GNSS. | |
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 GNSS, it can be again woken up by an edge on the serial port on the external interrupt pin. | |
void | cutOffPower (void) |
Cuts off the power supply of GNSS by disabling gnssEnable pin Backup supply is provided, can turn it on again by enabling PA15. | |
int | enable_ubx () |
Enable UBX messages. | |
eUBX_MESSAGE | get_ubx_message (char *) |
GET Message type of receiver UBX message. | |
tUBX_ACK_ACK | decode_ubx_cfg_ack_nak_msg (char *) |
Method to parse contents of UBX ACK-ACK/NAK and return messageid amd class for which ACK is received. | |
tUBX_NAV_ODO | decode_ubx_nav_odo_msg (char *) |
Method to parse contents of UBX_NAV_ODO and return decoded msg. | |
tUBX_NAV_PVT | decode_ubx_nav_pvt_msg (char *) |
Method to parse contents of UBX_NAV_PVT and return decoded msg. | |
tUBX_LOG_BATCH | decode_ubx_log_batch_msg (char *) |
Method to parse contents of UBX_LOG_BATCH and return decoded msg. | |
tUBX_NAV_STATUS | decode_ubx_nav_status_msg (char *) |
Method to parse contents of UBX_NAV_STATUS and return decoded msg. | |
tUBX_NAV_SAT | decode_ubx_nav_sat_msg (char *, int) |
Method to parse contents of UBX_NAV_SAT and return decoded msg. | |
int | ubx_request_batched_data (bool sendMonFirst=false) |
Method to send UBX LOG-RETRIEVEBATCH msg. | |
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 | |
void | _powerOn (void) |
Power on the GNSS module. | |
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. | |
Protected Attributes | |
DigitalInOut * | _gnssEnable |
IO pin that enables GNSS. | |
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 GNSS parser class.
Definition at line 121 of file gnss.h.
Member Enumeration Documentation
anonymous enum |
Constructor & Destructor Documentation
GnssParser | ( | void | ) |
~GnssParser | ( | void | ) | [virtual] |
Member Function Documentation
int _getMessage | ( | Pipe< char > * | pipe, |
char * | buf, | ||
int | len | ||
) | [static, protected] |
Get a line from the physical interface.
- Parameters:
-
pipe the receiveing pipe to parse messages . 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.
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.
void _powerOn | ( | void | ) | [protected] |
virtual int _send | ( | const void * | buf, |
int | len | ||
) | [protected, pure virtual] |
Write bytes to the physical interface.
This function needs to be implemented by the inherited class.
- Parameters:
-
buf the buffer to write. len size of the buffer to write.
- Returns:
- bytes written.
Implemented in GnssSerial, and GnssI2C.
void cutOffPower | ( | void | ) |
tUBX_ACK_ACK decode_ubx_cfg_ack_nak_msg | ( | char * | buf ) |
tUBX_LOG_BATCH decode_ubx_log_batch_msg | ( | char * | buf ) |
tUBX_NAV_ODO decode_ubx_nav_odo_msg | ( | char * | buf ) |
tUBX_NAV_PVT decode_ubx_nav_pvt_msg | ( | char * | buf ) |
tUBX_NAV_SAT decode_ubx_nav_sat_msg | ( | char * | buf, |
int | length | ||
) |
tUBX_NAV_STATUS decode_ubx_nav_status_msg | ( | char * | buf ) |
int enable_ubx | ( | ) |
const char * findNmeaItemPos | ( | int | ix, |
const char * | start, | ||
const char * | end | ||
) | [static] |
eUBX_MESSAGE get_ubx_message | ( | char * | buff ) |
virtual int getMessage | ( | char * | buf, |
int | len | ||
) | [pure virtual] |
Get a line from the physical interface.
This function 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
Implemented in GnssSerial, and GnssI2C.
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, | ||
double & | val | ||
) | [static] |
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, | ||
char & | val | ||
) | [static] |
virtual bool init | ( | PinName | pn ) | [pure virtual] |
Power-on/wake-up the GNSS.
Implemented in GnssSerial, and GnssI2C.
void powerOff | ( | void | ) |
int send | ( | const char * | buf, |
int | len | ||
) | [virtual] |
int sendNmea | ( | const char * | buf, |
int | len | ||
) | [virtual] |
send a NMEA message, this function just takes the payload and calculates and adds checksum.
($ and *XX
will be added).
- Parameters:
-
buf the message payload to write. len size of the message payload to write.
- Returns:
- total bytes written.
Reimplemented in GnssI2C.
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 GnssI2C.
int ubx_request_batched_data | ( | bool | sendMonFirst = false ) |
Field Documentation
DigitalInOut* _gnssEnable [protected] |
Generated on Tue Jul 12 2022 14:18:20 by 1.7.2