d18a673904d30b3b1715444185a0b1227159fb75
[googlelatitude] / latituded / daemon.h
1 #ifndef LATITUDEDAEMON_H
2 #define LATITUDEDAEMON_H
3
4 #include <QObject>
5 #include <QtCore/QCoreApplication>
6 #include "googlelatitude.h"
7 #include "gpscontrol.h"
8
9 class LatitudeDaemon : public QObject {
10     Q_OBJECT
11 public:
12     LatitudeDaemon(QObject *parent = 0);
13 signals:
14
15 public slots:
16
17 private slots:
18     void gl_GotToken() {
19         qDebug() << "LatitudeDaemon::gl_GotToken()";
20         gps.startUpdates();
21     }
22     void gl_NotToken() {
23         qDebug() << "LatitudeDaemon::gl_NotToken()";
24         QCoreApplication::exit();
25     }
26     void gl_needAuth() {
27         qDebug() << "LatitudeDaemon::gl_needAuth()";
28         QCoreApplication::exit();
29     }
30     void get_gps() {
31         qDebug() << "LatitudeDaemon::get_gps()"
32                  << gps.getCurrentLatitude()
33                  << gps.getCurrentLongitude()
34                  << gps.getCurrentAccuracy()
35                  << gps.getCurrentTimestamp();
36     }
37     void set_latitude() {
38         qDebug() << "LatitudeDaemon::set_latitude()"
39                  << gps.getCurrentLatitude()
40                  << gps.getCurrentLongitude()
41                  << gps.getCurrentAccuracy()
42                  << gps.getCurrentTimestamp();
43         latitude.setCurrentLocation(gps.getCurrentLatitude(),
44                                     gps.getCurrentLongitude(),
45                                     gps.getCurrentAccuracy());
46         latitude.sendCurrentLocation();
47     }
48
49 private:
50     GoogleLatitude latitude;
51     GpsControl gps;
52 };
53
54 #endif // LATITUDEDAEMON_H