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-18 18:10:58 -08:00
|
|
|
GpsLocation(void (*showMsgCB)(const char *msg), QObject *parent);
|
2015-12-02 14:30:47 -08:00
|
|
|
~GpsLocation();
|
|
|
|
static GpsLocation *instance();
|
2015-11-18 19:23:19 -08:00
|
|
|
void applyLocations();
|
2015-11-13 09:17:13 -08:00
|
|
|
int getGpsNum() const;
|
2015-11-18 13:14:19 -08:00
|
|
|
QString getUserid(QString user, QString passwd);
|
2015-11-18 18:56:50 -08:00
|
|
|
bool hasLocationsSource();
|
2015-11-11 10:52:52 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
QGeoPositionInfo lastPos;
|
2015-11-30 10:58:18 -08:00
|
|
|
QGeoPositionInfoSource *getGpsSource();
|
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-18 14:44:07 -08:00
|
|
|
QString userAgent;
|
2015-11-18 18:10:58 -08:00
|
|
|
void (*showMessageCB)(const char *msg);
|
2015-12-02 14:30:47 -08:00
|
|
|
static GpsLocation *m_Instance;
|
2015-11-11 10:50:55 -08:00
|
|
|
|
|
|
|
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-18 13:14:19 -08:00
|
|
|
void getUseridError(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
|