Hi there.

We have a few use-cases where we change the location method from GPS
to CellId and vice-versa but it's not clear to me what's the best way
to implement them using the Mobility API. We basically want to
fallback to CellId location whenever the GPS is unavailable or being
fixed.

>From my understanding, the way to handle this would be:

Create two QGeoPositionInfoSources using ::createDefaultSource(), call
::setPreferredPositioningMethods() with different positioning methods
on each and keep control of when the GPS is fixed or not by monitoring
the positionUpdated() signal, as below:

For the GPS location:

gpsSource = QGeoPositionInfoSources::createDefaultSource();
if (gpsSource->supportedPositioningMethods() ...
   ...make sure the GPS is enabled before proceeding;
gpsSource->setPreferredPositioningMethods(QGeoPositionInfoSource::SatellitePositioningMethods);
gpsSource->setUpdateInterval(5000);
gpsSource->startUpdates();

- Should I assume that if positionUpdated() is emmited we got a GPS fix?
- The doc on updateTimeout() says it's emmited when "[...] it will not
be able to provide further regular updates. This signal will not be
emitted again until after the regular updates resume." IIRC, the GPS
keep trying a fix forever and this signal is never be emmited... Do I
have to keep a timer myself and call stopUpdates() to make it give up
after some time?

For the CellId location:

cellIdSource = QGeoPositionInfoSources::createDefaultSource();
if (gpsSource->supportedPositioningMethods()...
   ... make sure the device supports nonSatellite methods before proceeding
cellIdSource->setPreferredPositioningMethods(QGeoPositionInfoSource::NonSatellitePositioningMethods);
cellIdSource->setUpdateInterval(5000);
cellIdSource->startUpdates();

On my tests I only get one positionUpdated() instead of regular
updates every X seconds when using NonSatellitePositioningMethods.
Shouldn't I get updates at regular intervals, even if the variables
don't change?


So, is this the correct approach to handle GPS+CellId, or is there a
better way? Was the mobility API designed to be used this way, calling
createDefaultSource() more than once?

Thanks,
   - Ademar

-- 
Ademar de Souza Reis Jr. <[email protected]>
OpenBossa Labs - Instituto Nokia de Tecnologia
_______________________________________________
Qt-mobility-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-mobility-feedback

Reply via email to