×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    7

    Issue with QGeoPositionInfoSource

    I have a problem using QGeoPositionInfoSource (or I'm not understanding something correctly).

    I'm using it as follows:

    QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this);
    connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
    this, SLOT(positionUpdated(QGeoPositionInfo)));
    source->setUpdateInterval(3000);
    source->startUpdates();

    If I have more than a single possible sources activated in my phone settings (i.e. A-PGS, Intergrated GPS, Network-based, Wifi based), the above code will always default to GPS I think. So if I'm indoors, positionUpdated() never gets called.

    I'd expect it to fall back to other options (e.g. network-based) after a period of time if it can't use the GPS?
    Is that not correct?

    It works fine using network -based geolocation as long as I disable the other sources on my phone.

    If I've got this wrong and in fact this is not the default behaviour, how do I achieve what I'm trying to achieve (i.e. getting it to use whatever source works)?

  2. #2
    Nokia Developer Expert
    Join Date
    Dec 2009
    Posts
    81

    Re: Issue with QGeoPositionInfoSource

    Does source->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods) help?

    At the moment we're not specifying the default value for preferredPositioningMethods() so that implementers have some scope to set it to something that seems sensible based on the circumstances and the user settings.

    Since you're on a platform with both satellite and non-satellite sources, AllPositioningMethods should help as long as you have at least one of each of the methods enabled in user settings. If it doesn't, please file a bug and I'll ask the backend team to take a look at it.

  3. #3
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Issue with QGeoPositionInfoSource

    There is example in wiki, which seems to work fine on my N900
    http://wiki.forum.nokia.com/index.ph...t_Mobility_API

  4. #4
    Registered User
    Join Date
    Jun 2010
    Location
    Bangalore,India
    Posts
    21

    Re: Issue with QGeoPositionInfoSource

    will QGeoPositionInfoSource::CreateDefaultSource() method work for all devices like bluetooth GPS ??

  5. #5
    Nokia Developer Expert
    Join Date
    Dec 2009
    Posts
    81

    Re: Issue with QGeoPositionInfoSource

    It depends on the platform - if the platform exposes bluetooth GPS devices as part of the GPS stack then it should work. Otherwise you can read the NMEA data from the bluetooth device yourself and pass it to QNmeaPositionInfoSource. At the moment you'd have to use platform specific methods to read from the bluetooth devices, although in the future it looks like Qt Mobilitiy will be getting a Bluetooth / Near Field Communication API.

  6. #6
    Registered User
    Join Date
    Feb 2010
    Posts
    17

    Re: Issue with QGeoPositionInfoSource

    Hello all, I have a similar problem. Please see: http://bugreports.qt.nokia.com/browse/QTMOBILITY-462

  7. #7
    Registered User
    Join Date
    Feb 2010
    Posts
    17

    Re: Issue with QGeoPositionInfoSource

    The documentation for mobility 1.0.2 QGeoPositionInfoSource::requestUpdate reads: "If the source uses multiple positioning methods, it tries to gets the current position from the most accurate positioning method within the given timeout."

    So for what I understand:
    -the position is requested from all positioning sources;
    -the process is complete when the most accurate source has given a position or a timeout occurs;
    -the position with the best accuracy is reported to the user.

    Is this correct?

  8. #8
    Nokia Developer Expert
    Join Date
    Dec 2009
    Posts
    81

    Re: Issue with QGeoPositionInfoSource

    On Symbian there is an internal list of the positioning methods, each with a set of data associated with it including the expected time to get a fix and the expected accuracy of the method.

    If you call requestUpdate the backend will look for the method with the best accuracy from the methods with an expected fix time less than the specified timeout. So if the GPS has an expected time to next fix of 2 minutes and you use requestUpdate(10000) then the GPS methods won't be considered.

  9. #9
    Registered User
    Join Date
    Feb 2010
    Posts
    17

    Re: Issue with QGeoPositionInfoSource

    Thank you for you response. It is wery enlighting for me as I had trouble undestanding what was happening.
    I would very much like to know your thoughts on the approach I described in my previous post. I obviosly dont know the limitations of the symbian system - so I don't know if that aproach can even be implemented.

    My pro argument is that, using that aproach, the most accurate location would be reported to the user within the specified timeout interval, without assuming that some positioning cannot be used because they would take too long - gps times can vary a lot depeding on the location, buildings obstructing the view, weather conditions, etc.

    For example my N97 assumes that gps should be used to obtain the position withing 30s and it fails because I'm indoors while my 5800 always uses network positioning even if the conditions are perfect for it to obtain a gps fix within that interval.

  10. #10
    Registered User
    Join Date
    Jun 2010
    Location
    Bangalore,India
    Posts
    21

    Re: Issue with QGeoPositionInfoSource

    Hello,
    I'm using the simple example for Qgeopositioninfosource here is the code:-
    mainwindow.h-
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    #include<QGeoPositionInfo>
    #include <QMainWindow>

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    private:
    Ui::MainWindow *ui;
    public slots:
    void positionUpdated(const QGeoPositionInfo &info);
    };

    #endif // MAINWINDOW_H



    maindow.cpp-
    #include <qsysteminfo.h>
    #include<qgeosatelliteinfosource.h>
    #else
    #include <QSystemInfo> //(1)
    #include<QGeoPositionInfoSource>
    #endif
    using namespace QtMobility;
    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this);
    if (source) {
    connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
    this, SLOT(positionUpdated(QGeoPositionInfo)));
    source->startUpdates();
    }
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }
    void MainWindow:: positionUpdated(const QGeoPositionInfo &info)
    {
    qDebug() << "Position updated:" << info;
    }



    it's showing following build issue:

    "ISO C++ forbids declaration of 'QGeoPositionInfo' with no type"

    i'm unable resolve..
    thanx for help

    Debasish Sahu
    CAIR,DRDO
    Last edited by debasishsahu4u; 2010-08-26 at 05:53.

  11. #11
    Nokia Developer Expert
    Join Date
    Dec 2009
    Posts
    81

    Re: Issue with QGeoPositionInfoSource

    For those interested in how this issue turns out, I'm responding in the bug report from here out to reduce the amount of cross-posting.

Similar Threads

  1. Known issue ?
    By kurteknikk in forum Mobile Java General
    Replies: 1
    Last Post: 2010-02-01, 08:56
  2. I really need help on this issue
    By xchewy in forum Symbian
    Replies: 3
    Last Post: 2008-05-20, 00:17
  3. issue with infrared
    By bondinit in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-10-03, 10:32
  4. NOKIA N95 Battery Issue (Please discuss all Nokia N95 battery issue here)
    By Waqar in forum General Development Questions
    Replies: 3
    Last Post: 2007-09-17, 01:24
  5. Performance issue
    By calleandersson in forum Mobile Java General
    Replies: 1
    Last Post: 2005-07-09, 13:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×