TwiceAsNice  2019-02-18
Classes | Macros | Enumerations | Functions
minmea.h File Reference
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <errno.h>
#include <time.h>
#include <math.h>
Include dependency graph for minmea.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  minmea_float
 
struct  minmea_date
 
struct  minmea_time
 
struct  minmea_sentence_rmc
 
struct  minmea_sentence_gga
 
struct  minmea_sentence_gll
 
struct  minmea_sentence_gst
 
struct  minmea_sentence_gsa
 
struct  minmea_sat_info
 
struct  minmea_sentence_gsv
 
struct  minmea_sentence_vtg
 
struct  minmea_sentence_zda
 

Macros

#define MINMEA_MAX_LENGTH   80
 

Enumerations

enum  minmea_sentence_id {
  MINMEA_INVALID = -1, MINMEA_UNKNOWN = 0, MINMEA_SENTENCE_RMC, MINMEA_SENTENCE_GGA,
  MINMEA_SENTENCE_GSA, MINMEA_SENTENCE_GLL, MINMEA_SENTENCE_GST, MINMEA_SENTENCE_GSV,
  MINMEA_SENTENCE_VTG, MINMEA_SENTENCE_ZDA
}
 
enum  minmea_gll_status { MINMEA_GLL_STATUS_DATA_VALID = 'A', MINMEA_GLL_STATUS_DATA_NOT_VALID = 'V' }
 
enum  minmea_faa_mode {
  MINMEA_FAA_MODE_AUTONOMOUS = 'A', MINMEA_FAA_MODE_DIFFERENTIAL = 'D', MINMEA_FAA_MODE_ESTIMATED = 'E', MINMEA_FAA_MODE_MANUAL = 'M',
  MINMEA_FAA_MODE_SIMULATED = 'S', MINMEA_FAA_MODE_NOT_VALID = 'N', MINMEA_FAA_MODE_PRECISE = 'P'
}
 
enum  minmea_gsa_mode { MINMEA_GPGSA_MODE_AUTO = 'A', MINMEA_GPGSA_MODE_FORCED = 'M' }
 
enum  minmea_gsa_fix_type { MINMEA_GPGSA_FIX_NONE = 1, MINMEA_GPGSA_FIX_2D = 2, MINMEA_GPGSA_FIX_3D = 3 }
 

Functions

uint8_t minmea_checksum (const char *sentence)
 Calculate raw sentence checksum. More...
 
bool minmea_check (const char *sentence, bool strict)
 Check sentence validity and checksum. More...
 
bool minmea_talker_id (char talker[3], const char *sentence)
 Determine talker identifier. More...
 
enum minmea_sentence_id minmea_sentence_id (const char *sentence, bool strict)
 Determine sentence identifier. More...
 
bool minmea_scan (const char *sentence, const char *format,...)
 Scanf-like processor for NMEA sentences. More...
 
bool minmea_parse_rmc (struct minmea_sentence_rmc *frame, const char *sentence)
 
bool minmea_parse_gga (struct minmea_sentence_gga *frame, const char *sentence)
 
bool minmea_parse_gsa (struct minmea_sentence_gsa *frame, const char *sentence)
 
bool minmea_parse_gll (struct minmea_sentence_gll *frame, const char *sentence)
 
bool minmea_parse_gst (struct minmea_sentence_gst *frame, const char *sentence)
 
bool minmea_parse_gsv (struct minmea_sentence_gsv *frame, const char *sentence)
 
bool minmea_parse_vtg (struct minmea_sentence_vtg *frame, const char *sentence)
 
bool minmea_parse_zda (struct minmea_sentence_zda *frame, const char *sentence)
 
int minmea_gettime (struct timespec *ts, const struct minmea_date *date, const struct minmea_time *time_)
 Convert GPS UTC date/time representation to a UNIX timestamp. More...
 
static int_least32_t minmea_rescale (struct minmea_float *f, int_least32_t new_scale)
 Rescale a fixed-point value to a different scale. More...
 
static float minmea_tofloat (struct minmea_float *f)
 Convert a fixed-point value to a floating-point value. More...
 
static float minmea_tocoord (struct minmea_float *f)
 Convert a raw coordinate to a floating point DD.DDD... More...
 

Macro Definition Documentation

◆ MINMEA_MAX_LENGTH

#define MINMEA_MAX_LENGTH   80

