qtmobility/src/location/qgeopositioninfosource.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    44 #   include "qgeopositioninfosource_s60_p.h"
    44 #   include "qgeopositioninfosource_s60_p.h"
    45 #elif defined(Q_OS_WINCE)
    45 #elif defined(Q_OS_WINCE)
    46 #   include "qgeopositioninfosource_wince_p.h"
    46 #   include "qgeopositioninfosource_wince_p.h"
    47 #elif defined(Q_WS_MAEMO_6)
    47 #elif defined(Q_WS_MAEMO_6)
    48 #   include "qgeopositioninfosource_maemo_p.h"
    48 #   include "qgeopositioninfosource_maemo_p.h"
       
    49 #elif defined(Q_WS_MAEMO_5)
       
    50 #   include "qgeopositioninfosource_maemo5_p.h"
    49 #endif
    51 #endif
    50 
    52 
    51 QTM_BEGIN_NAMESPACE
    53 QTM_BEGIN_NAMESPACE
    52 
    54 
    53 /*!
    55 /*!
    72     For example:
    74     For example:
    73 
    75 
    74     \code
    76     \code
    75         // Emit updates every 10 seconds if available
    77         // Emit updates every 10 seconds if available
    76         QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource();
    78         QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource();
    77         source->setUpdateInterval(10000);
    79         if (source)
       
    80             source->setUpdateInterval(10000);
    78     \endcode
    81     \endcode
    79 
    82 
    80     To remove an update interval that was previously set, call
    83     To remove an update interval that was previously set, call
    81     setUpdateInterval() with a value of 0.
    84     setUpdateInterval() with a value of 0.
    82 
    85 
   134     If the update interval is set, the source will provide updates at an
   137     If the update interval is set, the source will provide updates at an
   135     interval as close to the requested interval as possible. If the requested
   138     interval as close to the requested interval as possible. If the requested
   136     interval is less than the minimumUpdateInterval(),
   139     interval is less than the minimumUpdateInterval(),
   137     the minimum interval is used instead.
   140     the minimum interval is used instead.
   138 
   141 
       
   142     Changes to the update interval will happen as soon as is practical, however the 
       
   143     time the change takes may vary between implementations.  Whether or not the elapsed 
       
   144     time from the previous interval is counted as part of the new interval is also 
       
   145     implementation dependent.
       
   146 
   139     The default value for this property is 0.
   147     The default value for this property is 0.
   140 
   148 
   141     Note: Subclass implementations must call the base implementation of
   149     Note: Subclass implementations must call the base implementation of
   142     setUpdateInterval() so that updateInterval() returns the correct value.
   150     setUpdateInterval() so that updateInterval() returns the correct value.
   143 */
   151 */
   191 QGeoPositionInfoSource *QGeoPositionInfoSource::createDefaultSource(QObject *parent)
   199 QGeoPositionInfoSource *QGeoPositionInfoSource::createDefaultSource(QObject *parent)
   192 {
   200 {
   193 #if defined(Q_OS_SYMBIAN)
   201 #if defined(Q_OS_SYMBIAN)
   194     QGeoPositionInfoSource *ret = NULL;
   202     QGeoPositionInfoSource *ret = NULL;
   195     TRAPD(error, ret = CQGeoPositionInfoSourceS60::NewL(parent));
   203     TRAPD(error, ret = CQGeoPositionInfoSourceS60::NewL(parent));
       
   204     if (error != KErrNone)
       
   205         return 0;
   196     return ret;
   206     return ret;
   197 #elif defined(Q_OS_WINCE)
   207 #elif defined(Q_OS_WINCE)
   198     return new QGeoPositionInfoSourceWinCE(parent);
   208     return new QGeoPositionInfoSourceWinCE(parent);
   199 #elif defined(Q_WS_MAEMO_6)
   209 #elif (defined(Q_WS_MAEMO_6)) || (defined(Q_WS_MAEMO_5))
   200     QGeoPositionInfoSourceMaemo *source = new QGeoPositionInfoSourceMaemo(parent);
   210     QGeoPositionInfoSourceMaemo *source = new QGeoPositionInfoSourceMaemo(parent);
   201 
   211 
   202     int status = source->init();
   212     int status = source->init();
   203     if (status == -1) {
   213     if (status == -1) {
   204         delete source;
   214         delete source;
   206     }
   216     }
   207 
   217 
   208     return source;
   218     return source;
   209 #else
   219 #else
   210     Q_UNUSED(parent);
   220     Q_UNUSED(parent);
       
   221     return 0;
   211 #endif
   222 #endif
   212     return 0;
       
   213 }
   223 }
   214 
   224 
   215 /*!
   225 /*!
   216     \fn QGeoPositionInfo QGeoPositionInfoSource::lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const = 0;
   226     \fn QGeoPositionInfo QGeoPositionInfoSource::lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const = 0;
   217 
   227 
   248 
   258 
   249     If setUpdateInterval() has not been called, the source will emit updates
   259     If setUpdateInterval() has not been called, the source will emit updates
   250     as soon as they become available.
   260     as soon as they become available.
   251 
   261 
   252     An updateTimout() signal will be emitted if this QGeoPositionInfoSource subclass determines
   262     An updateTimout() signal will be emitted if this QGeoPositionInfoSource subclass determines
   253     that it will not be able to provide regular updates.  This could happen if a satelllite fix is
   263     that it will not be able to provide regular updates.  This could happen if a satellite fix is
   254     lost or if a hardware error is detected.  Position updates will recommence if the data becomes
   264     lost or if a hardware error is detected.  Position updates will recommence if the data becomes
   255     available later on.  The updateTimout() signal will not be emitted again until after the
   265     available later on.  The updateTimout() signal will not be emitted again until after the
   256     periodic updates resume.
   266     periodic updates resume.
   257 */
   267 */
   258 
   268