nmeap.h
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 #include "cfg/cfg_nmea.h"
00030
00031
00032
00033
00034
00035
00036
00037
00038
00040 #define NMEAP_MAX_SENTENCES CONFIG_NMEAP_MAX_SENTENCES
00041
00042 #define NMEAP_MAX_SENTENCE_NAME_LENGTH 5
00043
00045 #define NMEAP_MAX_SENTENCE_LENGTH CONFIG_NMEAP_MAX_SENTENCE_LENGTH
00046
00047 #define NMEAP_MAX_TOKENS CONFIG_NMEAP_MAX_TOKENS
00048
00049
00050
00051
00052 #define NMEAP_GPGGA 1
00053
00054 #define NMEAP_GPRMC 2
00055
00057 #define NMEAP_USER 100
00058
00059
00060 struct nmeap_context;
00061 struct nmeap_sentence;
00062
00063
00064
00065
00066
00067
00068
00077 typedef void (*nmeap_callout_t)(struct nmeap_context *context,void *sentence_data,void *user_data);
00078
00089 typedef int (*nmeap_sentence_parser_t)(struct nmeap_context *context,struct nmeap_sentence *sentence);
00090
00091
00092
00093 #include "nmeap_def.h"
00094
00095
00096
00097
00098
00099
00100
00101
00103 struct nmeap_gga {
00104 double latitude;
00105 double longitude;
00106 double altitude;
00107 unsigned long time;
00108 int satellites;
00109 int quality;
00110 double hdop;
00111 double geoid;
00112 };
00113 typedef struct nmeap_gga nmeap_gga_t;
00114
00116 struct nmeap_rmc {
00117 unsigned long time;
00118 char warn;
00119 double latitude;
00120 double longitude;
00121 double speed;
00122 double course;
00123 unsigned long date;
00124 double magvar;
00125 };
00126
00127 typedef struct nmeap_rmc nmeap_rmc_t;
00128
00129
00130
00131
00132
00133
00134
00141 int nmeap_init(nmeap_context_t *context,void *user_data);
00142
00155 int nmeap_addParser(nmeap_context_t *context,
00156 const char *sentence_name,
00157 nmeap_sentence_parser_t sentence_parser,
00158 nmeap_callout_t sentence_callout,
00159 void *sentence_data
00160 );
00161
00170 int nmeap_parseBuffer(nmeap_context_t *context,const char *buffer,int *length);
00171
00178 int nmeap_parse(nmeap_context_t *context,char ch);
00179
00180
00186 int nmeap_gpgga(nmeap_context_t *context,nmeap_sentence_t *sentence);
00187
00193 int nmeap_gprmc(nmeap_context_t *context,nmeap_sentence_t *sentence);
00194
00201 double nmeap_latitude(const char *plat,const char *phem);
00202
00203
00210 double nmeap_longitude(const char *plat,const char *phem);
00211
00212
00219 double nmeap_altitude(const char *palt,const char *punits);
00220
00221 #ifdef __cplusplus
00222 }
00223 #endif
00224
00225
00226 #endif
00227