2015-11-11 10:50:55 -08:00
|
|
|
#ifndef GPSLOCATION_H
|
|
|
|
#define GPSLOCATION_H
|
|
|
|
|
2015-11-11 15:19:09 -08:00
|
|
|
#include "units.h"
|
2015-11-11 10:52:52 -08:00
|
|
|
#include <QObject>
|
2015-11-11 10:50:55 -08:00
|
|
|
#include <QGeoCoordinate>
|
2015-11-11 10:52:52 -08:00
|
|
|
#include <QGeoPositionInfoSource>
|
|
|
|
#include <QGeoPositionInfo>
|
2015-11-11 15:19:09 -08:00
|
|
|
#include <QSettings>
|
2015-11-13 17:21:43 -08:00
|
|
|
#include <QNetworkReply>
|
2015-11-11 10:50:55 -08:00
|
|
|
|
2015-11-11 10:52:52 -08:00
|
|
|
class GpsLocation : QObject
|
2015-11-11 10:50:55 -08:00
|
|
|
{
|
2015-11-11 10:52:52 -08:00
|
|
|
Q_OBJECT
|
2015-11-11 10:50:55 -08:00
|
|
|
public:
|
2015-11-11 10:52:52 -08:00
|
|
|
GpsLocation(QObject *parent);
|
2015-11-12 14:57:27 -08:00
|
|
|
bool applyLocations();
|
2015-11-13 09:17:13 -08:00
|
|
|
int getGpsNum() const;
|
2015-11-11 10:52:52 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
QGeoPositionInfo lastPos;
|
2015-11-11 12:32:54 -08:00
|
|
|
QGeoPositionInfoSource *gpsSource;
|
2015-11-11 11:16:59 -08:00
|
|
|
void status(QString msg);
|
2015-11-13 11:55:39 -08:00
|
|
|
QSettings *geoSettings;
|
2015-11-13 17:21:43 -08:00
|
|
|
QNetworkReply *reply;
|
2015-11-11 10:50:55 -08:00
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
2015-11-11 12:34:56 -08:00
|
|
|
void serviceEnable(bool toggle);
|
2015-11-11 10:52:52 -08:00
|
|
|
void newPosition(QGeoPositionInfo pos);
|
|
|
|
void updateTimeout();
|
2015-11-13 17:21:43 -08:00
|
|
|
void uploadToServer();
|
|
|
|
void postError(QNetworkReply::NetworkError error);
|
2015-11-13 17:20:45 -08:00
|
|
|
void clearGpsData();
|
2015-11-13 17:21:43 -08:00
|
|
|
|
2015-11-11 10:50:55 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GPSLOCATION_H
|