×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    103

    Angry QGeoPositionInfoSource::NonSatellitePositioningMethods blocks app

    I have the following code (basically starting network positioning and receiving updates):

    Code:
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QDebug>
    #include <QTimer>
    
    #include <QtCore/QCoreApplication>
    
    #define CELL_UPDATE_INTERVAL 10000
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent), ui(new Ui::MainWindow), cellSource(0)
    {
        ui->setupUi(this);
        QTimer::singleShot(2000, this, SLOT(initCellPositioning()));
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::showExpanded()
    {
    #if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR) || defined(Q_WS_MAEMO_5)
        showMaximized();
    #else
        show();
    #endif
    }
    
    
    void MainWindow::initCellPositioning()
    {
        if(!cellSource)
            cellSource = QGeoPositionInfoSource::createDefaultSource(this);
    
        if(cellSource) {
            cellSource->setPreferredPositioningMethods(QGeoPositionInfoSource::NonSatellitePositioningMethods);
            cellSource->setUpdateInterval(CELL_UPDATE_INTERVAL);
            connect(cellSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
                    this, SLOT(cellPositionUpdate(QGeoPositionInfo)));
            connect(cellSource, SIGNAL(updateTimeout()), this, SLOT(cellUpdateTimeout()));
            cellSource->startUpdates();
        }
    }
    
    
    void MainWindow::cellPositionUpdate(QGeoPositionInfo info)
    {
        QDateTime time = QDateTime::currentDateTime();
        ui->listWidget->insertItem(0, time.toString("hh:mm:ss.zzz"));
        if(info.isValid()) {
            qDebug()<<time.toString("hh:mm:ss.zzz")<<info;
        }
    }
    
    void MainWindow::cellUpdateTimeout()
    {
        QDateTime time = QDateTime::currentDateTime();
        ui->listWidget->insertItem(0, "Timeout: " + time.toString("hh:mm:ss.zzz"));
        qDebug()<<"timeout"<<time.toString("hh:mm:ss.zzz");
    }
    On some devices (old C5, 6710s), instead of giving a positionUpdated signal every 10s, it blocks the application giving as many updates per second as possible. Here is a sample of debug log (I had to kill it quick):
    Code:
    Executable file: 10696 2012-05-16T11:42:39 C:\QtSDK\Symbian\SDKs\Symbian1Qt473\\epoc32\release\gcce\udeb\CellLocationTest.exe
    Starting application...
    Application running with pid 602.
    [Qt Message] "11:42:49.811" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.104" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.129" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.156" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.184" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.213" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.243" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.277" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.309" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.342" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.377" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.413" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.464" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.512" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.559" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.606" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.655" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.702" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.750" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.798" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.810" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.858" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.906" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:50.955" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    [Qt Message] "11:42:51.004" QGeoPositionInfo(QDateTime("Wed May 16 08:42:49 2012") , QGeoCoordinate(62.6, 29.7462, 94), HorizontalAccuracy=168, VerticalAccuracy=230.457)
    Finished.
    Is there any way of using successfully Network Positioning on the phones I mentioned?

  2. #2
    Regular Contributor
    Join Date
    May 2010
    Posts
    362

    Re: QGeoPositionInfoSource::NonSatellitePositioningMethods blocks app

    Have you tried checking the value of the interval with updateInterval() in the cellUpdateTimeout()?
    Try writing that on the log.

    If it doesn't work, you could try different interval values (such as 2000) and see if that helps.

    If it is a bug, then it should be fixed. Of course it won't help you right now.
    Have you tried simply throwing away the signals if they appear too often?
    This should be the most future-sure fix for the issue.

Similar Threads

  1. QGeoPositionInfoSource initialization problem
    By codestain in forum [Archived] Qt Mobility Project
    Replies: 20
    Last Post: 2011-04-13, 18:31
  2. Issue with QGeoPositionInfoSource
    By davkaplan in forum [Archived] Qt Mobility Project
    Replies: 10
    Last Post: 2010-08-26, 03:11

Posting Permissions

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