X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=liblocationmaemo5%2Fliblocationwrapper_p.h;fp=liblocationmaemo5%2Fliblocationwrapper_p.h;h=287ff5d5eb58a5288c50c4a5e2741c3a1fe43cbd;hb=2aa05505684373ac4aeff3547adf16c17ba9934f;hp=0000000000000000000000000000000000000000;hpb=d61a299b8bfaa74e8c2680923a3efbbcf2ab8347;p=googlelatitude diff --git a/liblocationmaemo5/liblocationwrapper_p.h b/liblocationmaemo5/liblocationwrapper_p.h new file mode 100644 index 0000000..287ff5d --- /dev/null +++ b/liblocationmaemo5/liblocationwrapper_p.h @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LIBLOCATIONWRAPPER_H +#define LIBLOCATINWRAPPER_H + +// INCLUDES +#include +#include + +#include "qgeocoordinate.h" +#include "qgeopositioninfo.h" +#include "qgeosatelliteinfo.h" + +#include "gconfitem_p.h" + +extern "C" { + #include + #include + #include + #include + #include +} + +QTM_BEGIN_NAMESPACE + +class LiblocationWrapper : public QObject +{ + Q_OBJECT + +public: + static LiblocationWrapper *instance(); + LiblocationWrapper(); + ~LiblocationWrapper(); + + void start(); + void stop(); + QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const; + bool inited(); + bool isActive(); + QList satellitesInView(); + QList satellitesInUse(); + +private: + QFile *file; + LocationGPSDControl *locationControl; + LocationGPSDevice *locationDevice; + + static void locationError(LocationGPSDevice *device, gint code, gpointer data); + static void locationChanged(LocationGPSDevice *device, gpointer data); + + int errorHandlerId; + int posChangedId; + int origUpdateInterval; + int startcounter; + QGeoPositionInfo lastUpdate; + QGeoPositionInfo lastSatUpdate; + bool validLastUpdate; + bool validLastSatUpdate; + bool fromSatellite; + + void satellitesInViewUpdated(const QList &satellites); + void satellitesInUseUpdated(const QList &satellites); + QList satsInView; + QList satsInUse; + + enum LocationState { + Undefined = 0, + Inited = 1, + Started = 2, + Stopped = 4, + RequestActive = 8, + RequestSingleShot = 16 + }; + int locationState; + +signals: + void positionUpdated(const QGeoPositionInfo &position); + void error(); +}; + +QTM_END_NAMESPACE +#endif // LIBLOCATIONWRAPPER_H