Removed GPSPosition destructor.
[situare] / src / gps / gpsposition.h
index 890dce5..fdebef7 100644 (file)
 #ifndef GPSPOSITION_H
 #define GPSPOSITION_H
 
-#include <QGeoPositionInfoSource>
+#include <QObject>
 #include <QPointF>
 
-// Use the QtMobility namespace
-QTM_USE_NAMESPACE
+class GPSPositionPrivate;
 
+/**
+* @brief GPSPosition class is an interface for GPS.
+*/
 class GPSPosition : public QObject
 {
     Q_OBJECT
 
 public:
+    /**
+    * @brief Friend class for GPSPosition.
+    */
+    friend class GPSPositionPrivate;
+
+    /**
+    * @brief Constructor.
+    *
+    * @param parent QObject
+    */
     GPSPosition(QObject *parent = 0);
-    ~GPSPosition();
 
+    /**
+    * @brief GPS position mode.
+    */
+    enum Mode {Default, Simulation};
+
+/******************************************************************************
+* MEMBER FUNCTIONS AND SLOTS
+******************************************************************************/
+public:
+    /**
+    * @brief Checks if GPS is running.
+    *
+    * @return true if GPS running, false otherwise
+    */
+    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 setUpdateInterval(int interval);
+
+    /**
+    * @brief Start GPS.
+    */
     void start();
-    void stop();
 
-private slots:
-    void requestUpdate();
-    void positionUpdated(QGeoPositionInfo positionInfo);
-    void updateTimeout();
+    /**
+    * @brief Stop GPS.
+    */
+    void stop();
 
+/******************************************************************************
+* SIGNALS
+******************************************************************************/
 signals:
-    void position(QPointF latLonCoordinate);
+    /**
+    * @brief Signal for error.
+    *
+    * @param message error message
+    */
+    void error(const QString &message);
+
+    /**
+    * @brief Signal for position information.
+    *
+    * @param latLonCoordinate latitude and longitude values
+    * @param accuracy accuracy in metres
+    */
+    void position(QPointF latLonCoordinate, qreal accuracy);
+
+    /**
+    * @brief Signal for timeout.
+    */
+    void timeout();
 
+/*******************************************************************************
+* DATA MEMBERS
+*******************************************************************************/
 private:
-    QGeoPositionInfoSource *m_gpsSource;
+    GPSPositionPrivate *m_gpsPositionPrivate;   ///< GPSPositionPrivate object
 };
 
-#endif // GPSPOSITION_H
+#endif // GPSPOSITIONINTERFACE_H