Uploaded image for project: 'Qt Mobility'
  1. Qt Mobility
  2. QTMOBILITY-1577

QNetworkConfigurationManager::isOnline() returns false when there is already active network connection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Out of scope
    • Affects Version/s: 1.0.2, 1.1.1
    • Fix Version/s: None
    • Component/s: Bearer Management
    • Labels:
      None
    • Environment:
      Tested on Nokia 5800XM with Qt 4.6.3/Qt Mobility 1.0.2 as well as Qt 4.7.1/Qt Mobility 1.1.1.

      Description

      There is a quote from PoC (full PoC is attached to this issue):

      AppController::AppController(QWidget *parent) : QWidget(parent), ui(new Ui::AppController)
      {
      NetworkConfigurationManager = new QNetworkConfigurationManager();
      NetworkSession = NULL;

      connect(NetworkConfigurationManager, SIGNAL(onlineStateChanged(bool)), SLOT(OnlineStateChanged(bool)));

      QTimer::singleShot(0, this, SLOT(InitNetwork()));
      }

      void AppController::InitNetwork()
      {
      QCoreApplication::processEvents();

      QMessageBox::information(this, "InitNetwork: isOnline()", QString("InitNetwork: isOnline(): %1").arg(NetworkConfigurationManager->isOnline()));

      if (NetworkSession == NULL)

      { OnlineStateChanged(NetworkConfigurationManager->isOnline()); }

      }

      void AppController::OnlineStateChanged(bool is_online)
      {
      QMessageBox::information(this, "OnlineStateChanged: is_online", QString("OnlineStateChanged: is_online: %1").arg(is_online));

      if (!is_online) {
      if (NetworkSession != NULL)

      { NetworkSession->deleteLater(); }

      NetworkSession = new QNetworkSession(NetworkConfigurationManager->defaultConfiguration());

      connect(NetworkSession, SIGNAL(opened()), SLOT(NetworkSessionOpened()));
      connect(NetworkSession, SIGNAL(error(QNetworkSession::SessionError)), SLOT(NetworkSessionError(QNetworkSession::SessionError)));

      NetworkSession->open();
      }
      }

      void AppController::NetworkSessionOpened()
      {
      QMessageBox::information(this, "NetworkSessionOpened: isOnline()", QString("NetworkSessionOpened: isOnline(): %1").arg(NetworkConfigurationManager->isOnline()));

      OnlineStateChanged(NetworkConfigurationManager->isOnline());
      }

      void AppController::NetworkSessionError(QNetworkSession::SessionError)
      {
      QMessageBox::information(this, "NetworkSessionError: isOnline()", QString("NetworkSessionError: isOnline(): %1").arg(NetworkConfigurationManager->isOnline()));

      OnlineStateChanged(NetworkConfigurationManager->isOnline());
      }

      When there is already active network connection (for example, started by another application), NetworkConfigurationManager->isOnline() always return false, even when NetworkSessionOpened() is fired.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            cristiano cristiano di flora
            Reporter:
            oleg_derevenetz Oleg Derevenetz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes