Version 0.6, daemon, gps, battery saver
[googlelatitude] / src / gps.h
1 #ifndef GPS_H
2 #define GPS_H
3
4 #include <QtCore>
5
6 #ifdef Q_WS_MAEMO_5
7 extern "C" {
8 #include <location/location-gps-device.h>
9 #include <location/location-gpsd-control.h>
10 }
11 #else
12 #include <QtNetwork>
13 #endif // Q_WS_MAEMO_5
14
15 class GpsMaemo5 : public QObject {
16     Q_OBJECT
17
18 signals:
19     void fix();
20
21 public:
22     GpsMaemo5(QObject *parent = 0);
23     double get_lat() { return latitude; }
24     double get_lon() { return longitude; }
25     double get_acc() { return accuracy; }
26
27 public slots:
28     void refresh();
29     void stop();
30     void forcestop();
31     int config(int i, int w, bool g);
32
33 private slots:
34 #ifdef Q_WS_MAEMO_5
35     friend void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps);
36 #else
37     void gloc_reply(QNetworkReply *r);
38 #endif // Q_WS_MAEMO_5
39
40 private:
41     double latitude;
42     double longitude;
43     double accuracy;
44     int interval;
45     int wait;
46     bool usegps;
47     bool emitfix;
48     bool stopgps;
49 #ifdef Q_WS_MAEMO_5
50     LocationGPSDControl *control;
51     LocationGPSDevice *device;
52 #else
53     QUrl urlloc;
54     QNetworkAccessManager *worker;
55 #endif // Q_WS_MAEMO_5
56 };
57
58 #ifdef Q_WS_MAEMO_5
59 void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps);
60 #endif // Q_WS_MAEMO_5
61
62 #endif // GPS_H