Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to get event when desktop comes back from sleep mode and LAN disconnect event
Forum Updated to NodeBB v4.3 + New Features

How to get event when desktop comes back from sleep mode and LAN disconnect event

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 4.8k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    psbhardwaj09gmail.com
    wrote on last edited by
    #1

    Hi ,

    I have an sip based application and the front end is in QT. I need to handle event when my desktop comes back after sleep mode and LAN disconnect events. Can you please help me how to handle these event. I couldn't find any Qt class which provide me these api's.

    Thanks
    Pardeep

    Pardeep Sharma

    1 Reply Last reply
    0
    • P Offline
      P Offline
      psbhardwaj09gmail.com
      wrote on last edited by
      #2

      Can somebody help me in this?

      Pardeep Sharma

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Which OS are you targeting? Those are OS specific events(there is no sleep/wake up on some), so there's no unified way to check it.

        You can implement the "nativeEvent":http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#nativeEvent method and try fishing for those events there.

        On Windows for example you should get "WM_POWERBROADCAST":http://msdn.microsoft.com/en-us/library/Aa373247 message when the system wakes up.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          psbhardwaj09gmail.com
          wrote on last edited by
          #4

          Hi Krzysztof,

          I am developing application for windows desktop. Basically i need to check network disconnect in my application and one condition is sleep mode. I checked WM_POWERBROADCAST event and it works fine but for LAN disconnect it send USB disconnect message(WM_DEVICECHANGE). Can you help me what should i do for lan disconnect.

          I tried using QNetworkConfigurationManager's signal onlineStateChanged ( bool isOnline ) but somehow it doesnt work properly.

          If i do wlan disconnect then my network switch to LAN and if i disable LAN also then sometimes it detect that netowrk goes offline but not always. Can you suggest what should i do for this problem

          Pardeep Sharma

          1 Reply Last reply
          0
          • Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            I don't know a way to get notified via event or something like that, but you might try to check periodically (with a sparse QTimer for example) for the network availability.

            Here's an example (in the comments) how to do that with INetworkManager interface: "INetworkListManager interface":http://msdn.microsoft.com/en-us/library/windows/desktop/aa965303.aspx

            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