3e631c3cc50dcbe8d769422039900d5649caf618
[googlelatitude] / src / daemon.cpp
1 #include "daemon.h"
2
3 Daemon::Daemon(QObject *parent) : QObject(parent) {
4     setting = new QSettings();
5     glatitude = new GoogleLatitude(this);
6     gps = new GpsMaemo5(this);
7     connect(gps, SIGNAL(fix()), this, SLOT(set()));
8     connect(glatitude, SIGNAL(OK()), this, SLOT(daemon_OK()));
9     connect(glatitude, SIGNAL(ERROR()), this, SLOT(daemon_ERROR()));
10 }
11
12 void Daemon::set() {
13     qDebug() << "Daemon: set";
14     glatitude->login(setting->value("user","my_username").toString(),
15                      setting->value("pass","my_password").toString());
16     glatitude->freq(setting->value("freq","120").toInt());
17     glatitude->set(gps->get_lat(),
18                    gps->get_lon(),
19                    gps->get_acc());
20 }
21
22 void Daemon::daemon_OK() {
23     qDebug() << "Daemon: send";
24 }
25
26 void Daemon::daemon_ERROR() {
27     qDebug() << "Daemon: no auth";
28     QCoreApplication::exit();
29 }