1 #ifndef __QTH_DATA_H__
2 #define __QTH_DATA_H__ 1
3 
4 #include <glib.h>
5 #include "sgpsdp/sgp4sdp4.h"
6 
7 /** QTH data structure in human readable form. */
8 typedef struct {
9     gchar          *name;       /*!< Name, eg. callsign. */
10     gchar          *loc;        /*!< Location, eg City, Country. */
11     gchar          *desc;       /*!< Short description. */
12     gdouble         lat;        /*!< Latitude in dec. deg. North. */
13     gdouble         lon;        /*!< Longitude in dec. deg. East. */
14     gint            alt;        /*!< Altitude above sea level in meters. */
15     gchar          *qra;        /*!< QRA locator */
16     gchar          *wx;         /*!< Weather station code (4 chars). */
17     gint            type;       /*!< QTH type (static,gpsd). */
18     gchar          *gpsd_server;        /*!< GPSD Server name. */
19     gint            gpsd_port;  /*!< GPSD Server port. */
20     gdouble         gpsd_update;        /*!< Time last GPSD update was received. */
21     gdouble         gpsd_connected;     /*!< Time last GPSD update was last attempted to connect. */
22     struct gps_data_t *gps_data;        /*!< gpsd data structure. */
23     GKeyFile       *data;       /*!< Raw data from cfg file. */
24 } qth_t;
25 
26 /** Compact QTH data structure for tagging data and comparing. */
27 typedef struct {
28     gdouble         lat;        /*!< Latitude in dec. deg. North. */
29     gdouble         lon;        /*!< Longitude in dec. deg. East. */
30     gint            alt;        /*!< Altitude above sea level in meters. */
31 } qth_small_t;
32 
33 static enum {
34     QTH_STATIC_TYPE = 0,
35     QTH_GPSD_TYPE
36 } qth_data_type;
37 
38 
39 gint            qth_data_read(const gchar * filename, qth_t * qth);
40 gint            qth_data_save(const gchar * filename, qth_t * qth);
41 void            qth_data_free(qth_t * qth);
42 gboolean        qth_data_update(qth_t * qth, gdouble t);
43 gboolean        qth_data_update_init(qth_t * qth);
44 void            qth_data_update_stop(qth_t * qth);
45 double          qth_small_dist(qth_t * qth, qth_small_t qth_small);
46 void            qth_small_save(qth_t * qth, qth_small_t * qth_small);
47 void            qth_init(qth_t * qth);
48 void            qth_safe(qth_t * qth);
49 
50 #endif
51