2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
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.
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.
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,
25 #include <QGeoPositionInfo>
26 #include <QGeoPositionInfoSource>
27 #include <QNmeaPositionInfoSource>
30 #include "gpspositioninterface.h"
35 * @brief GPSPosition class use GPS to receive location information.
37 * @class GPSPosition gpsposition.h "gps/gpsposition.h"
39 class GPSPosition : public GPSPositionInterface
45 * @brief Constructor creates GPS source.
47 * @param parent QObject
49 GPSPosition(QObject *parent = 0);
52 * @brief Destructor stops GPS.
56 /******************************************************************************
57 * MEMBER FUNCTIONS AND SLOTS
58 ******************************************************************************/
61 * @brief Checks if GPS is running.
63 * @return true if GPS running, false otherwise
68 * @brief Return last known position.
70 QPointF lastPosition();
73 * @brief Informs gps to emit last known position.
75 void requestLastPosition();
78 * @brief Set GPS mode.
80 * Modes: default and simulation.
81 * @param mode GPS mode
82 * @param filePath file path to NMEA file if simulation mode is used
84 void setMode(Mode mode, const QString &filePath = 0);
87 * @brief Set GPS update interval
89 * @return interval interval in milliseconds
91 void setUpdateInterval(int interval);
105 * @brief Return bigger accuracy value from latitude and longitude values.
107 * @param positionInfo geo position info
108 * @return bigger accuracy value, -1 if undefined
110 qreal biggerAccuracy(QGeoPositionInfo positionInfo);
115 * @brief Slot for received position update.
117 * @param positionInfo Geo position info.
119 void positionUpdated(QGeoPositionInfo positionInfo);
122 * @brief Slot for GPS update request.
127 * @brief Slot for update timeout.
129 * Called when request timeout occurs.
131 void updateTimeout();
134 QGeoPositionInfoSource *m_gpsSource; ///< GPS position info source
135 bool m_running; ///< GPS is running
136 int m_updateInterval; ///< GPS update interval
139 const int ACCURACY_UNDEFINED = -1; ///< Undefined accuracy
140 const int DEFAULT_UPDATE_INTERVAL = 5000; ///< Default update interval
142 #endif // GPSPOSITION_H