×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2010
    Location
    Finland
    Posts
    19

    Qt Mobility Location, interval function is messed up.

    Ok so i've read through the forums and gotten my very simple location application to work, here is parts of the application code (the .pro file is in order, i've set the capabilities aswell)

    so i've tested this app on n97 aswell as 5800 same problem on both systems. According to the documentation i should be able to set the interval at which a location is fetched using the following method:
    http://doc.qt.nokia.com/qtmobility-1...eInterval-prop



    Code:
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        qDebug() << "mainwindow initialized";
        ui->setupUi(this);
        QGeoPositionInfoSource *posSource = QGeoPositionInfoSource::createDefaultSource(parent);
    
        if(posSource){
            posSource->setUpdateInterval(5000);
            qDebug() << posSource->updateInterval();
            qDebug() << "start" << posSource->lastKnownPosition(0);
     connect(posSource,SIGNAL(positionUpdated(QGeoPositionInfo)),this,SLOT(stateChanged(QGeoPositionInfo)));
            posSource->startUpdates();
    
        }
        /*m_location = QGeoPositionInfoSource::createDefaultSource(this);
    
        connect(m_location,SIGNAL(positionUpdated(QGeoPositionInfo)),this,SLOT(stateChanged(QGeoPositionInfo)));
    
    
        if (!m_location) {
        return;
        qDebug() << "error with m_location";
        }
        QGeoSatelliteInfoSource *m_satellite = QGeoSatelliteInfoSource::createDefaultSource(this);
        if (m_satellite) {
            qDebug() << "m_satellite";
            m_location->startUpdates();
            m_satellite->startUpdates();
            m_location->stopUpdates();
            m_satellite->stopUpdates();
        }
        connect(m_location,SIGNAL(positionUpdated(QGeoPositionInfo)),this,SLOT(stateChanged(QGeoPositionInfo)));*/
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    
    void MainWindow::stateChanged(const QGeoPositionInfo &info)
    {
        qDebug() << info.coordinate().toString(QGeoCoordinate::Degrees);
        ui->listWidget->addItem(QString("Position updated: Date/time = %1, Coordinate = %2").arg(info.timestamp().toString()).arg(info.coordinate().toString()));
    }
    The weird thing with this application is every now and then it works fine, except never with the interval of 5000 milliseconds, but with the interval set to 2000 it sometimes worked.

    I have been "debugging" for quite some time without any result, just when i think i get it to work, next time i run it on the device, it doesn't. I would understand this if i made changes to the code between the runs but no, not a single line was changed in between.

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

    Re: Qt Mobility Location, interval function is messed up.

    Do the examples work? That will (indirectly) give you an important piece of data.

    The Symbian location backend looks at several internal sources of position data and selects the internal source based on which one is most likely to give a fix inside the interval time. I think there's some tie breaking based on accuracy as well. As a side note, the guy who's maintaining the Symbian backend has some ideas about improving this, which should help in the long run but isn't that useful to you right now.

    Anyhow, depending on what you've been up to on the device your internal GPS receiver might be on, off, or in a state of readiness. It's possible that your positive results with 2000 milliseconds occurred after the GPS device got into a state of readiness and / or when the fix conditions were favourable.

    Which leads me back to the examples - most of the location examples that use GPS have machinery in place to wait for an initial fix before doing anything. Depending on how you have the phone-specific positioning settings configured, whether you're inside or outside, what the weather is like etc... this can take some time. My test phone seems to give me fixes faster when I'm standing in the middle of a road - but then again, my test phone hates me

    From what I can tell the Symbian platform methods for getting satellite information that we're using don't work until you've got a fix - if / when we get around that then the examples will actually show some information on the number of satellites in view and their signal strengths while you wait, so you know that the application hasn't just hung.

    For testing purposes I sometimes plug my phone (5800) into the charger and leave the system positioning app running to keep the GPS on. As long as it keeps its fix it means that the test apps get initial updates much sooner than otherwise.

    Once you've got an initial fix then everything should behave. If the updates are misbehaving after an initial fix you can either file a bug or let me know so I can file a bug on your behalf.

    Cheers,

    Dave

  3. #3
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    113

    Re: Qt Mobility Location, interval function is messed up.

    Same thing happened to me but with 3000 milliseconds. I read on the documentation that it will turn on data only if its available at that point. Anything above 2 seconds gave me bad results.

    Two things occur to me:

    1. If there is no updated information close to the interval, it may not even call the position updated callback.
    2. Since I don't know much about how GPS work on Symbian, there may be a bug somewhere

    I don't think it has to do anything with how long does it take to catch the satellite signals. Using AGPS, I usually get a concrete signal after 5 to 20 seconds, the day I tested this was a really stormy.
    If you're not using AGPS, however, the GPS turns quite unusable. I usually have to wait perhaps half an hour until you get a signal.

Similar Threads

  1. Qt for Symbian development resources
    By liuxg in forum [Archived] Qt General ( Qt技术)
    Replies: 55
    Last Post: 2011-01-26, 04:06
  2. kinetic scrolling
    By stalep in forum Nokia N9
    Replies: 10
    Last Post: 2009-12-08, 12:41
  3. Why don't S60 emulator loading?
    By K.John in forum Feedback - Nokia Developer Services & Infrastructure
    Replies: 9
    Last Post: 2009-08-11, 11:03
  4. Are there known issues with SDK 3 N6310i and Delphi?
    By MrSwede in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2004-06-02, 15:15

Posting Permissions

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