qtmobility/src/location/qgeopositioninfosource.h
changeset 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
0:cfcbf08528c4 1:2b40d63a9c3d
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 #ifndef QGEOPOSITIONINFOSOURCE_H
       
    42 #define QGEOPOSITIONINFOSOURCE_H
       
    43 
       
    44 #include "qmobilityglobal.h"
       
    45 #include "qgeopositioninfo.h"
       
    46 
       
    47 #include <QObject>
       
    48 
       
    49 QT_BEGIN_HEADER
       
    50 
       
    51 QTM_BEGIN_NAMESPACE
       
    52 
       
    53 class QGeoPositionInfoSourcePrivate;
       
    54 class Q_LOCATION_EXPORT QGeoPositionInfoSource : public QObject
       
    55 {
       
    56     Q_OBJECT
       
    57     Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval)
       
    58     Q_PROPERTY(int minimumUpdateInterval READ minimumUpdateInterval)
       
    59 
       
    60 public:
       
    61     enum PositioningMethod {
       
    62         SatellitePositioningMethods = 0x000000ff,
       
    63         NonSatellitePositioningMethods = 0xffffff00,
       
    64         AllPositioningMethods = 0xffffffff
       
    65     };
       
    66     Q_DECLARE_FLAGS(PositioningMethods, PositioningMethod)
       
    67 
       
    68     explicit QGeoPositionInfoSource(QObject *parent);
       
    69     virtual ~QGeoPositionInfoSource();
       
    70 
       
    71     virtual void setUpdateInterval(int msec);
       
    72     int updateInterval() const;
       
    73 
       
    74     virtual void setPreferredPositioningMethods(PositioningMethods methods);
       
    75     PositioningMethods preferredPositioningMethods() const;
       
    76 
       
    77     virtual QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const = 0;
       
    78 
       
    79     virtual PositioningMethods supportedPositioningMethods() const = 0;
       
    80     virtual int minimumUpdateInterval() const = 0;
       
    81 
       
    82     static QGeoPositionInfoSource *createDefaultSource(QObject *parent);
       
    83 
       
    84 public Q_SLOTS:
       
    85     virtual void startUpdates() = 0;
       
    86     virtual void stopUpdates() = 0;
       
    87 
       
    88     virtual void requestUpdate(int timeout = 0) = 0;
       
    89 
       
    90 Q_SIGNALS:
       
    91     void positionUpdated(const QGeoPositionInfo &update);
       
    92     void updateTimeout();
       
    93 
       
    94 private:
       
    95     Q_DISABLE_COPY(QGeoPositionInfoSource)
       
    96     QGeoPositionInfoSourcePrivate *d;
       
    97 };
       
    98 
       
    99 Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoPositionInfoSource::PositioningMethods)
       
   100 
       
   101 QTM_END_NAMESPACE
       
   102 
       
   103 QT_END_HEADER
       
   104 
       
   105 #endif