X-Git-Url: http://git.maemo.org/git/?p=googlelatitude;a=blobdiff_plain;f=src%2Fdaemon.cpp;h=757487099ecbc32ce26dfe52ea718e79490aa393;hp=3e631c3cc50dcbe8d769422039900d5649caf618;hb=f66076c2991b0519cde383b2d09167333d55f5d6;hpb=4fe4a04458ce7f275738bff27f00565dc500e4fc diff --git a/src/daemon.cpp b/src/daemon.cpp index 3e631c3..7574870 100644 --- a/src/daemon.cpp +++ b/src/daemon.cpp @@ -2,28 +2,42 @@ Daemon::Daemon(QObject *parent) : QObject(parent) { setting = new QSettings(); - glatitude = new GoogleLatitude(this); gps = new GpsMaemo5(this); + glatitude = new GoogleLatitude(this); + connect(gps, SIGNAL(fix()), this, SLOT(set())); - connect(glatitude, SIGNAL(OK()), this, SLOT(daemon_OK())); - connect(glatitude, SIGNAL(ERROR()), this, SLOT(daemon_ERROR())); + connect(glatitude, SIGNAL(glat_ok()), this, SLOT(daemon_ok())); + connect(glatitude, SIGNAL(glat_error()), this, SLOT(daemon_error())); + + set_config(); + if ( 0 ) gps->config(15, 3, 0); + + gps->refresh(); } void Daemon::set() { qDebug() << "Daemon: set"; - glatitude->login(setting->value("user","my_username").toString(), - setting->value("pass","my_password").toString()); - glatitude->freq(setting->value("freq","120").toInt()); - glatitude->set(gps->get_lat(), - gps->get_lon(), - gps->get_acc()); + set_config(); + glatitude->update(gps->get_lat(), + gps->get_lon(), + gps->get_acc()); +} + +void Daemon::set_config() { + qDebug() << "Daemon: set_config"; + glatitude->set_login(setting->value("user","my_username").toString(), + setting->value("pass","my_password").toString()); + + gps->config(setting->value("interval",1800).toInt(), + setting->value("wait",30).toInt(), + setting->value("method","cell").toString()); } -void Daemon::daemon_OK() { - qDebug() << "Daemon: send"; +void Daemon::daemon_ok() { + qDebug() << "Daemon: ok"; } -void Daemon::daemon_ERROR() { +void Daemon::daemon_error() { qDebug() << "Daemon: no auth"; QCoreApplication::exit(); }