Guido Ottaviani / Mbed 2 deprecated LeonardoMbos

Dependencies:   mbos Watchdog TextLCD mbed ConfigFile

Embed: (wiki syntax)

« Back to documentation index

parse.h File Reference

parse.h File Reference

Functions of a low level for analysis of packages of NMEA stream. More...

Go to the source code of this file.

Functions

int nmea_pack_type (const char *buff, int buff_sz)
 Define packet type by header (nmeaPACKTYPE).
int nmea_find_tail (const char *buff, int buff_sz, int *res_crc)
 Find tail of packet ("\r\n") in buffer and check control sum (CRC).
int nmea_parse_GPGGA (const char *buff, int buff_sz, nmeaGPGGA *pack)
 Parse GGA packet from buffer.
int nmea_parse_GPGSA (const char *buff, int buff_sz, nmeaGPGSA *pack)
 Parse GSA packet from buffer.
int nmea_parse_GPGSV (const char *buff, int buff_sz, nmeaGPGSV *pack)
 Parse GSV packet from buffer.
int nmea_parse_GPRMC (const char *buff, int buff_sz, nmeaGPRMC *pack)
 Parse RMC packet from buffer.
int nmea_parse_GPVTG (const char *buff, int buff_sz, nmeaGPVTG *pack)
 Parse VTG packet from buffer.
void nmea_GPGGA2info (nmeaGPGGA *pack, nmeaINFO *info)
 Fill nmeaINFO structure by GGA packet data.
void nmea_GPGSA2info (nmeaGPGSA *pack, nmeaINFO *info)
 Fill nmeaINFO structure by GSA packet data.
void nmea_GPGSV2info (nmeaGPGSV *pack, nmeaINFO *info)
 Fill nmeaINFO structure by GSV packet data.
void nmea_GPRMC2info (nmeaGPRMC *pack, nmeaINFO *info)
 Fill nmeaINFO structure by RMC packet data.
void nmea_GPVTG2info (nmeaGPVTG *pack, nmeaINFO *info)
 Fill nmeaINFO structure by VTG packet data.

Detailed Description

Functions of a low level for analysis of packages of NMEA stream.

 ...
 ptype = nmea_pack_type(
     (const char *)parser->buffer + nparsed + 1,
     parser->buff_use - nparsed - 1);
 
 if(0 == (node = malloc(sizeof(nmeaParserNODE))))
     goto mem_fail;
 
 node->pack = 0;
 
 switch(ptype)
 {
 case GPGGA:
     if(0 == (node->pack = malloc(sizeof(nmeaGPGGA))))
         goto mem_fail;
     node->packType = GPGGA;
     if(!nmea_parse_GPGGA(
         (const char *)parser->buffer + nparsed,
         sen_sz, (nmeaGPGGA *)node->pack))
     {
         free(node);
         node = 0;
     }
     break;
 case GPGSA:
     if(0 == (node->pack = malloc(sizeof(nmeaGPGSA))))
         goto mem_fail;
     node->packType = GPGSA;
     if(!nmea_parse_GPGSA(
         (const char *)parser->buffer + nparsed,
         sen_sz, (nmeaGPGSA *)node->pack))
     {
         free(node);
         node = 0;
     }
     break;
 ...

Definition in file parse.h.


Function Documentation

int nmea_find_tail ( const char *  buff,
int  buff_sz,
int *  res_crc 
)

Find tail of packet ("\r\n") in buffer and check control sum (CRC).

Parameters:
buffa constant character pointer of packets buffer.
buff_szbuffer size.
res_crca integer pointer for return CRC of packet (must be defined).
Returns:
Number of bytes to packet tail.

Definition at line 135 of file parse.c.

void nmea_GPGGA2info ( nmeaGPGGA pack,
nmeaINFO info 
)

Fill nmeaINFO structure by GGA packet data.

Parameters:
packa pointer of packet structure.
infoa pointer of summary information structure.

Definition at line 376 of file parse.c.

void nmea_GPGSA2info ( nmeaGPGSA pack,
nmeaINFO info 
)

Fill nmeaINFO structure by GSA packet data.

Parameters:
packa pointer of packet structure.
infoa pointer of summary information structure.

Definition at line 397 of file parse.c.

void nmea_GPGSV2info ( nmeaGPGSV pack,
nmeaINFO info 
)

Fill nmeaINFO structure by GSV packet data.

Parameters:
packa pointer of packet structure.
infoa pointer of summary information structure.

Definition at line 429 of file parse.c.

void nmea_GPRMC2info ( nmeaGPRMC pack,
nmeaINFO info 
)

Fill nmeaINFO structure by RMC packet data.

Parameters:
packa pointer of packet structure.
infoa pointer of summary information structure.

Definition at line 464 of file parse.c.

void nmea_GPVTG2info ( nmeaGPVTG pack,
nmeaINFO info 
)

Fill nmeaINFO structure by VTG packet data.

Parameters:
packa pointer of packet structure.
infoa pointer of summary information structure.

Definition at line 494 of file parse.c.

int nmea_pack_type ( const char *  buff,
int  buff_sz 
)

Define packet type by header (nmeaPACKTYPE).

Parameters:
buffa constant character pointer of packet buffer.
buff_szbuffer size.
Returns:
The defined packet type
See also:
nmeaPACKTYPE

Definition at line 100 of file parse.c.

int nmea_parse_GPGGA ( const char *  buff,
int  buff_sz,
nmeaGPGGA pack 
)

Parse GGA packet from buffer.

Parameters:
buffa constant character pointer of packet buffer.
buff_szbuffer size.
packa pointer of packet which will filled by function.
Returns:
1 (true) - if parsed successfully or 0 (false) - if fail.

Definition at line 186 of file parse.c.

int nmea_parse_GPGSA ( const char *  buff,
int  buff_sz,
nmeaGPGSA pack 
)

Parse GSA packet from buffer.

Parameters:
buffa constant character pointer of packet buffer.
buff_szbuffer size.
packa pointer of packet which will filled by function.
Returns:
1 (true) - if parsed successfully or 0 (false) - if fail.

Definition at line 223 of file parse.c.

int nmea_parse_GPGSV ( const char *  buff,
int  buff_sz,
nmeaGPGSV pack 
)

Parse GSV packet from buffer.

Parameters:
buffa constant character pointer of packet buffer.
buff_szbuffer size.
packa pointer of packet which will filled by function.
Returns:
1 (true) - if parsed successfully or 0 (false) - if fail.

Definition at line 252 of file parse.c.

int nmea_parse_GPRMC ( const char *  buff,
int  buff_sz,
nmeaGPRMC pack 
)

Parse RMC packet from buffer.

Parameters:
buffa constant character pointer of packet buffer.
buff_szbuffer size.
packa pointer of packet which will filled by function.
Returns:
1 (true) - if parsed successfully or 0 (false) - if fail.

Definition at line 294 of file parse.c.

int nmea_parse_GPVTG ( const char *  buff,
int  buff_sz,
nmeaGPVTG pack 
)

Parse VTG packet from buffer.

Parameters:
buffa constant character pointer of packet buffer.
buff_szbuffer size.
packa pointer of packet which will filled by function.
Returns:
1 (true) - if parsed successfully or 0 (false) - if fail.

Definition at line 340 of file parse.c.