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();
}