Hi Ademar,

I think you can do what you want to with a single call to createDefaultSource().

I think that 
  setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods);
will do what you want.

If you call requestUpdate(5000) and get a non-satellite update 2 seconds later, 
the backend should wait for satellite data until the 5 seconds is up.  If there 
was no satellite data in that time then the non-satellite data will be used.  

We're trying to allow users to give a hint about accuracy, battery usage and 
fix speed without getting in the way of the implementers ability to do the best 
that they can with what they have available to them.  

> - Should I assume that if positionUpdated() is emmited we got a GPS
> fix?

Yes - if you're using SatellitePositioningMethods and positionUpdated is 
emitted it should mean you have gotten a 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?

You can do that.  Normally you could make the updateTimeout() trigger a dialog 
that lets the user know the fix has been lost and give them the option to quit 
on their own -   that gets a little more complicated if you're using two 
sources. 

> Shouldn't I get updates at regular intervals, even if the variables
> don't change?

Yes, you should.  Did you get an updateTimeout() signal at all?  If you got one 
positionUpdated() signal and no updateTimeout() signals then it sounds like a 
bug in the backend - what platform are you working with?

Cheers,

Dave

> -----Original Message-----
> From: [email protected] [mailto:qt-mobility-
> [email protected]] On Behalf Of ext Ademar Reis
> Sent: Wednesday, 30 June 2010 7:35 AM
> To: [email protected]
> Subject: [Qt-mobility-feedback] GPS and CellID location
> 
> 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::SatellitePositi
> oningMethods);
> 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::NonSatellitePos
> itioningMethods);
> 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

_______________________________________________
Qt-mobility-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-mobility-feedback

Reply via email to