0

I am using WMI to query for serial ports which are connected via bluetooth, I get management object with the following properties:

    Property[Caption] = null
    Property[ClassGuid] = {4d36e978-e325-11ce-bfc1-08002be10318}
    Property[CompatID] = BTHENUM\{00001101-0000-1000-8000-00805f9b34fb}
    Property[CreationClassName] = null
    Property[Description] = Standard Serial over Bluetooth link
    Property[DeviceClass] = PORTS
    Property[DeviceID] = BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0002\7&2B70A8A8&0&88C626AD9497_C00000000
    Property[DeviceName] = Standard Serial over Bluetooth link
    Property[DevLoader] = null
    Property[DriverDate] = 20060621000000.******+***
    Property[DriverName] = null
    Property[DriverProviderName] = Microsoft
    Property[DriverVersion] = 10.0.15063.0
    Property[FriendlyName] = Standard Serial over Bluetooth link (COM5)
    Property[HardWareID] = BTHENUM\{00001101-0000-1000-8000-00805f9b34fb}_LOCALMFG&0002
    Property[InfName] = bthspp.inf
    Property[InstallDate] = null
    Property[IsSigned] = true
    Property[Location] = null
    Property[Manufacturer] = Microsoft
    Property[Name] = null
    Property[PDO] = \Device\BthModem0
    Property[Signer] = Microsoft Windows
    Property[Started] = null
    Property[StartMode] = null
    Property[Status] = null
    Property[SystemCreationClassName] = null
    Property[SystemName] = null

What I would like to do is to find the correspondent Bluetooth device and unpair it programatically (C# or C++). So far I didn't manage to find any way to do so. Unintalling the ports doesn't automatically unpair the device.

I tried to map these properties to properties of the BT device driver and found no matches...

Myar
  • 112
  • 10
  • 1
    You could try using a BT Framework, which would make most of this much easier to manage https://www.btframework.com/bluetoothframework.htm#download – Jon Apr 23 '19 at 14:41
  • 1
    Have you tried [`BluetoothRemoveDevice`](https://learn.microsoft.com/en-us/windows/desktop/api/bluetoothapis/nf-bluetoothapis-bluetoothremovedevice)? – wally Apr 23 '19 at 14:47
  • Third party libraries are not an option – Myar Apr 23 '19 at 14:49
  • What do I pass to BluetoothRemoveDevice if I have COM port information only? I can enumerate through Bluetooth devices, but how can I find related serial ports? – Myar Apr 23 '19 at 14:50
  • You would have to use `BluetoothFindFirstRadio` and then iterate through the devices to find the one you want. – wally Apr 23 '19 at 14:58
  • But how do I know which one I want? How can I eastablish a relationship between BluetoothDevice and Serial Port? – Myar Apr 23 '19 at 15:05
  • 2
    You have to use SetupAPI together with Registry to find which vCOM linked to device's MAC. In fact its long code to publish it here. – Mike Petrichenko Apr 23 '19 at 15:07
  • Mike, can I find an example somewhere? What should I look for in the registry – Myar Apr 23 '19 at 15:29

0 Answers0