#include "gpsposition.h"
-#ifdef Q_WS_MAEMO_5
+#if defined(Q_WS_MAEMO_5) | defined(Q_WS_SIMULATOR)
#include "gps/gpspositionprivate.h"
#else
#include "gps/gpspositionprivatestub.h"
{
m_gpsPositionPrivate->stop();
}
-
-void GPSPosition::update()
-{
- m_gpsPositionPrivate->update();
-}
*/
void stop();
-private slots:
- /**
- * @brief Slot for GPS update request.
- */
- virtual void update();
-
/******************************************************************************
* SIGNALS
******************************************************************************/
}
if (m_gpsSource) {
- connect(m_gpsSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
- this, SLOT(positionUpdated(QGeoPositionInfo)));
+ connect(m_gpsSource, SIGNAL(positionUpdated(const QGeoPositionInfo &)),
+ this, SLOT(positionUpdated(const QGeoPositionInfo &)));
connect(m_gpsSource, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
m_gpsSource->setUpdateInterval(m_updateInterval);
return m_running;
}
-void GPSPositionPrivate::update()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- emit m_gpsSource->requestUpdate(DEFAULT_UPDATE_INTERVAL);
-}
-
QPointF GPSPositionPrivate::lastPosition()
{
QGeoCoordinate coordinate = m_gpsSource->lastKnownPosition().coordinate();
}
}
-void GPSPositionPrivate::positionUpdated(QGeoPositionInfo positionInfo)
+void GPSPositionPrivate::positionUpdated(const QGeoPositionInfo &positionInfo)
{
qDebug() << __PRETTY_FUNCTION__ << positionInfo;
}
}
-qreal GPSPositionPrivate::accuracy(QGeoPositionInfo positionInfo)
+qreal GPSPositionPrivate::accuracy(const QGeoPositionInfo &positionInfo)
{
qDebug() << __PRETTY_FUNCTION__;
- if (!positionInfo.dateTime().isValid())
+ QDateTime timestamp;
+
+#ifdef Q_WS_MAEMO_5
+ timestamp = positionInfo.dateTime();
+#else
+ timestamp = positionInfo.timestamp();
+#endif
+
+ if (!timestamp.isValid())
return GPS_ACCURACY_UNDEFINED;
if (positionInfo.hasAttribute(QGeoPositionInfo::HorizontalAccuracy))
*
* @param parent QObject
*/
- GPSPositionPrivate(QObject *parent = 0);
+ GPSPositionPrivate(QObject *parent);
/******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
*/
void stop();
- /**
- * @brief GPS update request.
- */
- void update();
-
private:
/**
* @brief Return horizontal accuracy
* @return accuracy value, -1 if undefined. Returns -1 also is timestamp is not valid
* (when using network positioning)
*/
- qreal accuracy(QGeoPositionInfo positionInfo);
+ qreal accuracy(const QGeoPositionInfo &positionInfo);
private slots:
*
* @param positionInfo Geo position info.
*/
- void positionUpdated(QGeoPositionInfo positionInfo);
+ void positionUpdated(const QGeoPositionInfo &positionInfo);
/**
* @brief Slot for update timeout.
GPSPositionPrivate::GPSPositionPrivate(QObject *parent)
: QObject(parent)
{
- m_parent = static_cast<GPSPosition*>(parent);
}
bool GPSPositionPrivate::isRunning()
qDebug() << __PRETTY_FUNCTION__;
}
-void GPSPositionPrivate::update()
-{
- qDebug() << __PRETTY_FUNCTION__;
-}
-
QPointF GPSPositionPrivate::lastPosition()
{
qDebug() << __PRETTY_FUNCTION__;
*
* @param parent QObject
*/
- GPSPositionPrivate(QObject *parent = 0);
+ GPSPositionPrivate(QObject *parent);
/******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
* DOES NOTHING.
*/
void stop();
-
- /**
- * @brief GPS update request.
- *
- * DOES NOTHING.
- */
- void update();
-
-/*******************************************************************************
- * DATA MEMBERS
- ******************************************************************************/
-private:
- GPSPosition *m_parent; ///< Parent object
};
#endif // GPSPOSITIONMOCKUP_H
DEFINES += QT_NO_DEBUG_OUTPUT
-!maemo5 {
- SOURCES += gps/gpspositionprivatestub.cpp
- HEADERS += gps/gpspositionprivatestub.h
- message(QJson built in)
- message(Make sure you have QJson development headers installed)
- message(install headers with: sudo apt-get install libqjson-dev)
-}
-maemo5 {
+maemo5 | simulator {
SOURCES += gps/gpspositionprivate.cpp
HEADERS += gps/gpspositionprivate.h
QT += maemo5
message(Make sure you have QtMobility development headers installed)
message(install headers with: apt-get install libqtm-dev)
}
+else {
+ SOURCES += gps/gpspositionprivatestub.cpp
+ HEADERS += gps/gpspositionprivatestub.h
+ message(QJson built in)
+ message(Make sure you have QJson development headers installed)
+ message(install headers with: sudo apt-get install libqjson-dev)
+}
# -----------------------------------------------------------------