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,
22 #ifndef GPSPOSITIONPRIVATELIBLOCATION_H
23 #define GPSPOSITIONPRIVATELIBLOCATION_H
27 #include "gpsposition.h"
28 #include "geopositioninfo.h"
31 class LiblocationWrapper;
34 * @brief GPSPositionPrivate class use GPS to receive location information.
36 class GPSPositionPrivate : public QObject
42 * @brief Constructor creates GPS source.
44 * @param parent QObject
46 GPSPositionPrivate(QObject *parent);
48 /******************************************************************************
49 * MEMBER FUNCTIONS AND SLOTS
50 ******************************************************************************/
53 * @brief Enables power save mode.
55 * Starts GPS for position update and then stops it.
57 void enablePowerSave(bool enabled);
60 * @brief Returns is GPS initialized.
62 * @return true if initialized, false otherwise
67 * @brief Checks if GPS is running.
69 * @return true if GPS running, false otherwise
74 * @brief Return last known position.
76 QPointF lastPosition();
79 * @brief Informs gps to emit last known position.
81 void requestLastPosition();
84 * @brief Requests update from GPS.
86 * Enables GPS if it is disabled
91 * @brief Set GPS mode.
93 * Modes: default and simulation.
94 * @param mode GPS mode
95 * @param filePath file path to NMEA file if simulation mode is used
97 void setMode(GPSPosition::Mode mode, const QString &filePath = 0);
100 * @brief Set GPS update interval
102 * @return interval interval in milliseconds
104 void setUpdateInterval(int interval);
118 * @brief Returns horizontal accuracy.
120 * @param positionInfo geo position info
121 * @return accuracy value, -1 if undefined. Returns -1 also is timestamp is not valid
122 * (when using network positioning)
124 qreal accuracy(const GeoPositionInfo &positionInfo);
127 void delayedPowerSaveStart();
130 * @brief Slot for received position update.
132 * @param positionInfo Geo position info.
134 void positionUpdated(const GeoPositionInfo &positionInfo);
137 * @brief Slot for location error.
139 * Called when there is error in GPS.
141 void locationError(const QString &errorMessage);
143 /*******************************************************************************
145 ******************************************************************************/
147 LiblocationWrapper *m_liblocationWrapper; ///< Liblocation wrapper object
148 GPSPosition *m_parent; ///< Parent object
149 bool m_initialized; ///< GPS is initialized
150 bool m_powerSave; ///< Power save flag
151 bool m_running; ///< GPS is running
152 int m_updateInterval; ///< GPS update interval
153 QTimer *m_delayedPowerSaveTimer; ///< Delayed power save timer
156 const int DEFAULT_UPDATE_INTERVAL = 5000; ///< Default update interval
158 #endif // GPSPOSITIONPRIVATELIBLOCATION_H