blob: 3e0c44d7cfc7c4a9be6d2e51e7e0086e9d360390 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Gypsy
*
* A simple to use and understand GPSD replacement
* that uses D-Bus, GLib and memory allocations
*
* Author: Iain Holmes <iain@gnome.org>
* Copyright (C) 2007
*/
#ifndef __NMEA_PARSER_H__
#define __NMEA_PARSER_H__
#include <glib.h>
#include "gypsy-client.h"
#define GSV_FIELDS 19
#define GSA_FIELDS 17
#define GGA_FIELDS 14
#define RMC_FIELDS 12
typedef struct _NMEAParseContext {
GypsyClient *client;
union {
char *rmc_fields[RMC_FIELDS];
char *gga_fields[GGA_FIELDS];
char *gsa_fields[GSA_FIELDS];
char *gsv_fields[GSV_FIELDS];
} fields;
/* This is stored as only RMC supplies it but other sentences
can supply the UTC time. We convert UTC time into seconds
and add it to this to get the timestamp */
GDate *date; /* The date from the most recent RMC */
guint32 datestamp; /* Time from epoch in seconds */
/* This is used to store the in use details between sentences */
int in_use_count;
int in_use[MAX_SATELLITES]; /* The satellites that are in use */
/* This is used to store the satellite details between sentences */
int number_of_messages; /* How many GSV messages we'll get */
int message_count; /* Number of GSV messages seen */
} NMEAParseContext;
gboolean nmea_parse_sentence (NMEAParseContext *ctxt,
char *sentence,
GError **error);
NMEAParseContext *nmea_parse_context_new (GypsyClient *client);
void nmea_parse_context_free (NMEAParseContext *ctxt);
#endif
|