PDA

View Full Version : QSystemNetworkInfo networkModeChanged freezing



DrZ
20th July 2011, 21:48
Hi, I'm new to QT but come from C#, I've been writing a application which needs the current mode, GSM or WCDMA. It works, and will quite happily work for 24 hours +. The problem is to simulate network drops / mode changes I was putting my N8 in and out of power saving mode, it's a bit brutal, but a easy way to swap the phone between 2G/3G. Most of the time it swaps over and the app reports the new mode, but occasionally it reports its on GSM even though its on WCDMA, you can then swap as many times as you like and it'll always report 'mode 1' which is GSM. :(

It's a bog standard networkModeChanged SIGNAL copied from an example.

Once it's locked up, I tried looking at the QSystemNetworkInfo currentMode() and this also reports '1' (GSM) for both 2G and 3G.

I'd be really greatfull if someone would point out something stupid I've done OR if there's a easy way to unlock it. Thanks!!! :D

I'm using a Nokia N8 and QT 4.7.3 (also tried 4.6.3)

pro


# Allow network access on Symbian
symbian:TARGET.CAPABILITY += NetworkServices

# To access current mode
symbian:TARGET.CAPABILITY = ReadDeviceData

# If your application uses the Qt Mobility libraries, uncomment
# the following lines and add the respective components to the
# MOBILITY variable.
CONFIG += mobility
MOBILITY = systeminfo


Header


#include <qsysteminfo.h>

private:
QSystemNetworkInfo *sysInfo;


Source


sysInfo = new QSystemNetworkInfo(this);

connect(sysInfo,SIGNAL(networkModeChanged(QSystemN etworkInfo::NetworkMode)),
this,SLOT(networkModeChanged(QSystemNetworkInfo::N etworkMode)));



void MainWindow::networkModeChanged(QSystemNetworkInfo: :NetworkMode mode)
{
qDebug() << mode;
}

DrZ
21st July 2011, 12:03
I left it running all night, the mode hadn't locked by the morning, that only seems to happen randomly when switching between 2G and 3G, but I noticed the networkSignalStrength had frozen at 100 (%), as with the networkModeChanged signal, I lifted it straight from the examples. I've tested it on two of friends N8s and they too get the occasional freezing modes / Signal Strength.

Anyone got any ideas? :)

I can detect frozen mode in the code, then I thought I'd write a seperate bit of code to delete the object and rebuild it which should bring it back to life, but I can't figure out a way of detecting the frozen Signal Strength. :(

Source


// Network Signal Change
connect(sysInfo,SIGNAL(networkSignalStrengthChange d(QSystemNetworkInfo::NetworkMode, int)),
this,SLOT(networkSignalStrengthChanged(QSystemNetw orkInfo::NetworkMode,int)));

void MainWindow::networkSignalStrengthChanged(QSystemNe tworkInfo::NetworkMode mode , int strength)
{
qDebug() << strength;
}