LatitudeUpdater 0.1, fix the previous commit
[googlelatitude] / latitudedaemon.h
diff --git a/latitudedaemon.h b/latitudedaemon.h
new file mode 100644 (file)
index 0000000..d18a673
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef LATITUDEDAEMON_H
+#define LATITUDEDAEMON_H
+
+#include <QObject>
+#include <QtCore/QCoreApplication>
+#include "googlelatitude.h"
+#include "gpscontrol.h"
+
+class LatitudeDaemon : public QObject {
+    Q_OBJECT
+public:
+    LatitudeDaemon(QObject *parent = 0);
+signals:
+
+public slots:
+
+private slots:
+    void gl_GotToken() {
+        qDebug() << "LatitudeDaemon::gl_GotToken()";
+        gps.startUpdates();
+    }
+    void gl_NotToken() {
+        qDebug() << "LatitudeDaemon::gl_NotToken()";
+        QCoreApplication::exit();
+    }
+    void gl_needAuth() {
+        qDebug() << "LatitudeDaemon::gl_needAuth()";
+        QCoreApplication::exit();
+    }
+    void get_gps() {
+        qDebug() << "LatitudeDaemon::get_gps()"
+                 << gps.getCurrentLatitude()
+                 << gps.getCurrentLongitude()
+                 << gps.getCurrentAccuracy()
+                 << gps.getCurrentTimestamp();
+    }
+    void set_latitude() {
+        qDebug() << "LatitudeDaemon::set_latitude()"
+                 << gps.getCurrentLatitude()
+                 << gps.getCurrentLongitude()
+                 << gps.getCurrentAccuracy()
+                 << gps.getCurrentTimestamp();
+        latitude.setCurrentLocation(gps.getCurrentLatitude(),
+                                    gps.getCurrentLongitude(),
+                                    gps.getCurrentAccuracy());
+        latitude.sendCurrentLocation();
+    }
+
+private:
+    GoogleLatitude latitude;
+    GpsControl gps;
+};
+
+#endif // LATITUDEDAEMON_H