-
Notifications
You must be signed in to change notification settings - Fork 0
/
readgps.cpp
33 lines (29 loc) · 1 KB
/
readgps.cpp
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
#include "readgps.h"
readGps::readGps(QObject *parent)
{
source = QGeoPositionInfoSource::createDefaultSource(this);
if (source) {
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
source->startUpdates();
}
}
QList<qreal> readGps::captureGpsData()
{
QList <qreal> temp;
temp.clear();
temp.append(positionInfo.coordinate().altitude());
temp.append(positionInfo.coordinate().latitude());
temp.append(positionInfo.coordinate().longitude());
temp.append(positionInfo.attribute(QGeoPositionInfo::HorizontalAccuracy));
temp.append(static_cast<int>(positionInfo.attribute(QGeoPositionInfo::GroundSpeed)*3.75));
return temp;
}
void readGps::positionUpdated(const QGeoPositionInfo &info)
{
positionInfo = info;
qDebug() << info;
qDebug() <<"alt"<< info.coordinate().altitude();
qDebug() <<"lat"<< info.coordinate().latitude();
qDebug() <<"long"<< info.coordinate().longitude();
}