×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    272

    Question Strange behaviour of QMaemoInternetConnectivity

    I got the following code in my app:

    Code:
        if (QMaemoInternetConnectivity::isConnected()) {
            getData();
        } else {
            QSystemDeviceInfo* deviceInfo = new QSystemDeviceInfo();
            QSystemDeviceInfo::Profile profile = deviceInfo->currentProfile();
            if (profile == QSystemDeviceInfo::OfflineProfile) {
                QMaemo5InformationBox::information(this, "The device is in Offline mode.", 10000);
            } else {
                QMaemoInternetConnectivity::connectionRequest();
            }
        }
    The problem with this is that if I lunch the app in WLAN and then later change it to 3G, it will not see that it's connected and a connection dialogue appears. The same is true visa-versa, that is if it's 3G and I change it to WLAN.

    Also, if the device is set to automatically connect to 3G and no connection is present when launching the app, it will connect to WLAN.

    Has someone else noticed this strange behaviour with QMaemoInternetConnectivity? Should I do it differently?

    Cheers

  2. #2
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Strange behaviour of QMaemoInternetConnectivity

    I think you should be doing something like this
    Code:
    QSystemNetworkInfo* networkInfo = new QSystemNetworkInfo();
    if (networkInfo->networkStatus(QSystemNetworkInfo::EthernetMode) != QSystemNetworkInfo::Connected) {
        QMaemoInternetConnectivity::connectionRequest();
    }

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    272

    Re: Strange behaviour of QMaemoInternetConnectivity

    Quote Originally Posted by divanov View Post
    I think you should be doing something like this
    Code:
    QSystemNetworkInfo* networkInfo = new QSystemNetworkInfo();
    if (networkInfo->networkStatus(QSystemNetworkInfo::EthernetMode) != QSystemNetworkInfo::Connected) {
        QMaemoInternetConnectivity::connectionRequest();
    }
    Is that QSystemNetworkInfo::EthernetMode active whenever there is internet connection, no matter what connection type is used?

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    272

    Re: Strange behaviour of QMaemoInternetConnectivity

    Quote Originally Posted by Sasler View Post
    Is that QSystemNetworkInfo::EthernetMode active whenever there is internet connection, no matter what connection type is used?
    I did some testing and it seems that only the WlanMode reoprts the connection status. But if I'm using 3G connection, networkStatus doesn't give me any indications whether is connected or not. All I get is HomeNetwork and that comes even when it's not connected to the internet.

  5. #5
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Strange behaviour of QMaemoInternetConnectivity

    Yes, it looks like if you have mobile data connection it cannot be detected from QSystemNetworkInfo.
    It's worth to be reported
    http://bugreports.qt.nokia.com/secur...e!default.jspa

    BTW, did you check Qt Mobility Bearer Management API?
    http://doc.qt.nokia.com/qtmobility-1...ion.html#state
    Last edited by divanov; 2010-07-07 at 13:25.

  6. #6
    Registered User
    Join Date
    Jan 2010
    Posts
    272

    Re: Strange behaviour of QMaemoInternetConnectivity

    Quote Originally Posted by divanov View Post
    Yes, it looks like if you have mobile data connection it cannot be detected from QSystemNetworkInfo.
    It's worth to be reported
    http://bugreports.qt.nokia.com/secur...e!default.jspa

    BTW, did you check Qt Mobility Bearer Management API?
    http://doc.qt.nokia.com/qtmobility-1...ion.html#state
    OK, i made a bug report here.

    I tried to use that Qt Mobility Bearer Managemen but was unsuccessful. Is there any simple example code I could see? All I need is to find out whether there is a connection or not.

  7. #7
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Strange behaviour of QMaemoInternetConnectivity

    Last edited by divanov; 2010-07-07 at 14:25.

  8. #8
    Registered User
    Join Date
    Jan 2010
    Posts
    272

    Re: Strange behaviour of QMaemoInternetConnectivity

    Quote Originally Posted by divanov View Post
    But isn't that your goal?
    Yes, but I haven't found a reliable way. I made bug report of QMaemoInternetConnectivity too. But I'm starting to wonder if the bug is in Maemo PR1.2 instead of Qt 4.6.2, because I got the same results with this method.

  9. #9
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Strange behaviour of QMaemoInternetConnectivity

    QMaemoInternetConnectivity is obsolete API and should not be used. "This method" is also Qt.
    You can see all active interfaces with /sbin/ifconfig utility on Linux.

  10. #10
    Registered User
    Join Date
    Jan 2010
    Posts
    272

    Re: Strange behaviour of QMaemoInternetConnectivity

    Quote Originally Posted by divanov View Post
    QMaemoInternetConnectivity is obsolete API and should not be used. "This method" is also Qt.
    You can see all active interfaces with /sbin/ifconfig utility on Linux.
    So what should be used to request connection if one is not present?

  11. #11
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Strange behaviour of QMaemoInternetConnectivity

    Qt Mobility Bearer Management.

  12. #12
    Registered User
    Join Date
    Jan 2010
    Posts
    272

    Re: Strange behaviour of QMaemoInternetConnectivity

    Quote Originally Posted by divanov View Post
    Qt Mobility Bearer Management.
    Yeah, this seems to work fine:

    Code:
                QNetworkConfigurationManager mgr;
                QNetworkConfiguration ap = mgr.defaultConfiguration();
                QNetworkSession* session = new QNetworkSession(ap);
                session->open();

Similar Threads

  1. Strange behaviour
    By hansorkrutor in forum Symbian
    Replies: 0
    Last Post: 2010-03-02, 15:56
  2. strange ctimer behaviour
    By kellogs in forum Symbian
    Replies: 8
    Last Post: 2009-11-24, 18:42
  3. Strange behaviour..please help
    By Abhishek_karmakar in forum Symbian
    Replies: 6
    Last Post: 2009-01-28, 06:26
  4. Strange behaviour
    By ajitac in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 2
    Last Post: 2008-04-21, 12:15
  5. Strange canvas behaviour
    By qwerty86poka in forum Symbian
    Replies: 1
    Last Post: 2006-08-15, 09:07

Posting Permissions

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