I use DeviceWatcher to get DeviceInformation for a paired Bluetooth device in a UWP application. I installed DeviceWatcher this way
var requestedProperties = new string[] { "System.Devices.Aep.DeviceAddress", "System.Devices.Aep.IsConnected" }; var deviceWatcher = DeviceInformation.CreateWatcher("(System.Devices.Aep.ProtocolId:=\"{e0cbf06c-cd8b-4647-bb8a-263b43f0f974}\")", requestedProperties, DeviceInformationKind.AssociationEndpoint);
When the DeviceWatcher_Added event handler is called, I check if the device is the one I'm interested in, checking its name and offering RfcommServiceId. SerialPort.Uuid .
As soon as I have DeviceInformation for a bluetooth device, I wonder how can I get a COM port? I see this in the Device Manager, where it is listed as โStandard Serial Bluetooth Communication (COM8),โ but I donโt see how to programmatically get this โCOM8โ in UWP.
I tried to make DeviceInformation in SerialDevice, thanks to which I was able to get SerialDevice.PortName (cf this ), but my call to SerialDevice.FromIdAsync(deviceInfo.Id) fails with a System.Exception error: data is invalid.
(NB Some painful answers, such as this and, use the Windows WMI management toolkit, but they are not available in UWP.)
c # bluetooth uwp serial-port
dumbledad
source share