Skytraq S1315F-RAW-EVK Logger

Dependencies:   TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NMEA_parse.h Source File

NMEA_parse.h

00001 
00002 #ifndef _NMEA_PARSE_H
00003 #define _NMEA_PARSE_H
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif
00007 
00008 #define    LIBNMEA_PARSE_NONE        (0)
00009 #define    LIBNMEA_PARSE_SUMOK        (10)
00010 #define    LIBNMEA_PARSE_COMPLETE    (100)
00011 
00012 #define    LIBNMEA_NUMSOFARRAY(array)    (sizeof((array))/sizeof((array)[0]))
00013 
00014 typedef double libNMEA_realnum_t;
00015 typedef long   libNMEA_intnum_t;
00016 
00017 typedef struct {
00018 //    unsigned char isValid;
00019     unsigned char active;         /* '0' or '1' = Fix not available,'2' = 2D,'3' = 3D */
00020     unsigned char positioning;    /* 'A' = 単独測位,D = DGPS,N = 無効 */
00021 } libNMEA_gps_status_t;
00022 
00023 typedef struct {
00024     unsigned long res1:1;
00025     unsigned long year:12;
00026     unsigned long mon:4;
00027     unsigned long day:6;
00028     unsigned long res2:9;
00029 } libNMEA_gps_date_t;
00030 
00031 typedef struct {
00032     unsigned long res:1;
00033     unsigned long hour:5;
00034     unsigned long min:6;
00035     unsigned long sec:6;
00036     unsigned long msec:14;
00037 } libNMEA_gps_time_t;
00038 
00039 typedef struct {
00040 //    unsigned char isValid;
00041     unsigned char unit;
00042     libNMEA_realnum_t deg;
00043 } libNMEA_gps_deg_t;
00044 
00045 typedef struct {
00046     unsigned char lat_unit;    /* 'N'(Nouth) or 'S'(South) */
00047     unsigned char lon_unit;    /* 'W'(West) or 'E'(East) */
00048     libNMEA_realnum_t latitude;
00049     libNMEA_realnum_t longitude;
00050 } libNMEA_gps_latlon_t;
00051 
00052 typedef struct {
00053 //    unsigned char isValid;
00054     libNMEA_realnum_t ground;
00055 } libNMEA_gps_speed_t;
00056 
00057 typedef struct {
00058 //    unsigned char isValid;
00059     libNMEA_realnum_t dop;
00060 } libNMEA_gps_dop_t;
00061 
00062 typedef struct {
00063     libNMEA_gps_deg_t trueNorth;
00064     libNMEA_gps_deg_t magnetic;
00065     libNMEA_gps_deg_t mag_dec;
00066 } libNMEA_gps_direction_t;
00067 
00068 typedef struct {
00069     libNMEA_gps_dop_t    h;
00070     libNMEA_gps_dop_t    v;
00071     libNMEA_gps_dop_t    p;
00072 } libNMEA_gps_accuracy_t;
00073 
00074 typedef struct {
00075     unsigned long status:1;    /* これが1ならば,GPS のデータを信用する */
00076     unsigned long active:1;
00077     unsigned long positioning:1;
00078     unsigned long date:1;
00079     unsigned long timeRMC:1;
00080     unsigned long timeZDA:1;
00081     unsigned long latitude:1;
00082     unsigned long longitude:1;
00083     unsigned long speed:1;
00084     unsigned long direction:1;
00085     unsigned long accuracy_hdop:1;
00086     unsigned long accuracy_vdop:1;
00087     unsigned long accuracy_pdop:1;
00088     unsigned long res:19;
00089 } libNMEA_gps_valid_t;
00090 
00091 typedef struct {
00092     libNMEA_gps_valid_t     valid;
00093     libNMEA_gps_status_t    status;
00094     libNMEA_gps_date_t      date;
00095     libNMEA_gps_time_t      time;
00096     libNMEA_gps_latlon_t    latlon;
00097     libNMEA_gps_speed_t     speed;
00098     libNMEA_gps_direction_t direction;
00099     libNMEA_gps_accuracy_t  accuracy;
00100 } libNMEA_gps_info_t;
00101 
00102 typedef struct {
00103     short cjobst;
00104     unsigned char raw[82+2];
00105     short rawLength;
00106     unsigned char sum;
00107     unsigned char sumwk;
00108     short argc;
00109     short argv[31];     /* NMEA センテンスで処理できる最大トークン数.メモリを節約したいのでポインタではなく先頭からのオフセットにしている. */
00110 } libNMEA_data_t;
00111 
00112 extern short libNMEA_Parse1Char(unsigned char c,libNMEA_data_t *buffer);
00113 short libNMEA_Parse1Line(libNMEA_data_t *buffer,libNMEA_gps_info_t *GPSinfo);
00114 
00115 #ifdef __cplusplus
00116 }
00117 #endif
00118 
00119 #endif /* _NMEA_PARSE_H */