1 #include "gpscontroller.h"
5 #include <QGeoPositionInfo>
6 #include <QGeoPositionInfoSource>
9 GpsController::GpsController(bool started) :
10 m_gps(QGeoPositionInfoSource::createDefaultSource(this)),
13 m_gps->setUpdateInterval(20000);
14 connect(m_gps, SIGNAL(positionUpdated(QGeoPositionInfo)),
15 this, SLOT(updateLocation(QGeoPositionInfo)));
16 connect(m_gps, SIGNAL(updateTimeout()),
17 this, SLOT(timeoutRequested()));
18 if (m_started) m_gps->startUpdates();
21 GpsController::~GpsController()
26 void GpsController::useGPS( bool use)
28 if (use) m_gps->startUpdates();
29 else m_gps->stopUpdates();
32 bool GpsController::isStarted() const
37 QGeoPositionInfoSource *GpsController::gps() const
42 void GpsController::updateLocation( QGeoPositionInfo positionInfo )
44 qDebug() << "GPS location update received";
45 Locations *locations = Locations::GetInstance();
49 qDebug() << "Null locations received from getInstance";
51 qDebug() << "Locations is not null";
52 Location* gpsLoc = locations->getGpsLocation();
54 qDebug() << "Null gpsLocation received from locations";
56 qDebug() << "GPS location is not null.";*/
59 locations->getGpsLocation()->setLocation(positionInfo);
60 //emit(gpsLocationChanged(m_location));
63 void GpsController::timeoutRequested()
65 qDebug() << "GPS sent timeout requested.";