#ifndef GPSPOSITION_H
#define GPSPOSITION_H
-#include <QGeoPositionInfoSource>
+#include <QObject>
#include <QPointF>
-#include "gpspositioninterface.h"
-
-QTM_USE_NAMESPACE
+class GPSPositionPrivate;
/**
-* @brief GPSPosition class use GPS to receive location information.
-*
-* @class GPSPosition engine.h "gps/gpsposition.h"
+* @brief GPSPosition class is an interface for GPS.
*/
-class GPSPosition : public GPSPositionInterface
+class GPSPosition : public QObject
{
Q_OBJECT
public:
/**
- * @brief Constructor creates GPS source.
+ * @brief Friend class for GPSPosition.
+ */
+ friend class GPSPositionPrivate;
+
+ /**
+ * @brief Constructor.
*
* @param parent QObject
*/
GPSPosition(QObject *parent = 0);
/**
- * @brief Destructor stops GPS.
+ * @brief GPS position mode.
*/
- ~GPSPosition();
+ enum Mode {Default, Simulation};
/******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
bool isRunning();
/**
+ * @brief Return last known position.
+ */
+ QPointF lastPosition();
+
+ /**
+ * @brief Informs gps to emit last known position.
+ */
+ void requestLastPosition();
+
+ /**
+ * @brief Set GPS mode.
+ *
+ * Modes: default and simulation.
+ * @param mode GPS mode
+ * @param filePath file path to NMEA file if simulation mode is used
+ */
+ void setMode(Mode mode, const QString &filePath = 0);
+
+ /**
* @brief Set GPS update interval
*
* @return interval interval in milliseconds
*/
void stop();
-private slots:
-
+/******************************************************************************
+* SIGNALS
+******************************************************************************/
+signals:
/**
- * @brief Slot for received position update.
+ * @brief Signal for error.
*
- * @param positionInfo Geo position info.
+ * @param message error message
*/
- void positionUpdated(QGeoPositionInfo positionInfo);
+ void error(const QString &message);
/**
- * @brief Slot for GPS update request.
+ * @brief Signal for position information.
+ *
+ * @param latLonCoordinate latitude and longitude values
+ * @param accuracy accuracy in metres
*/
- void update();
+ void position(QPointF latLonCoordinate, qreal accuracy);
/**
- * @brief Slot for update timeout.
- *
- * Called when request timeout occurs.
+ * @brief Signal for timeout.
*/
- void updateTimeout();
+ void timeout();
+/*******************************************************************************
+* DATA MEMBERS
+*******************************************************************************/
private:
- QGeoPositionInfoSource *m_gpsSource; ///< GPS position info source
- bool m_running; ///< GPS is running
- int m_updateInterval; ///< GPS update interval
+ GPSPositionPrivate *m_gpsPositionPrivate; ///< GPSPositionPrivate object
};
-const int DEFAULT_UPDATE_INTERVAL = 5000; ///< Default update interval
-
-#endif // GPSPOSITION_H
+#endif // GPSPOSITIONINTERFACE_H