Removed GPSPosition destructor.
[situare] / src / gps / gpsposition.h
index af614ce..fdebef7 100644 (file)
 #ifndef GPSPOSITION_H
 #define GPSPOSITION_H
 
-#include <QGeoPositionInfo>
-#include <QGeoPositionInfoSource>
-#include <QNmeaPositionInfoSource>
+#include <QObject>
 #include <QPointF>
 
-#include "gpspositioninterface.h"
-
-QTM_USE_NAMESPACE
+class GPSPositionPrivate;
 
 /**
-* @brief GPSPosition class use GPS to receive location information.
-*
-* @class GPSPosition gpsposition.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
@@ -100,43 +99,35 @@ public:
     */
     void stop();
 
-private:
+/******************************************************************************
+* SIGNALS
+******************************************************************************/
+signals:
     /**
-    * @brief Return bigger accuracy value from latitude and longitude values.
+    * @brief Signal for error.
     *
-    * @param positionInfo geo position info
-    * @return bigger accuracy value, -1 if undefined
+    * @param message error message
     */
-    qreal biggerAccuracy(QGeoPositionInfo positionInfo);
-
-private slots:
+    void error(const QString &message);
 
     /**
-    * @brief Slot for received position update.
+    * @brief Signal for position information.
     *
-    * @param positionInfo Geo position info.
-    */
-    void positionUpdated(QGeoPositionInfo positionInfo);
-
-    /**
-    * @brief Slot for GPS update request.
+    * @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 ACCURACY_UNDEFINED = -1;               ///< Undefined accuracy
-const int DEFAULT_UPDATE_INTERVAL = 5000;       ///< Default update interval
-
-#endif // GPSPOSITION_H
+#endif // GPSPOSITIONINTERFACE_H