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 GPSPOSITIONPRIVATE_H 00023 #define GPSPOSITIONPRIVATE_H 00024 00025 #include <QGeoPositionInfo> 00026 #include <QGeoPositionInfoSource> 00027 #include <QNmeaPositionInfoSource> 00028 00029 #include "gpsposition.h" 00030 00031 class GeoCoordinate; 00032 00033 QTM_USE_NAMESPACE 00034 00038 class GPSPositionPrivate : public QObject 00039 { 00040 Q_OBJECT 00041 00042 public: 00048 GPSPositionPrivate(QObject *parent); 00049 00050 /****************************************************************************** 00051 * MEMBER FUNCTIONS AND SLOTS 00052 ******************************************************************************/ 00053 public: 00059 bool isInitialized() const; 00060 00066 bool isRunning() const; 00067 00071 GeoCoordinate lastPosition() const; 00072 00076 void requestLastPosition(); 00077 00083 void requestUpdate(); 00084 00092 void setMode(GPSPosition::Mode mode, const QString &filePath = 0); 00093 00099 void setPowerSave(bool enabled); 00100 00106 void setUpdateInterval(int interval); 00107 00111 void start(); 00112 00116 void stop(); 00117 00118 private: 00126 qreal accuracy(const QGeoPositionInfo &positionInfo); 00127 00128 private slots: 00129 00135 void positionUpdated(const QGeoPositionInfo &positionInfo); 00136 00142 void updateTimeout(); 00143 00144 /******************************************************************************* 00145 * DATA MEMBERS 00146 ******************************************************************************/ 00147 private: 00148 QGeoPositionInfoSource *m_gpsSource; 00149 GPSPosition *m_parent; 00150 bool m_initialized; 00151 bool m_running; 00152 int m_updateInterval; 00153 }; 00154 00155 const int DEFAULT_UPDATE_INTERVAL = 5000; 00156 00157 #endif // GPSPOSITIONPRIVATE_H