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. Detect Operating system of SmartPhone connected to PC using QT
Forum Updated to NodeBB v4.3 + New Features

Detect Operating system of SmartPhone connected to PC using QT

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.5k 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.
  • N Offline
    N Offline
    nitinrastogi
    wrote on last edited by
    #1

    Hi,

    I have a QT application. In this application I can detect if a device is connected by ::winevent( WM_DEVICECHANGE).

    But I want to have information on the device which is connected/pluggedin to my PC like the OS running on that device( if it's a smartphone then if it is Abdroid/ Symbian/ Iphone etc?)

    Can somebody please help me?

    Thanks

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      There is no Qt API to do this, sorry.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AcerExtensa
        wrote on last edited by
        #3

        How about to look into DEV_BROADCAST_OEM struct?
        You actually need usb device information, on that info you can determine which OS is on. When you can use this information to get more specific information about OS. For example you can do that with WINAPI for Windows Mobile maybe for Windows Phone too, I don't know. And for Android you can use fastboot to check OS information(if debug usb is activated), where was also SDK functions for Symbian OS determination. etc...

        God is Real unless explicitly declared as Integer.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          nitinrastogi
          wrote on last edited by
          #4

          Hi Robert,

          Thanks so much for your quick reply.

          My application is written in using QT SDK 4.7.4 and runs on desktops.
          In this application I want to show user a message when they plugin their smartphones like ( You have plugged in a Symbian/Android/Iphone device).

          I guess you are talking about below structure:

          @
          typedef struct _DEV_BROADCAST_OEM
          {
          DWORD dbco_size;
          DWORD dbco_devicetype;
          DWORD dbco_reserved;
          DWORD dbco_identifier;
          DWORD dbco_suppfunc;
          } DEV_BROADCAST_OEM, *PDEV_BROADCAST_OEM;
          @
          Members

          • dbco_size Size of this structure, in bytes.
          • dbco_devicetype Set to DBT_DEVTYP_OEM.
          • dbco_reserved Reserved; do not use.
          • dbco_identifier OEM-specific identifier for the device.
          • dbco_suppfunc OEM-specific function value. Possible values depend on the device.

          I have overridden :
          @
          bool MainWindow::winEvent ( MSG * message, long *){
          switch(message->message) {
          case WM_POWERBROADCAST:
          if( message->wParam == PBT_APMSUSPEND ){
          //
          }
          if( message->wParam == PBT_APMRESUMEAUTOMATIC ){
          //
          }
          break;
          case WM_KEYDOWN:
          case WM_LBUTTONDOWN:
          case WM_RBUTTONDOWN:
          //
          }
          break;
          case WM_DEVICECHANGE:
          if (message->wParam == DBT_DEVNODES_CHANGED) {
          // a device was added or removed.
          emit notifyDeviceChange();
          }
          break;
          default: ;
          }
          return false;
          }
          @
          where notifyDeviceChange(); is handled in some other class.

          I am not clear how to get a object or pointer to
          DEV_BROADCAST_OEM struct?

          Second even if I get this object or pointer, how do i get the OS name ??

          Thanks

          edit: Please put code sections between @ tags; Andre

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AcerExtensa
            wrote on last edited by
            #5

            I'm not Robert :) anyway:

            in WM_POWERBROADCAST test for DBT_DEVICEARRIVAL if it is, the lParam will be then DEV_BROADCAST_HDR structure. Check for dbch_devicetype in this structure and if it equals to DBT_DEVTYP_OEM your lParam is the DEV_BROADCAST_OEM structure, just cast lParam to DEV_BROADCAST_OEM.

            also read about SetupDiGetDeviceInterfaceDetail WINAPI function.

            bq. Second even if I get this object or pointer, how do i get the OS name ??

            if OEM is "Apple iPhone bla bla", you have got iPhone, do more specific tasks with iPhone SDK to get OS version or whatever you need... If it is HTC, do the over stuff... and so on...

            You need to search on Specific Device devoplers forum for more information on how to get OS information for specified device. Qt and WINAPI can't help you here(WINAPI can help only for WM devices, maybe for WP too)

            God is Real unless explicitly declared as Integer.

            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