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 LIBLOCATIONWRAPPER_H
23 #define LIBLOCATIONWRAPPER_H
26 #include "geopositioninfo.h"
30 #include <location/location-gps-device.h>
31 #include <location/location-gpsd-control.h>
35 * @brief LiblocationWrapper class is a wrapper for liblocation library.
37 class LiblocationWrapper : public QObject
45 LiblocationWrapper(QObject *parent);
50 * Releases m_control and m_device objects.
52 ~LiblocationWrapper();
57 enum State {Undefined, Initialized, Running};
59 /******************************************************************************
60 * MEMBER FUNCTIONS AND SLOTS
61 ******************************************************************************/
63 * @brief Checks if GPS is running.
65 * @return true if running, false otherwise
70 * @brief Returns last known position.
72 * @return GeoPositionInfo
74 GeoPositionInfo lastKnownPosition() const;
77 * @brief Starts GPS updates.
82 * @brief Sets last known position.
84 * @param positionInfo GeoPositionInfo
86 void setLastKnownPosition(const GeoPositionInfo &positionInfo);
89 * @brief Initializes GPS with update interval.
91 * @param updateInterval update interval in milliseconds
93 void init(int updateInterval);
96 * @brief Stops GPS updates.
102 * @brief Called from liblocation when GPS location changes.
104 * @param device LocationGPSDevice
105 * @param data qpointer
107 static void changed(LocationGPSDevice *device, gpointer data);
110 * @brief Called from liblocation when there is an error on GPS.
112 * @param device LocationGPSDevice
113 * @param data qpointer
115 static void error(LocationGPSDevice *device, gpointer data);
122 void setState(int state);
131 /******************************************************************************
133 ******************************************************************************/
136 * @brief Signal for location change.
138 * @param positionInfo GeoPositionInfo
140 void locationChanged(const GeoPositionInfo &positionInfo);
143 * @brief Signal for error.
145 * @param message error message
147 void errorMessage(const QString &message);
150 /******************************************************************************
152 ******************************************************************************/
154 LocationGPSDControl *m_control; ///< LocationGPSDControl pointer
155 LocationGPSDevice *m_device; ///< LocationGPSDevice pointer
156 GeoPositionInfo m_lastKnownPosition; ///< GeoPositionInfo data
157 int m_state; ///< GPS state
160 #endif // LIBLOCATIONWRAPPER_H