Updated.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Fri, 7 May 2010 06:17:32 +0000 (09:17 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Fri, 7 May 2010 06:17:32 +0000 (09:17 +0300)
images.qrc
src/gps/gpsposition.cpp
src/gps/gpsposition.h

index e38df87..da5e096 100644 (file)
@@ -22,5 +22,6 @@
         <file>res/images/list_item_bottom.png</file>
         <file>res/images/list_item_middle.png</file>
         <file>res/images/list_item_top.png</file>
+        <file>res/dummy/nmealog.txt</file>
     </qresource>
 </RCC>
index 510e42a..3afae1b 100644 (file)
 */
 
 #include <QGeoPositionInfoSource>
+#include <QNmeaPositionInfoSource>
+#include <QFile>
+#include <QDir>
+#include <QApplication>
 #include <QDebug>
 
 #include "gpsposition.h"
 GPSPosition::GPSPosition(QObject *parent)
     : QObject(parent)
 {
-    m_gpsSource = QGeoPositionInfoSource::createDefaultSource(this);
+    m_gpsSource = 0; //QGeoPositionInfoSource::createDefaultSource(this);
 
-    if (m_gpsSource)
-        m_gpsSource->setUpdateInterval(10000);
+//    if (!m_gpsSource) {
+        QNmeaPositionInfoSource *nmeaSource = new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode, this);
+        QFile *logFile = new QFile(":/res/dummy/nmealog.txt", this);
+        nmeaSource->setDevice(logFile);
+        m_gpsSource = nmeaSource;
+//    }
+
+    m_gpsSource->setUpdateInterval(5000);
 
     connect(m_gpsSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
             this, SLOT(positionUpdated(QGeoPositionInfo)));
+    connect(m_gpsSource, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
 }
 
 GPSPosition::~GPSPosition()
@@ -60,8 +71,13 @@ void GPSPosition::requestUpdate()
 
 void GPSPosition::positionUpdated(QGeoPositionInfo positionInfo)
 {
-    qDebug() << positionInfo;
+    qDebug() << __PRETTY_FUNCTION__ << " " << positionInfo;
 
     emit position(QPointF(positionInfo.coordinate().longitude(),
                           positionInfo.coordinate().latitude()));
 }
+
+void GPSPosition::updateTimeout()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+}
index da1ba59..890dce5 100644 (file)
@@ -42,6 +42,7 @@ public:
 private slots:
     void requestUpdate();
     void positionUpdated(QGeoPositionInfo positionInfo);
+    void updateTimeout();
 
 signals:
     void position(QPointF latLonCoordinate);