First draft of new error procedure
[situare] / src / gps / gpsposition.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5        Jussi Laitinen - jussi.laitinen@ixonos.com
6
7    Situare is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License
9    version 2 as published by the Free Software Foundation.
10
11    Situare is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with Situare; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19    USA.
20 */
21
22 #ifndef GPSPOSITION_H
23 #define GPSPOSITION_H
24
25 #include <QObject>
26 #include <QPointF>
27
28 class GPSPositionPrivate;
29
30 /**
31 * @brief GPSPosition class is an interface for GPS.
32 */
33 class GPSPosition : public QObject
34 {
35     Q_OBJECT
36
37 public:
38     /**
39     * @brief Friend class for GPSPosition.
40     */
41     friend class GPSPositionPrivate;
42
43     /**
44     * @brief Constructor.
45     *
46     * @param parent QObject
47     */
48     GPSPosition(QObject *parent = 0);
49
50     /**
51     * @brief GPS position mode.
52     */
53     enum Mode {Default, Simulation};
54
55 /******************************************************************************
56 * MEMBER FUNCTIONS AND SLOTS
57 ******************************************************************************/
58 public:
59     /**
60     * @brief Checks if GPS is running.
61     *
62     * @return true if GPS running, false otherwise
63     */
64     bool isRunning();
65
66     /**
67     * @brief Return last known position.
68     */
69     QPointF lastPosition();
70
71     /**
72     * @brief Informs gps to emit last known position.
73     */
74     void requestLastPosition();
75
76     /**
77     * @brief Set GPS mode.
78     *
79     * Modes: default and simulation.
80     * @param mode GPS mode
81     * @param filePath file path to NMEA file if simulation mode is used
82     */
83     void setMode(Mode mode, const QString &filePath = 0);
84
85     /**
86     * @brief Set GPS update interval
87     *
88     * @return interval interval in milliseconds
89     */
90     void setUpdateInterval(int interval);
91
92     /**
93     * @brief Start GPS.
94     */
95     void start();
96
97     /**
98     * @brief Stop GPS.
99     */
100     void stop();
101
102 /******************************************************************************
103 * SIGNALS
104 ******************************************************************************/
105 signals:
106     /**
107     * @brief Signal for error.
108     *
109     * @param message error code
110     */
111     void error(const int error);
112
113     /**
114     * @brief Signal for position information.
115     *
116     * @param latLonCoordinate latitude and longitude values
117     * @param accuracy accuracy in metres
118     */
119     void position(QPointF latLonCoordinate, qreal accuracy);
120
121     /**
122     * @brief Signal for timeout.
123     */
124     void timeout();
125
126 /*******************************************************************************
127 * DATA MEMBERS
128 *******************************************************************************/
129 private:
130     GPSPositionPrivate *m_gpsPositionPrivate;   ///< GPSPositionPrivate object
131 };
132
133 #endif // GPSPOSITIONINTERFACE_H