9f1cac95b4cec9388f45687da59f558232895e4b
[googlelatitude] / src / gps.h
1 #ifndef GPS_H
2 #define GPS_H
3
4 #include <QObject>
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 #ifdef Q_WS_MAEMO_5
27     friend void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps);
28 #endif // Q_WS_MAEMO_5
29
30 #ifdef Q_WS_MAEMO_5
31 #else
32 private slots:
33     void finishedreply(QNetworkReply *r);
34 #endif // Q_WS_MAEMO_5
35
36 private:
37     double latitude;
38     double longitude;
39     double accuracy;
40 #ifdef Q_WS_MAEMO_5
41     GMainLoop *loop;
42     LocationGPSDControl *control;
43     LocationGPSDevice *device;
44 #else
45     QUrl urlloc;
46     QNetworkAccessManager *worker;
47 #endif // Q_WS_MAEMO_5
48
49 };
50
51 #ifdef Q_WS_MAEMO_5
52 void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps);
53 #endif // Q_WS_MAEMO_5
54
55 #endif // GPS_H