◆ loc_t
◆ nmea_message_type
Enumerator |
---|
NMEA_UNKNOWN | |
NMEA_GPRMC | |
NMEA_GPGGA | |
Definition at line 13 of file nmea.h.
◆ gps_location()
void gps_location |
( |
loc_t * |
coord, |
|
|
char const * const |
buffer |
|
) |
| |
Definition at line 298 of file nmea.cpp.
298 {
300
301 switch (coord->
type) {
305 break;
308 break;
310
311 break;
312 }
313}
static void nmea_parse_gprmc(char const *const nmea, loc_t *loc)
static void nmea_parse_gpgga(char const *const nmea, loc_t *loc)
nmea_message_type nmea_get_message_type(const char *message)
static void gps_convert_deg_to_dec(float *latitude, char ns, float *longitude, char we)
static BigBufferHandle buffer
Referenced by onGpsMessage().
◆ nmea_get_message_type()
Get the message type (GPGGA, GPRMC, etc..)
This function filters out also wrong packages (invalid checksum)
- Parameters
-
- Returns
- The type of message if it is valid
Definition at line 259 of file nmea.cpp.
259 {
261 if (checksum != _EMPTY) {
263 }
264
265 if (strstr(message, NMEA_GPGGA_STR) != NULL) {
267 }
268
269 if (strstr(message, NMEA_GPRMC_STR) != NULL) {
271 }
272
274}
int nmea_valid_checksum(char const *message)
Referenced by gps_location().
◆ nmea_valid_checksum()
int nmea_valid_checksum |
( |
const char * |
message | ) |
|
Definition at line 276 of file nmea.cpp.
276 {
277 char p;
278 int sum = 0;
279 const char* starPtr = strrchr(message, '*');
280 if (!starPtr) {
281 return NMEA_CHECKSUM_ERR;
282 }
283 const char* int_message = starPtr + 1;
284 long checksum =
hex2int(int_message, 2);
285
286 ++message;
287 while ((p = *message++) != '*') {
288 sum ^= p;
289 }
290
291 if (sum != checksum) {
292 return NMEA_CHECKSUM_ERR;
293 }
294 return _EMPTY;
295}
static long hex2int(const char *a, const int len)
Referenced by nmea_get_message_type().
◆ str2int()
static int str2int |
( |
const char * |
a, |
|
|
const int |
len |
|
) |
| |
|
static |
Definition at line 48 of file nmea.h.
48 {
49 int i = 0, k = 0;
50 while (i < len) {
51 k = (k << 3) + (k << 1) + (*a) - '0';
52 a++;
53 i++;
54 }
55 return k;
56}
Referenced by nmea_parse_gprmc().
Go to the source code of this file.