| 1 |
/* |
| 2 |
* Copyright 2013 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser General Public License as published by |
| 6 |
* the Free Software Foundation; version 3. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
* |
| 16 |
* Author: Thomas Voß <[email protected]> |
| 17 |
* Marius Gripsgard <[email protected]> |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef CORE_GEO_POSITION_INFO_SOURCE_H |
| 21 |
#define CORE_GEO_POSITION_INFO_SOURCE_H |
| 22 |
|
| 23 |
#include <qgeopositioninfosource.h> |
| 24 |
|
| 25 |
namespace core |
| 26 |
{ |
| 27 |
class GeoPositionInfoSource : public QGeoPositionInfoSource |
| 28 |
{ |
| 29 |
Q_OBJECT |
| 30 |
public: |
| 31 |
GeoPositionInfoSource(QObject *parent = 0); |
| 32 |
~GeoPositionInfoSource(); |
| 33 |
|
| 34 |
// From QGeoPositionInfoSource |
| 35 |
void setUpdateInterval(int msec); |
| 36 |
QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const; |
| 37 |
PositioningMethods supportedPositioningMethods() const; |
| 38 |
void setPreferredPositioningMethods(PositioningMethods methods); |
| 39 |
int minimumUpdateInterval() const; |
| 40 |
Error error() const; |
| 41 |
|
| 42 |
// Updates request state |
| 43 |
enum State { |
| 44 |
stopped = 0, |
| 45 |
running, |
| 46 |
one_shot, |
| 47 |
suspended, |
| 48 |
}; |
| 49 |
|
| 50 |
public Q_SLOTS: |
| 51 |
void applicationStateChanged(); |
| 52 |
virtual void startUpdates(); |
| 53 |
virtual void stopUpdates(); |
| 54 |
virtual void requestUpdate(int timeout = 5000); |
| 55 |
void timeout(); |
| 56 |
|
| 57 |
private: |
| 58 |
bool m_applicationActive; |
| 59 |
int m_lastReqTimeout; |
| 60 |
int m_state; |
| 61 |
struct Private; |
| 62 |
QScopedPointer<Private> d; |
| 63 |
}; |
| 64 |
} |
| 65 |
|
| 66 |
#endif // CORE_GEO_POSITION_INFO_SOURCE_H |