0
votes

How do I get the port details of the Bluetooth device that I have paired within my windows form c# application? Manually I can get all port names but I need the com port name that allocated to particular Bluetooth Device.

1

1 Answers

1
votes

Check this post

the Win32_PnPEntity is Plug and play devices MSDN

you can go on the drivers also to find your device

            // The WMI query 
            const string QueryString = "SELECT * FROM Win32_PnPSignedDriver ";


            SelectQuery WMIquery = new SelectQuery(QueryString);
            ManagementObjectSearcher WMIqueryResults = new ManagementObjectSearcher(WMIquery);

            // Make sure results were found
            if (WMIqueryResults == null)
                return;

            // Scan query results to find port
            ManagementObjectCollection MOC = WMIqueryResults.Get();

            foreach (ManagementObject mo in MOC)
            { 
                if (mo["FriendlyName"] != null && mo["FriendlyName"].ToString().Contains("YOUR_DEVICE_NAME"))
                {}
              //Check the mo Properties to find the COM port
            }