Fix build on Qt-Creator
[googlelatitude] / gpscontrol.h
1 #ifndef GPSCONTROL_H
2 #define GPSCONTROL_H
3
4 #include <QObject>
5 #include <QtCore/QDebug>
6 #include <QtCore/QSettings>
7 #include <QtCore/QTimer>
8 #include <QtLocation/QGeoPositionInfo>
9 #include <QtLocation/QGeoPositionInfoSource>
10
11 using namespace QtMobility;
12
13 class GpsControl : public QObject {
14     Q_OBJECT
15 public:
16     GpsControl(QObject *parent = 0);
17
18 signals:
19     void gotUpdate();
20     void gotFix();
21
22 public slots:
23     void setTimeOut(int sec);
24     int getTimeOut();
25     void setInterval(int sec);
26     int getInterval();
27     void setPositioningMethod(QString method);
28     QString getPositioningMethod() {return GpsSettings.value("gps_method").toString();}
29     void startUpdates();
30     void stopUpdates(bool force = false);
31     double getCurrentLatitude();
32     double getCurrentLongitude();
33     double getCurrentAccuracy();
34     unsigned int getCurrentTimestamp();
35
36 private slots:
37     void setCurrentLocation(QGeoPositionInfo pos);
38     void onGotUpdate() { qDebug() << "* GpsControl::ongotUpdate"; }
39     void onGotFix() { qDebug() << "* GpsControl::ongotFix"; }
40
41 private:
42     QSettings GpsSettings;
43     QGeoPositionInfoSource *GpsSource;
44     QGeoPositionInfo GpsPosition;
45     QTimer GpsTimeout;
46     QTimer GpsInterval;
47 };
48
49 #endif // GPSCONTROL_H