Changed the old code to work as a daemon
[googlelatitude] / src / daemon / gps.h
diff --git a/src/daemon/gps.h b/src/daemon/gps.h
new file mode 100644 (file)
index 0000000..e16c2fb
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef GPS_H
+#define GPS_H
+
+#include <QObject>
+
+#ifdef Q_WS_MAEMO_5
+
+extern "C" {
+#include <location/location-gps-device.h>
+#include <location/location-gpsd-control.h>
+}
+
+class GpsMaemo5 : public QObject {
+    Q_OBJECT
+
+signals:
+    void fix();
+
+public:
+    GpsMaemo5(LocationGPSDControlInterval location_interval,
+              LocationGPSDControlMethod location_method,
+              QObject *parent = 0);
+    double get_lat() { return latitude; }
+    double get_lon() { return longitude; }
+    double get_acc() { return accuracy; }
+    friend void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps);
+    void updateGPSConfig (LocationGPSDControlInterval interval,
+                          LocationGPSDControlMethod method);
+
+public slots:
+    void enable();
+    void disable();
+
+private:
+    double latitude;
+    double longitude;
+    double accuracy;
+
+    GMainLoop *loop;
+    LocationGPSDControl *control;
+    LocationGPSDevice *device;
+};
+
+void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps);
+
+#else // Q_WS_MAEMO_5
+
+class GpsMaemo5 : public QObject {
+    Q_OBJECT
+
+signals:
+    void fix();
+
+public:
+    GpsMaemo5(QObject *parent = 0) { Q_UNUSED(parent); }
+    double get_lat() { return 0; }
+    double get_lon() { return 0; }
+    double get_acc() { return 0; }
+};
+
+#endif // Q_WS_MAEMO_5
+
+#endif // GPS_H