final 1
Fork of C027_Support by
GPSSerial Class Reference
gps class which uses a serial port as physical interface. More...
#include <GPS.h>
Inherits SerialPipe, and GPSParser.
Public Types | |
enum | { WAIT = -1, NOT_FOUND = 0 } |
Public Member Functions | |
GPSSerial (PinName tx GPS_IF(=GPSTXD,), PinName rx GPS_IF(=GPSRXD,), int baudrate GPS_IF(=GPSBAUD,=9600), int rxSize=256, int txSize=128) | |
Constructor. | |
virtual | ~GPSSerial (void) |
Destructor. | |
virtual bool | init (PinName pn=NC) |
Power on / Wake up the gps. | |
virtual int | getMessage (char *buf, int len) |
Get a line from the physical interface. | |
int | writeable (void) |
check if writable return the number of free bytes | |
int | putc (int c) |
send a character (blocking) | |
int | put (const void *buffer, int length, bool blocking) |
send a buffer | |
int | readable (void) |
check if readable | |
int | getc (void) |
receive one character from the serial port (blocking) | |
int | get (void *buffer, int length, bool blocking) |
read a buffer from the serial port | |
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) |
Write bytes to the physical interface. | |
void | rxIrqBuf (void) |
receive interrupt routine | |
void | txIrqBuf (void) |
transmit interrupt woutine | |
void | txStart (void) |
start transmission helper | |
void | txCopy (void) |
move bytes to hardware | |
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 | |
Pipe< char > | _pipeRx |
receive pipe | |
Pipe< char > | _pipeTx |
transmit pipe | |
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
gps class which uses a serial port as physical interface.
Definition at line 167 of file GPS.h.
Member Enumeration Documentation
anonymous enum [inherited] |
Constructor & Destructor Documentation
GPSSerial | ( | PinName tx | GPS_IF=GPSTXD,, |
PinName rx | GPS_IF=GPSRXD,, | ||
int baudrate | GPS_IF=GPSBAUD,=9600, | ||
int | rxSize = 256 , |
||
int | txSize = 128 |
||
) |
Constructor.
- Parameters:
-
tx is the serial ports transmit pin (gps to CPU) rx is the serial ports receive pin (CPU to gps) baudrate the baudrate of the gps use 9600 rxSize the size of the serial rx buffer txSize the size of the serial tx buffer
Member Function Documentation
int _getMessage | ( | Pipe< char > * | pipe, |
char * | buf, | ||
int | len | ||
) | [static, protected, inherited] |
int _parseNmea | ( | Pipe< char > * | pipe, |
int | len | ||
) | [static, protected, inherited] |
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, inherited] |
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
int _send | ( | const void * | buf, |
int | len | ||
) | [protected, virtual] |
const char * findNmeaItemPos | ( | int | ix, |
const char * | start, | ||
const char * | end | ||
) | [static, inherited] |
int get | ( | void * | buffer, |
int | length, | ||
bool | blocking | ||
) | [inherited] |
read a buffer from the serial port
- Parameters:
-
pointer to the buffer to read. length number of bytes to read blocking true if all bytes shall be read. false if only the available bytes.
- Returns:
- the number of bytes read.
Definition at line 94 of file SerialPipe.cpp.
int getc | ( | void | ) | [inherited] |
receive one character from the serial port (blocking)
- Parameters:
-
the character received
Definition at line 87 of file SerialPipe.cpp.
int getMessage | ( | char * | buf, |
int | len | ||
) | [virtual] |
bool getNmeaAngle | ( | int | ix, |
char * | buf, | ||
int | len, | ||
double & | val | ||
) | [static, inherited] |
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, inherited] |
bool getNmeaItem | ( | int | ix, |
char * | buf, | ||
int | len, | ||
char & | val | ||
) | [static, inherited] |
bool getNmeaItem | ( | int | ix, |
char * | buf, | ||
int | len, | ||
int & | val, | ||
int | base | ||
) | [static, inherited] |
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 init | ( | PinName | pn = NC ) |
[virtual] |
void powerOff | ( | void | ) | [inherited] |
int put | ( | const void * | buffer, |
int | length, | ||
bool | blocking | ||
) | [inherited] |
send a buffer
- Parameters:
-
buffer the buffer to send length the size of the buffer to send blocking,if true this function will block until all bytes placed in the buffer.
- Returns:
- the number of bytes written
Definition at line 31 of file SerialPipe.cpp.
int putc | ( | int | c ) | [inherited] |
send a character (blocking)
- Parameters:
-
c the character to send
- Returns:
- c
Definition at line 24 of file SerialPipe.cpp.
int readable | ( | void | ) | [inherited] |
check if readable
- Returns:
- the size available in the buffer.
Definition at line 82 of file SerialPipe.cpp.
void rxIrqBuf | ( | void | ) | [protected, inherited] |
receive interrupt routine
Definition at line 99 of file SerialPipe.cpp.
int send | ( | const char * | buf, |
int | len | ||
) | [virtual, inherited] |
int sendNmea | ( | const char * | buf, |
int | len | ||
) | [virtual, inherited] |
int sendUbx | ( | unsigned char | cls, |
unsigned char | id, | ||
const void * | buf = NULL , |
||
int | len = 0 |
||
) | [virtual, inherited] |
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.
void txCopy | ( | void | ) | [protected, inherited] |
move bytes to hardware
Definition at line 54 of file SerialPipe.cpp.
void txIrqBuf | ( | void | ) | [protected, inherited] |
transmit interrupt woutine
Definition at line 63 of file SerialPipe.cpp.
void txStart | ( | void | ) | [protected, inherited] |
start transmission helper
Definition at line 71 of file SerialPipe.cpp.
int writeable | ( | void | ) | [inherited] |
check if writable return the number of free bytes
Definition at line 19 of file SerialPipe.cpp.
Field Documentation
receive pipe
Definition at line 78 of file SerialPipe.h.
transmit pipe
Definition at line 79 of file SerialPipe.h.
Generated on Sat Jul 16 2022 14:46:17 by 1.7.2