Main Page | Data Structures | File List | Data Fields | Globals

nmeap.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2005, David M Howard (daveh at dmh2000.com)
00003 All rights reserved.
00004 
00005 This product is licensed for use and distribution under the BSD Open Source License.
00006 see the file COPYING for more details.
00007 
00008 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00009 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00010 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
00011 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
00012 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
00013 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
00014 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
00015 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
00016 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
00017 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
00018 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00019 
00020 */
00021 
00022 #ifndef __NMEAP_H__
00023 #define __NMEAP_H__
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 /* 
00030 ============================================
00031 COMPILE TIME CONFIGURATION CONSTANTS
00032 ============================================
00033 */
00034 
00035 /* these constants affect the size of the context object. tweak them as desired but know what you are doing */
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 /* predefined message ID's */
00048 
00049 /* GGA MESSAGE ID */
00050 #define NMEAP_GPGGA 1
00051 /* RMC MESSAGE ID */
00052 #define NMEAP_GPRMC 2
00053 
00055 #define NMEAP_USER  100
00056 
00057 /* forward references */
00058 struct nmeap_context;
00059 struct nmeap_sentence;
00060 
00061 /* 
00062 ============================================
00063 CALLOUTS
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 /* ==== opaque types === */
00091 #include "nmeap_def.h"
00092 
00093 
00094 /* 
00095 ============================================
00096 STANDARD SENTENCE DATA STRUCTURES
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 METHODS
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 } // extern C
00212 #endif
00213 
00214 
00215 #endif
00216 

Generated on Wed Mar 14 20:32:17 2007 for GloPosCom by doxygen 1.3.4