1

I am working on a C# application. When i pair a bluetooth device with my PC, i get two Com Ports, i.e.

enter image description here

One of these ports is used for incoming connections and one for outgoing. I have to find the port which is used for outgoing connection. This information is present in the bluetooth seetings i.e.

enter image description here

My issue is that i have to find this outgoing port programmatically in C#. How can i get this info in C#.

Waleed Naveed
  • 2,293
  • 2
  • 29
  • 57
  • It is a littl ebit long code to past it here. but [Bluetooth Framework](https://www.btframework.com/bluetoothframework.htm) provides methods to enumerate such comports (and provides association with Bluetooth device by its MAC). It also allows to create such vCOM from your application. – Mike Petrichenko Nov 19 '19 at 13:33
  • The first thing I would try would be to use WMI to query [Win32_SerialPort](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-serialport) – stuartd Nov 19 '19 at 13:33
  • Page not found @MikePetrichenko – Waleed Naveed Nov 19 '19 at 13:34
  • it does not give any information regarding the direction @stuartd – Waleed Naveed Nov 19 '19 at 13:41
  • Just checked - works. try from main page: https://www.btframework.com. Look at BluetoothManager demo->Enum vCOM – Mike Petrichenko Nov 19 '19 at 13:48

1 Answers1

1

I have managed to do this with the help of accepted answer of this question.

Waleed Naveed
  • 2,293
  • 2
  • 29
  • 57