blob: 51a319ed5f82207cdfce28b79b0b2558bad55587 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef TRACKER_H
#define TRACKER_H
#include <QObject>
#include <QQueue>
#include <QGeoPositionInfo>
#include <QNetworkSession>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QSslError>
#include <qjson/serializer.h>
using namespace QtMobility;
class Tracker : public QObject
{
Q_OBJECT
public:
Tracker(const QString &server, const QString &serverPath, const QString &username, const QString &password, const QString &certPath = QString(), unsigned int port = 443, QObject *parent = 0);
private:
QUrl m_url;
QList<QSslError> m_expectedSslErrors;
QQueue<QByteArray> m_positions;
QJson::Serializer m_json;
QNetworkSession m_session;
QNetworkAccessManager m_network;
bool m_isUploading;
private slots:
void positionUpdated(const QGeoPositionInfo &update);
void upload();
void uploadError(QNetworkReply::NetworkError);
void nextUpload();
};
#endif // TRACKER_H
|