Enumeration Type Documentation

◆ minmea_faa_mode

Enumerator
MINMEA_FAA_MODE_AUTONOMOUS 
MINMEA_FAA_MODE_DIFFERENTIAL 
MINMEA_FAA_MODE_ESTIMATED 
MINMEA_FAA_MODE_MANUAL 
MINMEA_FAA_MODE_SIMULATED 
MINMEA_FAA_MODE_NOT_VALID 
MINMEA_FAA_MODE_PRECISE 

◆ minmea_gll_status

Enumerator
MINMEA_GLL_STATUS_DATA_VALID 
MINMEA_GLL_STATUS_DATA_NOT_VALID 

◆ minmea_gsa_fix_type

Enumerator
MINMEA_GPGSA_FIX_NONE 
MINMEA_GPGSA_FIX_2D 
MINMEA_GPGSA_FIX_3D 

◆ minmea_gsa_mode

Enumerator
MINMEA_GPGSA_MODE_AUTO 
MINMEA_GPGSA_MODE_FORCED 

◆ minmea_sentence_id

Enumerator
MINMEA_INVALID 
MINMEA_UNKNOWN 
MINMEA_SENTENCE_RMC 
MINMEA_SENTENCE_GGA 
MINMEA_SENTENCE_GSA 
MINMEA_SENTENCE_GLL 
MINMEA_SENTENCE_GST 
MINMEA_SENTENCE_GSV 
MINMEA_SENTENCE_VTG 
MINMEA_SENTENCE_ZDA 

Function Documentation

◆ minmea_check()

bool minmea_check ( const char *  sentence,
bool  strict 
)

Check sentence validity and checksum.

Returns true for valid sentences.

◆ minmea_checksum()

uint8_t minmea_checksum ( const char *  sentence)

Calculate raw sentence checksum.

Does not check sentence integrity.

◆ minmea_gettime()

int minmea_gettime ( struct timespec *  ts,
const struct minmea_date date,
const struct minmea_time time_ 
)

Convert GPS UTC date/time representation to a UNIX timestamp.

◆ minmea_parse_gga()

bool minmea_parse_gga ( struct minmea_sentence_gga frame,
const char *  sentence 
)

◆ minmea_parse_gll()

bool minmea_parse_gll ( struct minmea_sentence_gll frame,
const char *  sentence 
)

◆ minmea_parse_gsa()

bool minmea_parse_gsa ( struct minmea_sentence_gsa frame,
const char *  sentence 
)

◆ minmea_parse_gst()

bool minmea_parse_gst ( struct minmea_sentence_gst frame,
const char *  sentence 
)

◆ minmea_parse_gsv()

bool minmea_parse_gsv ( struct minmea_sentence_gsv frame,
const char *  sentence 
)

◆ minmea_parse_rmc()

bool minmea_parse_rmc ( struct minmea_sentence_rmc frame,
const char *  sentence 
)

◆ minmea_parse_vtg()

bool minmea_parse_vtg ( struct minmea_sentence_vtg frame,
const char *  sentence 
)

◆ minmea_parse_zda()

bool minmea_parse_zda ( struct minmea_sentence_zda frame,
const char *  sentence 
)

◆ minmea_rescale()

static int_least32_t minmea_rescale ( struct minmea_float f,
int_least32_t  new_scale 
)
inlinestatic

Rescale a fixed-point value to a different scale.

Rounds towards zero.

◆ minmea_scan()

bool minmea_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 - fractional, returned as value + scale (int *, int *) i - decimal, default zero (int *) s - string (char *) t - talker identifier and type (char *) T - date/time stamp (int *, int *, int *) Returns true on success. See library source code for details.

◆ minmea_sentence_id()

enum minmea_sentence_id minmea_sentence_id ( const char *  sentence,
bool  strict 
)

Determine sentence identifier.

◆ minmea_talker_id()

bool minmea_talker_id ( char  talker[3],
const char *  sentence 
)

Determine talker identifier.

◆ minmea_tocoord()

static float minmea_tocoord ( struct minmea_float f)
inlinestatic

Convert a raw coordinate to a floating point DD.DDD...

value. Returns NaN for "unknown" values.

◆ minmea_tofloat()

static float minmea_tofloat ( struct minmea_float f)
inlinestatic

Convert a fixed-point value to a floating-point value.

Returns NaN for "unknown" values.