X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fnet%2Fnmea.h;h=184a7a0aa1e4d07faf30df923807af84e56c29c4;hb=4d8a6a97c6c0e15296b51d5f02674079bede1aa0;hp=44528195562d1ef526e1317a99c86d9ff941c867;hpb=4f37937571c34c2380155cbb77e892a1894403bf;p=bertos.git diff --git a/bertos/net/nmea.h b/bertos/net/nmea.h index 44528195..184a7a0a 100644 --- a/bertos/net/nmea.h +++ b/bertos/net/nmea.h @@ -29,7 +29,7 @@ * Copyright 2009 Develer S.r.l. (http://www.develer.com/) * * --> - * \brief NMEA Parser + * \brief NMEA Parser. * * \author Daniele Basile * @@ -45,7 +45,7 @@ #include -#include +#include #include @@ -58,37 +58,37 @@ #define NMEA_GPGSV 4 // GSV MESSAGE ID // Standart type to rappresent fiels. -typedef uint32_t udegree_t; // Micro degrees -typedef uint32_t mdegree_t; // Milli degrees -typedef uint16_t degree_t; // Degrees +typedef int32_t udegree_t; // Micro degrees +typedef int32_t mdegree_t; // Milli degrees +typedef int16_t degree_t; // Degrees /** * Global Positioning System Fix Data. * Extracted data from a GGA message * - * Note: time membert containt the second elapsed from 00:00:00 1/1/1970, - * becouse from nmea sentence we read only the time of UTC position, we - * not have any reference of date (day, month and year) so time is refered to + * Note: time member contains the seconds elapsed from 00:00:00 1/1/1970, + * because from nmea sentence we read only the time of UTC position, we + * have not any reference of date (day, month and year) so time is referred to * the start of unix time. */ typedef struct NmeaGga { udegree_t latitude; /* Latitude (micro degree) */ udegree_t longitude; /* Longitude (micro degree) */ - uint16_t altitude; /* Altitude (Meter) */ + int32_t altitude; /* Altitude (Meter) */ time_t time; /* UTC of position (Unix time) */ uint16_t satellites; /* Satellites are in view */ uint16_t quality; /* Fix Quality: 0 = Invalid; 1 = GPS fix; 2 = DGPS fix; */ uint16_t hdop; /* Relative accuracy of horizontal position (hdop * 10) */ - uint16_t geoid; /* Height of geoid above WGS84 ellipsoid (Meter) */ + int16_t geoid; /* Height of geoid above WGS84 ellipsoid (Meter) */ } NmeaGga; /** * Recommended minimum specific GPS/Transit data. * Extracted data from an RMC message * - * Note: RMC sentece contain also date stamp so, time contain real second elapsed + * Note: RMC sentences contain also date stamp so, time contains real seconds elapsed * from 0:00:00 1/1/1970. */ typedef struct NmeaRmc @@ -115,27 +115,20 @@ typedef struct NmeaVtg /** * Extracted data from an gsv message */ -typedef struct NmeaGsv +struct SvInfo { - uint16_t tot_message; /* Total number of messages of this type in this cycle */ - uint16_t message_num; /* Message number */ - uint16_t tot_svv; /* Total number of SVs in view */ uint16_t sv_prn; /* SV PRN number */ degree_t elevation; /* Elevation in degrees, 90 maximum */ degree_t azimut; /* Azimuth, degrees from true north, 000 to 359 */ uint16_t snr; /* SNR, 00-99 dB (null when not tracking) */ - uint16_t sv_prn2; /* Information about second SV PRN number */ - degree_t elevation2; /* Information about second SV elevation in degrees, 90 maximum */ - degree_t azimut2; /* Information about second SV azimuth, degrees from true north, 000 to 359 */ - uint16_t snr2; /* Information about second SV SNR, 00-99 dB (null when not tracking) */ - uint16_t sv_prn3; /* Information about third SV PRN number */ - degree_t elevation3; /* Information about third SV elevation in degrees, 90 maximum */ - degree_t azimut3; /* Information about third SV azimuth, degrees from true north, 000 to 359 */ - uint16_t snr3; /* Information about third SV SNR, 00-99 dB (null when not tracking) */ - uint16_t sv_prn4; /* Information about fourth SV PRN number */ - degree_t elevation4; /* Information about fourth SV elevation in degrees, 90 maximum */ - degree_t azimut4; /* Information about fourth SV azimuth, degrees from true north, 000 to 359 */ - uint16_t snr4; /* Information about fourth SV SNR, 00-99 dB (null when not tracking) */ +}; + +typedef struct NmeaGsv +{ + uint16_t tot_message; /* Total number of messages of this type in this cycle */ + uint16_t message_num; /* Message number */ + uint16_t tot_svv; /* Total number of SVs in view */ + struct SvInfo info[4]; /* Stanrd gsv nmea report up to 4 sv info */ } NmeaGsv; void nmea_poll(nmeap_context_t *context, KFile *channel); @@ -145,6 +138,12 @@ int nmea_gpvtg(nmeap_context_t *context, nmeap_sentence_t *sentence); int nmea_gprmc(nmeap_context_t *context, nmeap_sentence_t *sentence); int nmea_gpgga(nmeap_context_t *context, nmeap_sentence_t *sentence); +// Example of callout +void gpgga_callout(nmeap_context_t *context, void *data, void *user_data); +void gprmc_callout(nmeap_context_t *context, void *data, void *user_data); +void gpgsv_callout(nmeap_context_t *context, void *data, void *user_data); +void gpvtg_callout(nmeap_context_t *context, void *data, void *user_data); + int nmea_testSetup(void); int nmea_testTearDown(void); int nmea_testRun(void);