1 2 /* dwgps.h */ 3 4 #ifndef DWGPS_H 5 #define DWGPS_H 1 6 7 8 #include <time.h> 9 #include "config.h" /* for struct misc_config_s */ 10 11 12 /* 13 * Values for fix, equivalent to values from libgps. 14 * -2 = not initialized. 15 * -1 = error communicating with GPS receiver. 16 * 0 = nothing heard yet. 17 * 1 = had signal but lost it. 18 * 2 = 2D. 19 * 3 = 3D. 20 * 21 * Undefined float & double values are set to G_UNKNOWN. 22 * 23 */ 24 25 enum dwfix_e { DWFIX_NOT_INIT= -2, DWFIX_ERROR= -1, DWFIX_NOT_SEEN=0, DWFIX_NO_FIX=1, DWFIX_2D=2, DWFIX_3D=3 }; 26 27 typedef enum dwfix_e dwfix_t; 28 29 typedef struct dwgps_info_s { 30 time_t timestamp; /* When last updated. System time. */ 31 dwfix_t fix; /* Quality of position fix. */ 32 double dlat; /* Latitude. Valid if fix >= 2. */ 33 double dlon; /* Longitude. Valid if fix >= 2. */ 34 float speed_knots; /* libgps uses meters/sec but we use GPS usual knots. */ 35 float track; /* What is difference between track and course? */ 36 float altitude; /* meters above mean sea level. Valid if fix == 3. */ 37 } dwgps_info_t; 38 39 40 41 42 43 void dwgps_init (struct misc_config_s *pconfig, int debug); 44 45 void dwgps_clear (dwgps_info_t *gpsinfo); 46 47 dwfix_t dwgps_read (dwgps_info_t *gpsinfo); 48 49 void dwgps_print (char *msg, dwgps_info_t *gpsinfo); 50 51 void dwgps_term (void); 52 53 void dwgps_set_data (dwgps_info_t *gpsinfo); 54 55 56 #endif /* DWGPS_H 1 */ 57 58 /* end dwgps.h */ 59 60 61 62