support to no liblocation
authorRodrigo Linfati <rodrigo@linfati.cl>
Fri, 1 Jan 2010 15:58:50 +0000 (16:58 +0100)
committerRodrigo Linfati <rodrigo@linfati.cl>
Fri, 1 Jan 2010 15:58:50 +0000 (16:58 +0100)
src/gps.cpp
src/gps.h
src/gpsfake.h [new file with mode: 0644]
src/src.pro

index a326498..39c0627 100644 (file)
@@ -1,5 +1,7 @@
 #include "gps.h"
 
+#ifdef Q_WS_MAEMO_5
+
 GpsMaemo5::GpsMaemo5(QObject *parent) : QObject(parent) {
     latitude = 0;
     longitude = 0;
@@ -52,3 +54,5 @@ void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps) {
         }
     }
 }
+
+#endif
index e3de44a..42d8841 100644 (file)
--- a/src/gps.h
+++ b/src/gps.h
@@ -1,6 +1,8 @@
 #ifndef GPS_H
 #define GPS_H
 
+#ifdef Q_WS_MAEMO_5
+
 extern "C" {
 #include <location/location-gps-device.h>
 #include <location/location-gpsd-control.h>
@@ -43,4 +45,8 @@ private:
 
 void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps);
 
+#else
+#include "gpsfake.h"
+#endif
+
 #endif // GPS_H
diff --git a/src/gpsfake.h b/src/gpsfake.h
new file mode 100644 (file)
index 0000000..7db29f8
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef GPSFAKE_H
+#define GPSFAKE_H
+
+#include <QObject>
+
+class GpsMaemo5 : public QObject {
+    Q_OBJECT
+
+signals:
+    void getOK();
+    void getOK_acwp();
+    void getOK_agnss();
+
+public slots:
+    void get_acwp() { emit getOK_acwp(); }
+    void get_agnss() { emit getOK_agnss(); }
+
+public:
+    GpsMaemo5(QObject *parent = 0) : QObject(parent) {
+        latitude=0;
+        longitude=0;
+        accuracy=0;
+    }
+    double get_lat() { return latitude; }
+    double get_lon() { return longitude; }
+    double get_acc() { return accuracy; }
+    void stop() {}
+    void restart() {}
+
+private:
+    double latitude;
+    double longitude;
+    double accuracy;
+};
+
+#endif // GPSFAKE_H
index 12dfc2d..ade050a 100644 (file)
@@ -1,7 +1,8 @@
 QT += network
 QT += webkit
 CONFIG += link_pkgconfig
-PKGCONFIG += glib-2.0 liblocation
+PKGCONFIG += glib-2.0 \
+    liblocation
 TARGET = GoogleLatitude
 TEMPLATE = app
 SOURCES += main.cpp \
@@ -10,7 +11,8 @@ SOURCES += main.cpp \
     gps.cpp
 HEADERS += latitude.h \
     glatitude.h \
-    gps.h
+    gps.h \
+    gpsfake.h
 unix { 
     isEmpty(PREFIX):PREFIX = /usr/local
     BINDIR = $$PREFIX/bin