src/location/qgeosatelliteinfosource.cpp
changeset 0 876b1a06bc25
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 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 #include <qgeosatelliteinfosource.h>
       
    42 
       
    43 #if defined(Q_OS_SYMBIAN)
       
    44 #   include "qgeosatelliteinfosource_s60_p.h"
       
    45 #elif defined(Q_OS_WINCE)
       
    46 #   include "qgeosatelliteinfosource_wince_p.h"
       
    47 #elif defined(Q_WS_MAEMO_6)
       
    48 #   include "qgeosatelliteinfosource_maemo_p.h"
       
    49 #elif defined(Q_WS_MAEMO_5)
       
    50 #   include "qgeosatelliteinfosource_maemo5_p.h"
       
    51 #endif
       
    52 
       
    53 QTM_BEGIN_NAMESPACE
       
    54 
       
    55 /*!
       
    56     \class QGeoSatelliteInfoSource
       
    57     \brief The QGeoSatelliteInfoSource class is an abstract base class for the distribution of satellite information updates.
       
    58     \ingroup location
       
    59 
       
    60     The static function QGeoSatelliteInfoSource::createDefaultSource() creates a default
       
    61     satellite data source that is appropriate for the platform, if one is
       
    62     available. Otherwise, QGeoSatelliteInfoSource can be subclassed to create an
       
    63     appropriate custom source of satellite data.
       
    64 
       
    65     Call startUpdates() and stopUpdates() to start and stop regular updates,
       
    66     or requestUpdate() to request a single update.
       
    67     When an update is available, satellitesInViewUpdated() and/or
       
    68     satellitesInUseUpdated() will be emitted.
       
    69 
       
    70     \warning On Windows CE it is not possible to detect if a device is GPS enabled.
       
    71     The default satellite source on a Windows CE device without GPS support will never provide any satellite data.
       
    72 */
       
    73 
       
    74 /*!
       
    75     Creates a source with the specified \a parent.
       
    76 */
       
    77 QGeoSatelliteInfoSource::QGeoSatelliteInfoSource(QObject *parent)
       
    78         : QObject(parent)
       
    79 {
       
    80 }
       
    81 
       
    82 /*!
       
    83     Creates and returns a source with the specified \a parent that reads
       
    84     from the system's default source of satellite update information.
       
    85 
       
    86     Returns 0 if the system has no default source.
       
    87 */
       
    88 QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *parent)
       
    89 {
       
    90 #if defined(Q_OS_SYMBIAN)
       
    91     CQGeoSatelliteInfoSourceS60 *ret = NULL;
       
    92     TRAPD(error, ret = CQGeoSatelliteInfoSourceS60::NewL(parent));
       
    93     if (error != KErrNone)
       
    94         return 0;
       
    95     return ret;
       
    96 #elif defined(Q_OS_WINCE)
       
    97     return new QGeoSatelliteInfoSourceWinCE(parent);
       
    98 #elif (defined(Q_WS_MAEMO_6)) || (defined(Q_WS_MAEMO_5))
       
    99     QGeoSatelliteInfoSourceMaemo *source = new QGeoSatelliteInfoSourceMaemo(parent);
       
   100     int status = source->init();
       
   101 
       
   102     if (status == -1) {
       
   103         delete source;
       
   104         return 0;
       
   105     }
       
   106 
       
   107     return source;
       
   108 #else
       
   109     Q_UNUSED(parent);
       
   110     return 0;
       
   111 #endif
       
   112 }
       
   113 
       
   114 /*!
       
   115     \fn void QGeoSatelliteInfoSource::satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &satellites);
       
   116 
       
   117     If startUpdates() or requestUpdate() is called, this signal is emitted
       
   118     when an update is available on the satellites that are
       
   119     currently in view.
       
   120 
       
   121     The \a satellites parameter holds the satellites currently in view.
       
   122 */
       
   123 
       
   124 /*!
       
   125     \fn void QGeoSatelliteInfoSource::satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellites);
       
   126 
       
   127     If startUpdates() or requestUpdate() is called, this signal is emitted
       
   128     when an update is available on the number of satellites that are
       
   129     currently in use.
       
   130 
       
   131     These are the satellites that are used to get a "fix" - that
       
   132     is, those used to determine the current position.
       
   133 
       
   134     The \a satellites parameter holds the satellites currently in use.
       
   135 */
       
   136 
       
   137 /*!
       
   138     \fn virtual void QGeoSatelliteInfoSource::startUpdates() = 0;
       
   139 
       
   140     Starts emitting updates at regular intervals. The updates will be
       
   141     provided whenever new satellite information becomes available.
       
   142 
       
   143     \sa satellitesInViewUpdated(), satellitesInUseUpdated()
       
   144 */
       
   145 
       
   146 /*!
       
   147     \fn virtual void QGeoSatelliteInfoSource::stopUpdates() = 0;
       
   148 
       
   149     Stops emitting updates at regular intervals.
       
   150 */
       
   151 
       
   152 /*!
       
   153     \fn virtual void QGeoSatelliteInfoSource::requestUpdate(int timeout = 0);
       
   154 
       
   155     Attempts to get the current satellite information and emit
       
   156     satellitesInViewUpdated() and satellitesInUseUpdated() with this
       
   157     information. If the current position cannot be found
       
   158     within the given \a timeout (in milliseconds), requestTimeout() is
       
   159     emitted.
       
   160 
       
   161     If the timeout is zero, the timeout defaults to a reasonable timeout
       
   162     period as appropriate for the source.
       
   163 
       
   164     This does nothing if another update request is in progress. However
       
   165     it can be called even if startUpdates() has already been called and
       
   166     regular updates are in progress.
       
   167 */
       
   168 
       
   169 /*!
       
   170     \fn void QGeoSatelliteInfoSource::requestTimeout();
       
   171 
       
   172     Emitted if requestUpdate() was called and the current satellite
       
   173     information could not be retrieved within the specified timeout.
       
   174 */
       
   175 
       
   176 #include "moc_qgeosatelliteinfosource.cpp"
       
   177 
       
   178 QTM_END_NAMESPACE