2015-11-11 18:50:55 +00:00
|
|
|
#ifndef GPSLOCATION_H
|
|
|
|
#define GPSLOCATION_H
|
|
|
|
|
2015-11-11 23:19:09 +00:00
|
|
|
#include "units.h"
|
2015-11-11 18:52:52 +00:00
|
|
|
#include <QObject>
|
2015-11-11 18:50:55 +00:00
|
|
|
#include <QGeoCoordinate>
|
2015-11-11 18:52:52 +00:00
|
|
|
#include <QGeoPositionInfoSource>
|
|
|
|
#include <QGeoPositionInfo>
|
2015-11-11 23:19:09 +00:00
|
|
|
#include <QSettings>
|
2015-11-14 01:21:43 +00:00
|
|
|
#include <QNetworkReply>
|
2015-11-11 18:50:55 +00:00
|
|
|
|
2015-11-11 18:52:52 +00:00
|
|
|
class GpsLocation : QObject
|
2015-11-11 18:50:55 +00:00
|
|
|
{
|
2015-11-11 18:52:52 +00:00
|
|
|
Q_OBJECT
|
2015-11-11 18:50:55 +00:00
|
|
|
public:
|
2015-11-19 02:10:58 +00:00
|
|
|
GpsLocation(void (*showMsgCB)(const char *msg), QObject *parent);
|
2015-11-19 03:23:19 +00:00
|
|
|
void applyLocations();
|
2015-11-13 17:17:13 +00:00
|
|
|
int getGpsNum() const;
|
2015-11-18 21:14:19 +00:00
|
|
|
QString getUserid(QString user, QString passwd);
|
2015-11-19 02:56:50 +00:00
|
|
|
bool hasLocationsSource();
|
2015-11-11 18:52:52 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QGeoPositionInfo lastPos;
|
2015-11-11 20:32:54 +00:00
|
|
|
QGeoPositionInfoSource *gpsSource;
|
2015-11-11 19:16:59 +00:00
|
|
|
void status(QString msg);
|
2015-11-13 19:55:39 +00:00
|
|
|
QSettings *geoSettings;
|
2015-11-14 01:21:43 +00:00
|
|
|
QNetworkReply *reply;
|
2015-11-18 22:44:07 +00:00
|
|
|
QString userAgent;
|
2015-11-19 02:10:58 +00:00
|
|
|
void (*showMessageCB)(const char *msg);
|
2015-11-11 18:50:55 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
2015-11-11 20:34:56 +00:00
|
|
|
void serviceEnable(bool toggle);
|
2015-11-11 18:52:52 +00:00
|
|
|
void newPosition(QGeoPositionInfo pos);
|
|
|
|
void updateTimeout();
|
2015-11-14 01:21:43 +00:00
|
|
|
void uploadToServer();
|
|
|
|
void postError(QNetworkReply::NetworkError error);
|
2015-11-18 21:14:19 +00:00
|
|
|
void getUseridError(QNetworkReply::NetworkError error);
|
2015-11-14 01:20:45 +00:00
|
|
|
void clearGpsData();
|
2015-11-14 01:21:43 +00:00
|
|
|
|
2015-11-11 18:50:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GPSLOCATION_H
|