11.3. nmea — NMEA encoding and decoding¶
Source code: src/encode/nmea.h, src/encode/nmea.c
Test code: tst/encode/nmea/main.c
Test coverage: src/encode/nmea.c
Enums
Functions
-
ssize_t
nmea_encode(char *dst_p, struct nmea_sentence_t *src_p, size_t size)¶ Encode given NMEA sentence into given buffer.
- Return
- Number of bytes in the encoded string, not including the null-termination, or negative error code.
- Parameters
dst_p: Null-terminated encoded sentence.src_p: Sentence to encode.size: Size of the destination bufferdst_p.
-
ssize_t
nmea_decode(struct nmea_sentence_t *dst_p, char *src_p, size_t size)¶ Decode given NMEA sentence into given struct.
- Return
- zero(0) or negative error code.
- Parameters
dst_p: Decoded NMEA sentence.src_p: Sentence to decode, starting with a dollar sign and ending with <CR><LF>. This string is modified by this function and the decoded sentence has references to it.size: Number of bytes in the sentence to decode, not including the null-termination.
-
int
nmea_decode_fix_time(char *src_p, int *hour_p, int *minute_p, int *second_p)¶ Decode given NMEA fix time
hhmmss. The output variables have not been modified if the decoding failed.- Return
- zero(0) or negative error code.
- Parameters
src_p: Fix time to decode.hour_p: Decoded hour.minute_p: Decoded minute.second_p: Decoded second.
-
int
nmea_decode_date(char *src_p, int *year_p, int *month_p, int *date_p)¶ Decode given NMEA date
ddmmyy. The output variables have not been modified if the decoding failed.- Return
- zero(0) or negative error code.
- Parameters
src_p: Date to decode.year_p: Decoded year.month_p: Decoded month.date_p: Decoded date.
-
int
nmea_decode_position(struct nmea_position_t *src_p, long *degrees_p)¶ Decode given NMEA position angle
d{2,3}mm.m+and direction[NSEW], for example4703.324N, which is decoded as 47 degrees, 3.324 minutes, or 47055400 microdegrees.The output variable has not been modified if the decoding failed.
- Return
- zero(0) or negative error code.
- Parameters
src_p: Position to decode.degrees_p: Decoded position in microdegrees (millions of degrees).
-
struct
nmea_position_t¶
-
struct
nmea_value_t¶
-
struct
nmea_track_made_good_t¶
-
struct
nmea_sentence_gga_t¶ - #include <nmea.h>
Fix information.
Public Members
-
char *
time_of_fix_p¶
-
struct nmea_position_t
latitude¶
-
struct nmea_position_t
longitude¶
-
char *
fix_quality_p¶
-
char *
number_of_tracked_satellites_p¶
-
char *
horizontal_dilution_of_position_p¶
-
struct nmea_value_t
altitude¶
-
struct nmea_value_t
height_of_geoid¶
-
char *
-
struct
nmea_sentence_gll_t¶ - #include <nmea.h>
Latitude and longitude data.
Public Members
-
char *
time_of_fix_p¶
-
struct nmea_position_t
latitude¶
-
struct nmea_position_t
longitude¶
-
char *
data_active_p¶
-
char *
-
struct
nmea_sentence_gsa_t¶ - #include <nmea.h>
Overall satellite data.
-
struct
nmea_sentence_gsv_t¶ - #include <nmea.h>
Detailed satellite data.
-
struct
nmea_sentence_rmc_t¶ - #include <nmea.h>
Recommended minimum data for GPS.
Public Members
-
char *
time_of_fix_p¶
-
char *
status_p¶
-
struct nmea_position_t
latitude¶
-
struct nmea_position_t
longitude¶
-
char *
speed_knots_p¶
-
char *
track_angle_p¶
-
char *
date_p¶
-
struct nmea_position_t
magnetic_variation¶
-
char *
-
struct
nmea_sentence_vtg_t¶ - #include <nmea.h>
Track made good and speed over ground.
Public Members
-
struct nmea_track_made_good_t
track_made_good_true¶
-
struct nmea_track_made_good_t
track_made_good_magnetic¶
-
struct nmea_value_t
ground_speed_knots¶
-
struct nmea_value_t
ground_speed_kmph¶
-
struct nmea_track_made_good_t
-
struct
nmea_sentence_t¶ - #include <nmea.h>
A union of all sentences.
Public Members
-
struct nmea_sentence_raw_t
raw¶
-
struct nmea_sentence_gga_t
gga¶
-
struct nmea_sentence_gll_t
gll¶
-
struct nmea_sentence_gsa_t
gsa¶
-
struct nmea_sentence_gsv_t
gsv¶
-
struct nmea_sentence_rmc_t
rmc¶
-
struct nmea_sentence_vtg_t
vtg¶
-
union nmea_sentence_t::@46 nmea_sentence_t::@47
-
struct nmea_sentence_raw_t