parser_nmea.c File Reference

File containing the NMEA parser functions. More...

#include <__cross_studio_io.h>
#include <msp430x16x.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <limits.h>
#include <stdlib.h>
#include "parser_nmea.h"
Include dependency graph for parser_nmea.c:

Functions

int hex2int (char c)
 Transform hexa to integer. More...
 
enum nmea_sentence_id nmea_sentence_id (char *sentence)
 Determine sentence identifier. More...
 
int nmea_isfield (char c)
 Check if the char is part of the field. More...
 
int nmea_scan (const char *sentence, const char *format,...)
 Scanf-like processor for NMEA sentences. More...
 
int nmea_parse_rmc (struct nmea_sentence_rmc *frame, const char *sentence)
 Parse a RMC sentence. More...
 
int nmea_parse_gga (struct nmea_sentence_gga *frame, const char *sentence)
 Parse a GGA sentence. More...
 
int nmea_check (const char *sentence, int strict)
 Check sentence validity and checksum. More...
 

Detailed Description

File containing the NMEA parser functions.

Author
Gaƫl Foppolo (gaelfoppolo)

Function Documentation

int hex2int ( char  c)

Transform hexa to integer.

Parameters
[in]cAn integer (char)
Returns
An integer (hex)

Here is the caller graph for this function:

int nmea_check ( const char *  sentence,
int  strict 
)

Check sentence validity and checksum.

Calculate checksum and compare it

Parameters
sentenceThe sentence to test
strictAccept or not sentence with checksum
Returns
1 for valid sentences.

Here is the call graph for this function:

Here is the caller graph for this function:

int nmea_isfield ( char  c)

Check if the char is part of the field.

Aka char isn't a comma or star

Parameters
cThe char to test
Returns
1 is valid, 0 if not

Here is the caller graph for this function:

int nmea_parse_gga ( nmea_sentence_gga frame,
const char *  sentence 
)

Parse a GGA sentence.

Parameters
frameThe struct where to put the parsed data
sentenceThe sentence to parse
Returns
1 on success

Here is the call graph for this function:

int nmea_parse_rmc ( nmea_sentence_rmc frame,
const char *  sentence 
)

Parse a RMC sentence.

Parameters
frameThe struct where to put the parsed data
sentenceThe sentence to parse
Returns
1 on success

Here is the call graph for this function:

Here is the caller graph for this function:

int nmea_scan ( const char *  sentence,
const char *  format,
  ... 
)

Scanf-like processor for NMEA sentences.

Supports the following formats: c - single character (char *) d - direction, returned as 1/-1, default 0 (int *) f - float (float *) o - longitude value, transform all in degrees (float *) a - latitude value, transform all in degrees (float *) i - decimal (integer), default zero (int *) s - string (char *) t - talker identifier and type (char *)

Parameters
sentenceThe sentence to parse
formatThe format of the sentence
See also
nmea_parse_*** functions for further explanations
Returns
1 on success, 1 if not

Here is the call graph for this function:

Here is the caller graph for this function:

enum nmea_sentence_id nmea_sentence_id ( char *  sentence)

Determine sentence identifier.

Parameters
sentenceThen sentence to test
Returns
The type of sentence