00001 /* 00002 Situare - A location system for Facebook 00003 Copyright (C) 2010 Ixonos Plc. Authors: 00004 00005 Jussi Laitinen - jussi.laitinen@ixonos.com 00006 00007 Situare is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 version 2 as published by the Free Software Foundation. 00010 00011 Situare is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with Situare; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00019 USA. 00020 */ 00021 00022 #ifndef GPSPOSITIONPRIVATELIBLOCATION_H 00023 #define GPSPOSITIONPRIVATELIBLOCATION_H 00024 00025 #include "gpsposition.h" 00026 #include "geopositioninfo.h" 00027 00028 class QTimer; 00029 00030 class LiblocationWrapper; 00031 class GeoCoordinate; 00032 00036 class GPSPositionPrivate : public QObject 00037 { 00038 Q_OBJECT 00039 00040 public: 00046 GPSPositionPrivate(QObject *parent); 00047 00048 /****************************************************************************** 00049 * MEMBER FUNCTIONS AND SLOTS 00050 ******************************************************************************/ 00051 public: 00057 bool isInitialized() const; 00058 00064 bool isRunning() const; 00065 00069 GeoCoordinate lastPosition() const; 00070 00074 void requestLastPosition(); 00075 00081 void requestUpdate(); 00082 00090 void setMode(GPSPosition::Mode mode, const QString &filePath = 0); 00091 00097 void setPowerSave(bool enabled); 00098 00104 void setUpdateInterval(int interval); 00105 00109 void start(); 00110 00114 void stop(); 00115 00116 private: 00124 qreal accuracy(const GeoPositionInfo &positionInfo); 00125 00126 private slots: 00130 void delayedPowerSaveStart(); 00131 00137 void positionUpdated(const GeoPositionInfo &positionInfo); 00138 00144 void locationError(const QString &errorMessage); 00145 00146 /******************************************************************************* 00147 * DATA MEMBERS 00148 ******************************************************************************/ 00149 private: 00150 LiblocationWrapper *m_liblocationWrapper; 00151 GPSPosition *m_parent; 00152 bool m_initialized; 00153 bool m_powerSave; 00154 bool m_running; 00155 int m_updateInterval; 00156 QTimer *m_delayedPowerSaveTimer; 00157 }; 00158 00159 const int DEFAULT_UPDATE_INTERVAL = 5000; 00160 00161 #endif // GPSPOSITIONPRIVATELIBLOCATION_H