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. Android/Qt: QNetworkInterface change status signal?
Forum Updated to NodeBB v4.3 + New Features

Android/Qt: QNetworkInterface change status signal?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 3 Posters 622 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.
  • L Offline
    L Offline
    linuxkid
    wrote on last edited by
    #1

    Hey guys, I can't see any signal/slot system for QNetworkInterface, is there any way to check if the currently pointed interface changes state besides polling it every once in a while? Does it have any way of attaching a signal handler to this class?

    As in IsUp -> something to tell it's down? There is no enum for IsDown, nor can I see the signal in the manual, but maybe there is a way besides constantly polling its state?

    aha_1980A 1 Reply Last reply
    0
    • L linuxkid

      Hey guys, I can't see any signal/slot system for QNetworkInterface, is there any way to check if the currently pointed interface changes state besides polling it every once in a while? Does it have any way of attaching a signal handler to this class?

      As in IsUp -> something to tell it's down? There is no enum for IsDown, nor can I see the signal in the manual, but maybe there is a way besides constantly polling its state?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @linuxkid

      Hey guys, I can't see any signal/slot system for QNetworkInterface, is there any way to check if the currently pointed interface changes state besides polling it every once in a while?

      Yes, polling is the way to go here. I'd just use a timer with 5 seconds timeout, that should fully suffice. You may even use longer timeouts.

      As in IsUp -> something to tell it's down? There is no enum for IsDown

      If IsUp is not set, then the network is down ;)

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      1
      • L Offline
        L Offline
        linuxkid
        wrote on last edited by
        #3

        Got it, in the meantime I ended up using a QThread derived class to poll every 50msec.. There is one issue with IsUp, sometimes the interface is up but is still not bound to any IP address.. Is the IsRunnig flag any more complete in this regard? The class should emit a signal whenever its associated and has received an IP (assuming the network profile doesn't has a static one)

        jsulmJ 1 Reply Last reply
        0
        • L linuxkid

          Got it, in the meantime I ended up using a QThread derived class to poll every 50msec.. There is one issue with IsUp, sometimes the interface is up but is still not bound to any IP address.. Is the IsRunnig flag any more complete in this regard? The class should emit a signal whenever its associated and has received an IP (assuming the network profile doesn't has a static one)

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @linuxkid said in Android/Qt: QNetworkInterface change status signal?:

          QThread derived class to poll every 50msec

          Why do you need 50ms? 50ms and a thread sounds like overkill.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          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