00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __NMEAP_H__
00023 #define __NMEAP_H__
00024
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028
00029
00030
00031
00032
00033
00034
00035
00036
00038 #define NMEAP_MAX_SENTENCES 8
00039
00040 #define NMEAP_MAX_SENTENCE_NAME_LENGTH 5
00041
00043 #define NMEAP_MAX_SENTENCE_LENGTH 255
00044
00045 #define NMEAP_MAX_TOKENS 24
00046
00047
00048
00049
00050 #define NMEAP_GPGGA 1
00051
00052 #define NMEAP_GPRMC 2
00053
00055 #define NMEAP_USER 100
00056
00057
00058 struct nmeap_context;
00059 struct nmeap_sentence;
00060
00061
00062
00063
00064
00065
00066
00075 typedef void (*nmeap_callout_t)(struct nmeap_context *context,void *sentence_data,void *user_data);
00076
00087 typedef int (*nmeap_sentence_parser_t)(struct nmeap_context *context,struct nmeap_sentence *sentence);
00088
00089
00090
00091 #include "nmeap_def.h"
00092
00093
00094
00095
00096
00097
00098
00099
00101 struct nmeap_gga {
00102 double latitude;
00103 double longitude;
00104 double altitude;
00105 unsigned long time;
00106 int satellites;
00107 int quality;
00108 double hdop;
00109 double geoid;
00110 };
00111 typedef struct nmeap_gga nmeap_gga_t;
00112
00114 struct nmeap_rmc {
00115 unsigned long time;
00116 char warn;
00117 double latitude;
00118 double longitude;
00119 double speed;
00120 double course;
00121 unsigned long date;
00122 double magvar;
00123 };
00124
00125 typedef struct nmeap_rmc nmeap_rmc_t;
00126
00127
00128
00129
00130
00131
00132
00139 int nmeap_init(nmeap_context_t *context,void *user_data);
00140
00153 int nmeap_addParser(nmeap_context_t *context,
00154 const char *sentence_name,
00155 nmeap_sentence_parser_t sentence_parser,
00156 nmeap_callout_t sentence_callout,
00157 void *sentence_data
00158 );
00159
00168 int nmeap_parseBuffer(nmeap_context_t *context,const char *buffer,int *length);
00169
00176 int nmeap_parse(nmeap_context_t *context,char ch);
00177
00178
00184 int nmeap_gpgga(nmeap_context_t *context,nmeap_sentence_t *sentence);
00185
00191 int nmeap_gprmc(nmeap_context_t *context,nmeap_sentence_t *sentence);
00192
00199 double nmeap_latitude(const char *plat,const char *phem);
00200
00201
00208 double nmeap_longitude(const char *plat,const char *phem);
00209
00210 #ifdef __cplusplus
00211 }
00212 #endif
00213
00214
00215 #endif
00216