daemon mode and bugs fixes
[googlelatitude] / src / daemon.cpp
diff --git a/src/daemon.cpp b/src/daemon.cpp
new file mode 100644 (file)
index 0000000..7e9886d
--- /dev/null
@@ -0,0 +1,27 @@
+#include "daemon.h"
+
+Daemon::Daemon(QObject *parent) : QObject(parent) {
+    setting = new QSettings();
+    glatitude = new GoogleLatitude(this);
+    gps = new GpsMaemo5(this);
+    connect(gps, SIGNAL(fix()), this, SLOT(set()));
+    connect(glatitude, SIGNAL(OK()), this, SLOT(daemon_OK()));
+    connect(glatitude, SIGNAL(ERROR()), this, SLOT(daemon_ERROR()));
+}
+
+void Daemon::set() {
+    qDebug() << "Daemon: set";
+    glatitude->login(setting->value("user","my_username").toString(),
+                     setting->value("pass","my_password").toString());
+    glatitude->set(gps->get_lat(),
+                   gps->get_lon(),
+                   gps->get_acc());
+}
+
+void Daemon::daemon_OK() {
+    qDebug() << "Daemon: send";
+}
+
+void Daemon::daemon_ERROR() {
+    qDebug() << "Daemon: no auth";
+}