×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    7

    Symbian S60v5 QT UDP reading not working!

    Hi! I am unable to read info from UDP using this source on my phone. It connects to my PC and reads info from a game. The app works fine in Qt debugger when running on PC, however on the phone it doesn't work. I also don't see a Wi-Fi logo on the phone, when running.

    I tried to set up QNetwork, and connect to the default access point, but that wouldn't start on the phone when installed. It just displayed the loading mark, and never opened. In Debugger when launching on phone it says "Could not start application: General OS-related error" But If I remove the network parts, it starts.

    PHP Code:
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QtNetwork/QUdpSocket>
    #include <QtNetwork/QHostAddress>
    #include <QtNetwork>

    MainWindow::MainWindow(QWidget *parent) :
        
    QMainWindow(parent),
        
    ui(new Ui::MainWindow)
    {
        
    ui->setupUi(this);
        
    MainWindow::setUpOG();
    }

    MainWindow::~MainWindow()
    {
        
    delete ui;
    }

    void MainWindow::setUpOG()
    {
        
    //ui->label->setText("Hi!");
        
    MainWindow::setWindowTitle("SymGauge");

        
    MainWindow::udpSocket = new QUdpSocket(this);
        
    MainWindow::udpSocket->bind(QHostAddress::Any30000);
        
    connect(MainWindow::udpSocketSIGNAL(readyRead()), thisSLOT(readPendingDatagrams()));
    }

     
    void MainWindow::readPendingDatagrams()
     {
         while (
    MainWindow::udpSocket->hasPendingDatagrams())
         {
             if(
    MainWindow::udpSocket->pendingDatagramSize() == 92)                               //Check if the incoming packet is 92 bytes long.
             
    {
             
    QByteArray datagram;
             
    datagram.resize(udpSocket->pendingDatagramSize());
             
    QHostAddress sender;
             
    quint16 senderPort;

             
    udpSocket->readDatagram(datagram.data(), datagram.size(),
                                     &
    sender, &senderPort);

             
    ui->label->setText("Received datagram");
             
    processTheDatagram(datagram);
         }
             else { 
    MainWindow::udpSocket->readDatagram(NULL0NULLNULL); }
         }
     } 
    and my .pro:

    PHP Code:
    #-------------------------------------------------
    #
    # Project created by QtCreator 2010-12-19T11:52:41
    #
    #-------------------------------------------------

    QT       += core gui network

    TARGET 
    gauuuge
    TEMPLATE 
    app

    SOURCES 
    += main.cpp\
            
    mainwindow.cpp

    HEADERS  
    += mainwindow.h

    FORMS    
    += mainwindow.ui

    CONFIG 
    += mobility
    MOBILITY 
    += bearer

    symbian 
    {
        
    TARGET.UID3 0xe52771aa
        TARGET
    .CAPABILITY += NetworkServices
        TARGET
    .EPOCSTACKSIZE 0x14000
        TARGET
    .EPOCHEAPSIZE 0x020000 0x800000
    }
    symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
    symbian:TARGET.CAPABILITY NetworkServices 
    Thanks.

  2. #2
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: Symbian S60v5 QT UDP reading not working!

    Hi,
    are you on Qt 4.7.1?
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    7

    Re: Symbian S60v5 QT UDP reading not working!

    Quote Originally Posted by tamhanna View Post
    Hi,
    are you on Qt 4.7.1?
    Hi, thanks, that solved the problem, I was on Qt 4.7.0

    Now another problem, is there any way to keep the Backlight on? As this application displays Speed, RPM and Gear from a game, I need the light to stay on.

    Thanks!

  4. #4
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: Symbian S60v5 QT UDP reading not working!

    Actually, this is strange. Network on 4.7.1 works bad for me.
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

  5. #5
    Registered User
    Join Date
    Sep 2010
    Posts
    7

    Re: Symbian S60v5 QT UDP reading not working!

    Quote Originally Posted by tamhanna View Post
    Actually, this is strange. Network on 4.7.1 works bad for me.
    This code below works very well for me:

    This is in the SetUpOG();
    PHP Code:
    // Set Internet Access Point
        
    QNetworkConfigurationManager manager;
        const 
    bool canStartIAP = (manager.capabilities()
            & 
    QNetworkConfigurationManager::CanStartAndStopInterfaces);
        
    QNetworkConfiguration cfg manager.defaultConfiguration();
        if (!
    cfg.isValid() || !canStartIAP) {
        }
        
    MainWindow::session = new QNetworkSession(cfgthis);
        
    MainWindow::session->open();
        
    MainWindow::session->waitForOpened(); 
    This is the header:
    PHP Code:
    public:
        
    QNetworkSessionsession

  6. #6
    Registered User
    Join Date
    Sep 2010
    Posts
    7

    Re: Symbian S60v5 QT UDP reading not working!

    Sorry for double posting, but is there anyway to keep the backlight on?

    I tried searching, but couldn't find any answers.

    Povo.

  7. #7
    Registered User
    Join Date
    Dec 2010
    Posts
    62

    Re: Symbian S60v5 QT UDP reading not working!

    Quote Originally Posted by PoVo View Post
    Sorry for double posting, but is there anyway to keep the backlight on?

    I tried searching, but couldn't find any answers.

    Povo.
    Maybe this helps:

    User::ResetInactivityTime()

    You can retrieve backlight on/off state from HAL but I don't remember was there any P&S or ActiveObjects for it, so you need to create own timer what calls this ResetInactivityTime(). Qt may have own function for this.

  8. #8
    Registered User
    Join Date
    Sep 2010
    Posts
    7

    Re: Symbian S60v5 QT UDP reading not working!

    Quote Originally Posted by jupaavola View Post
    Maybe this helps:

    User::ResetInactivityTime()

    You can retrieve backlight on/off state from HAL but I don't remember was there any P&S or ActiveObjects for it, so you need to create own timer what calls this ResetInactivityTime(). Qt may have own function for this.
    And what include do I have to specify to use this?

    "#include <Qwhateverthenameis>"

  9. #9
    Registered User
    Join Date
    Dec 2010
    Posts
    62

    Re: Symbian S60v5 QT UDP reading not working!

    Quote Originally Posted by PoVo View Post
    And what include do I have to specify to use this?

    "#include <Qwhateverthenameis>"
    No, it's symbian code but you can use it in Qt app aswell.

    #include <e32std.h>

    IIRC, libs += -leuser

  10. #10
    Registered User
    Join Date
    Aug 2009
    Posts
    173

    Re: Symbian S60v5 QT UDP reading not working!

    I have tried too to connect with UDP socket/protocol to my local pc via WLAN from my phone.

    And i think, that because UDP socket is not "connected" way behavioring socket, but is "unconnected"
    way behavioring, then the phone is not acting as the same way as pc connected
    udp-sokcet connection does.

    "Becaus of", phone is not same way connected "to wired lan/wlan" when you command
    from phone to connect to lan, to connect to near envrinomnet, as pc does.

    You need TCP socket when you want to connect and change data
    beetween your phone and another end with ip address.

    But why phone is not acting as pc acts with udp socket - i do not know.
    But i think, that Nokia guys knows the reason, why udp socket practices
    in phone are not working as pc udp socket is working in pc's remote environment.
    Last edited by teknikko; 2010-12-23 at 23:17.

  11. #11
    Registered User
    Join Date
    Sep 2010
    Posts
    7

    Re: Symbian S60v5 QT UDP reading not working!

    Are you sure you didn't copy my the line from my code:

    PHP Code:
      if(MainWindow::udpSocket->pendingDatagramSize() == 92)                               //Check if the incoming packet is 92 bytes long. 
    Because it checks the size of the datagram, and if it's not 92 it doesn't process it. (NOT ALL DATAGRAMS ARE 92 BYTES, the game I'm using has 92 byte sized datagrams outputted so I use it to check if it's not corrupted etc.

  12. #12
    Nokia Developer Expert
    Join Date
    Nov 2003
    Posts
    43

    Re: Symbian S60v5 QT UDP reading not working!

    Quote Originally Posted by tamhanna View Post
    Actually, this is strange. Network on 4.7.1 works bad for me.
    Do you have more details about this? Have you installed Open C 1.7.5? On what device(s) and any specific FW?

    - Eero

  13. #13
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: Symbian S60v5 QT UDP reading not working!

    Hi,
    sorry for my large delay due to the new years eve.

    I have already posted a few bug reports re this. Please send an email to tamhan at tamoggemon point com if you want to discuss further!
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

Similar Threads

  1. Qt Creator code completion not working with Qt Mobility for Symbian
    By ceefour in forum [Archived] Qt Mobility Project
    Replies: 4
    Last Post: 2011-09-10, 05:02
  2. Can't get Qt for Symbian 4.7.1 working with Nokia Qt SDK
    By arendjr in forum [Archived] Qt SDKs and Tools
    Replies: 9
    Last Post: 2011-03-01, 14:07
  3. Replies: 35
    Last Post: 2010-09-13, 12:05

Posting Permissions

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