×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    QNetworkConfiguration::StateFlag - Get availabe networks that i didn't add.

    I'm using this to get all the networks available:

    Code:
       QList<QNetworkConfiguration> configs = manager->allConfigurations(QNetworkConfiguration::Defined);
    And we have 4 flags, QNetworkConfiguration::Undefined, QNetworkConfiguration:efined, QNetworkConfiguration:iscovered, QNetworkConfiguration::Active.

    QNetworkConfiguration:efined -> Show me all the networks i already have added.
    QNetworkConfiguration:iscovered - > Show me all the networks i already have added and that is available now.

    I want to now all the networks available but that i haven't added. With undefined i suppose to get it but it just doesn't return nothing and i have some network available that i never added.

  2. #2
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Bearer: QNetworkConfiguration::Undefined

    My problem is so simple as QNetworkConfiguration::Undefined it works in PC but not works in mobile! In PC it gives the WLAN if i never used it but it mobile not!

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

    Re: QNetworkConfiguration::StateFlag - Get availabe networks that i didn't add.

    Sample application:
    main.h
    Code:
    #ifndef MAIN_H
    #define MAIN_H
    
    #include <QtGui>
    #include <QtNetwork>
    
    class NetworkEdit : public QTextEdit
    {
        Q_OBJECT
    
    public:
        NetworkEdit(QWidget * parent = 0);
    
    private slots:
        void informationAvailable();
    
    private:
        QNetworkConfigurationManager manager;
    };
    
    
    #endif // MAIN_H
    main.cpp:
    Code:
    #include "main.h"
    
    NetworkEdit::NetworkEdit(QWidget *parent) : QTextEdit(parent)
    {
        connect(&manager, SIGNAL(updateCompleted()),
                this, SLOT(informationAvailable()));
        manager.updateConfigurations();
    }
    
    void NetworkEdit::informationAvailable()
    {
        QList<QNetworkConfiguration> configs =
            manager.allConfigurations();
        for (int i = 0; i < configs.count(); ++i) {
            QNetworkConfiguration::StateFlags flags = configs.at(i).state();
            QString out = configs.at(i).name();
            if (flags & QNetworkConfiguration::Active)
                out += ", Active";
            if (flags & QNetworkConfiguration::Discovered)
                out += ", Discovered";
            if (flags & QNetworkConfiguration::Defined)
                out += ", Defined";
            if (flags & QNetworkConfiguration::Undefined)
                out += ", Undefined";
            append(out);
        }
    }
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
    
        NetworkEdit edit;
        edit.show();
    
        return a.exec();
    }

  4. #4
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Re: QNetworkConfiguration::StateFlag - Get availabe networks that i didn't add.

    RESULT:

    [Qt Message] "ENCAFFE2010, Active, Discovered, Defined"
    [Qt Message] "ThomsonB3E6EC, Active, Discovered, Defined"
    [Qt Message] "Internet Vodafone, Active, Discovered, Defined"
    [Qt Message] "FON_ZON_FREE_INTERNET, Active, Discovered, Defined"
    [Qt Message] "eduroam, Active, Discovered, Defined"
    [Qt Message] "Thomson1AC449, Active, Discovered, Defined"
    [Qt Message] "ThomsonC38AAA, Active, Discovered, Defined"
    [Qt Message] "DLink-7615AA, Active, Discovered, Defined"
    [Qt Message] "Thomson0B476B, Active, Discovered, Defined"
    [Qt Message] "Vodafone live!, Active, Discovered, Defined"
    [Qt Message] "Vodafone MMS, Active, Discovered, Defined"
    [Qt Message] "Vodafone live! Streaming, Active, Discovered, Defined"
    [Qt Message] "Porto casa, Active, Discovered, Defined"
    [Qt Message] "Thomson719471, Active, Discovered, Defined"
    Now i go to Tools->Settings->Connection->Access points->Thomson0B476B::Options->Delete!
    Running the aplication again:

    [Qt Message] "ENCAFFE2010, Active, Discovered, Defined"
    [Qt Message] "ThomsonB3E6EC, Active, Discovered, Defined"
    [Qt Message] "Internet Vodafone, Active, Discovered, Defined"
    [Qt Message] "FON_ZON_FREE_INTERNET, Active, Discovered, Defined"
    [Qt Message] "eduroam, Active, Discovered, Defined"
    [Qt Message] "Thomson1AC449, Active, Discovered, Defined"
    [Qt Message] "ThomsonC38AAA, Active, Discovered, Defined"
    [Qt Message] "DLink-7615AA, Active, Discovered, Defined"
    [Qt Message] "Vodafone live!, Active, Discovered, Defined"
    [Qt Message] "Vodafone MMS, Active, Discovered, Defined"
    [Qt Message] "Vodafone live! Streaming, Active, Discovered, Defined"
    [Qt Message] "Porto casa, Active, Discovered, Defined"
    [Qt Message] "Thomson719471, Active, Discovered, Defined"
    as you can see no Undefined connection :s

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

    Re: QNetworkConfiguration::StateFlag - Get availabe networks that i didn't add.

    It's really weird you have so many active connections. What is your platform?

  6. #6
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Re: QNetworkConfiguration::StateFlag - Get availabe networks that i didn't add.

    Quote Originally Posted by divanov View Post
    It's really weird you have so many active connections. What is your platform?
    Nokia E51 - S60 3rd Edition, Feature Pack 1
    In PC you code doesn't work! The slot is never called!

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

    Re: QNetworkConfiguration::StateFlag - Get availabe networks that i didn't add.

    Do you have Qt 4.7 installed on desktop?

  8. #8
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    91

    Re: QNetworkConfiguration::StateFlag - Get availabe networks that i didn't add.

    Quote Originally Posted by divanov View Post
    Do you have Qt 4.7 installed on desktop?
    Yes!

    If i copy the code to networkedit constructor, like this, it works:
    Code:
    NetworkEdit::NetworkEdit(QWidget *parent) : QTextEdit(parent)
    {
        connect(&manager, SIGNAL(updateCompleted()),this, SLOT(informationAvailable()));
        manager.updateConfigurations();
        QList<QNetworkConfiguration> configs =
            manager.allConfigurations();
        for (int i = 0; i < configs.count(); ++i) {
            QNetworkConfiguration::StateFlags flags = configs.at(i).state();
            QString out = configs.at(i).name();
            if (flags & QNetworkConfiguration::Active)
                out += ", Active";
            if (flags & QNetworkConfiguration::Discovered)
                out += ", Discovered";
            if (flags & QNetworkConfiguration::Defined)
                out += ", Defined";
            if (flags & QNetworkConfiguration::Undefined){
                out += ", Undefined";
            }
            qDebug()<<out;
            append(out);
        }
    
    }
    And the result is:
    "Thomson0B476B, Active, Discovered, Defined"
    "Ligação de área local* 2, Active, Discovered, Defined"
    "Ligação de área local* 10, Active, Discovered, Defined"
    "Ligação de rede sem fios, Active, Discovered, Defined"
    "Ligação de Área Local, Active, Discovered, Defined"
    "Ligação de rede Bluetooth, Active, Discovered, Defined"
    "isatap.lan, Active, Discovered, Defined"
    "Teredo Tunneling Pseudo-Interface, Active, Discovered, Defined"
    "Ligação de área local* 15, Active, Discovered, Defined"
    "isatap.{1246B284-15BC-49E2-9216-9AE2A20B86AA}, Active, Discovered, Defined"
    "Ligação de área local* 14, Active, Discovered, Defined"
    "Ligação de área local* 11-QoS Packet Scheduler-0000, Active, Discovered, Defined"
    "Ligação de área local* 11-WFP LightWeight Filter-0000, Active, Discovered, Defined"
    "Ligação de área local* 12-QoS Packet Scheduler-0000, Active, Discovered, Defined"
    "Ligação de área local* 12-WFP LightWeight Filter-0000, Active, Discovered, Defined"
    "Ligação de área local* 14-QoS Packet Scheduler-0000, Active, Discovered, Defined"
    "Ligação de rede sem fios-Native WiFi Filter Driver-0000, Active, Discovered, Defined"
    "Ligação de área local* 13, Active, Discovered, Defined"
    "Ligação de área local* 12, Active, Discovered, Defined"
    "Ligação de área local* 9, Active, Discovered, Defined"
    "Ligação de área local* 7, Active, Discovered, Defined"
    "Ligação de área local* 8, Active, Discovered, Defined"
    "Ligação de área local* 11, Active, Discovered, Defined"
    "Ligação de área local* 13-QoS Packet Scheduler-0000, Active, Discovered, Defined"
    "isatap.{A9CA7B88-57E9-4E87-AE86-B9F5BD1F5243}, Active, Discovered, Defined"
    "Ligação de área local* 15-QoS Packet Scheduler-0000, Active, Discovered, Defined"
    But the informationAvailable() is never called!

    But i don't mind with that because what i want is that works in mobile, in PC i do like:
    Code:
        QList<QNetworkConfiguration> configs = manager.allConfigurations(QNetworkConfiguration::Undefined);
    and it return just the undefined networks, i remove my home network and the result is ok:
    "Thomson0B476B, Undefined"

    If i run the same in mobile the result is always 0, maybe my mobile don't support it but in the docs says that all works!

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

    Re: QNetworkConfiguration::StateFlag - Get availabe networks that i didn't add.

    This could be some Symbian peculiarity.

Similar Threads

  1. Problem with QNetworkConfiguration
    By Fillinger in forum [Archived] Qt Mobility Project
    Replies: 2
    Last Post: 2010-09-21, 14:07
  2. How can I set QNetworkConfiguration::Type
    By zzcdyx in forum [Archived] Qt Mobility Project
    Replies: 1
    Last Post: 2010-04-30, 00:22
  3. Replies: 1
    Last Post: 2007-05-03, 19:22
  4. Replies: 2
    Last Post: 2006-06-06, 12:59
  5. how to get all profiles names availabe in phone
    By gkpbidar in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2005-08-26, 06:19

Posting Permissions

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