2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 #include <QGeoPositionInfoSource>
23 #include <QNmeaPositionInfoSource>
26 #include <QApplication>
29 #include "gpsposition.h"
31 GPSPosition::GPSPosition(QObject *parent)
34 m_gpsSource = 0; //QGeoPositionInfoSource::createDefaultSource(this);
36 // if (!m_gpsSource) {
37 QNmeaPositionInfoSource *nmeaSource = new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode, this);
38 QFile *logFile = new QFile(":/res/dummy/nmealog.txt", this);
39 nmeaSource->setDevice(logFile);
40 m_gpsSource = nmeaSource;
43 m_gpsSource->setUpdateInterval(5000);
45 connect(m_gpsSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
46 this, SLOT(positionUpdated(QGeoPositionInfo)));
47 connect(m_gpsSource, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
50 GPSPosition::~GPSPosition()
55 void GPSPosition::start()
58 m_gpsSource->startUpdates();
61 void GPSPosition::stop()
64 m_gpsSource->stopUpdates();
67 void GPSPosition::requestUpdate()
72 void GPSPosition::positionUpdated(QGeoPositionInfo positionInfo)
74 qDebug() << __PRETTY_FUNCTION__ << " " << positionInfo;
76 emit position(QPointF(positionInfo.coordinate().longitude(),
77 positionInfo.coordinate().latitude()));
80 void GPSPosition::updateTimeout()
82 qDebug() << __PRETTY_FUNCTION__;