Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How i can detect type of network connection?
QtWS25 Last Chance

How i can detect type of network connection?

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 3 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maxim.prishchepa
    wrote on last edited by
    #1

    Hello All!
    How i can detect type of internet connection: 3g/wifi/gps/etc ?
    i try use:
    @QNetworkConfiguration man;
    qDebug() << man.bearerTypeName();
    qDebug() << man.bearerType();
    qDebug() << man.bearerTypeFamily();@
    and have output: "" "0" "0";
    0 = UnknownConnection
    Maybe have some other way?

    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz).

    1 Reply Last reply
    0
    • T Offline
      T Offline
      teroa
      wrote on last edited by
      #2

      What platform are you on? What does man.isValid() say?
      In any case, you need to get the configuration from QNetworkConfigurationManager for it to be valid, and then check the details.

      @ QNetworkConfigurationManager manager;
      QList<QNetworkConfiguration> list = manager.allConfigurations();

      for(int i = 0; i < list.length(); ++i) {
          qDebug() << list[i].isValid();
          qDebug() << list[i].bearerTypeName();
          qDebug() << list[i].bearerType();
          qDebug() << list[i].bearerTypeFamily();
      }@
      
      1 Reply Last reply
      0
      • S Offline
        S Offline
        Suraj Golliwar
        wrote on last edited by
        #3

        Not sure abt this but have something to find IP addresses(on Windows platform)

        @
        QNetworkInterface *inter = new QNetworkInterface();
        QList<QHostAddress> list;
        list=inter->allAddresses();
        QString str;

        for (int i = 0; i < list.size(); ++i) {
             str = list.at(i).toString();
        }
        

        return str;
        @

        [edit: added missing coding tags @ SGaist]

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved