e16c2fbe3cae00d1897c8263bf7189dfaec4f536
[googlelatitude] / src / daemon / gps.h
1 #ifndef GPS_H
2 #define GPS_H
3
4 #include <QObject>
5
6 #ifdef Q_WS_MAEMO_5
7
8 extern "C" {
9 #include <location/location-gps-device.h>
10 #include <location/location-gpsd-control.h>
11 }
12
13 class GpsMaemo5 : public QObject {
14     Q_OBJECT
15
16 signals:
17     void fix();
18
19 public:
20     GpsMaemo5(LocationGPSDControlInterval location_interval,
21               LocationGPSDControlMethod location_method,
22               QObject *parent = 0);
23     double get_lat() { return latitude; }
24     double get_lon() { return longitude; }
25     double get_acc() { return accuracy; }
26     friend void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps);
27     void updateGPSConfig (LocationGPSDControlInterval interval,
28                           LocationGPSDControlMethod method);
29
30 public slots:
31     void enable();
32     void disable();
33
34 private:
35     double latitude;
36     double longitude;
37     double accuracy;
38
39     GMainLoop *loop;
40     LocationGPSDControl *control;
41     LocationGPSDevice *device;
42 };
43
44 void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps);
45
46 #else // Q_WS_MAEMO_5
47
48 class GpsMaemo5 : public QObject {
49     Q_OBJECT
50
51 signals:
52     void fix();
53
54 public:
55     GpsMaemo5(QObject *parent = 0) { Q_UNUSED(parent); }
56     double get_lat() { return 0; }
57     double get_lon() { return 0; }
58     double get_acc() { return 0; }
59 };
60
61 #endif // Q_WS_MAEMO_5
62
63 #endif // GPS_H