views:

16

answers:

2

I need to find out programatically whether a connection is a Bluetooth connection rather than a physically wired connection to a comm port.

This is on Windows using .NET.

+1  A: 

Well, difficult, this emulation is done at the device driver level. You can get some info out of the driver with WMI, Win32_SerialPort class. Maybe you can key off some of this. Try it out with the WMI Code Creator utility, it also generates the code you need.

Hans Passant
+1  A: 

Yup, something like I describe in 32feet.NET's User Guide:

  • Getting virtual COM port names for remote Bluetooth devices

On Win32, to find which virtual COM port is for which remote device use WMI to query the serial ports; the remote device address is included in the PnP Id. In the following PowerShell example see the remote address as “00803A686519”.

C:\> Get-WmiObject -query "select DeviceID,PNPDeviceID from Win32_SerialPort"
DeviceID     : COM66 
PNPDeviceID  : BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}\7&1D80ECD3&0&00803A686519_C00000003
… …
alanjmcf