I try to let PC and HoloLens communicate over Bluetooth RFCOMM so I'm writing a UWP App. I can get the device info and so the id with a device watcher. My problem is this line:
var bluetoothDevice = await BluetoothDevice.FromIdAsync(deviceInfo.Id);
My problem is that bluetoothDevice is always set to null althought that shouldn't be. Microsoft says in their RfcommChat Excample to this line:
// If we were unable to get a valid Bluetooth device object,
// it's most likely because the user has specified that all unpaired devices
// should not be interacted with.
But my PC and and my HoloLens are already paired. And I'm getting the same error no matter if I execute the App with my PC and using HoloLens to connect with or the HoloLens and using my PC to connect with.
Can anybody help?
Regards Dustin
i found my mistake. I forgot to add bluetooth in the capabilities of package.appxmanifest:
<DeviceCapability Name="bluetooth" />
<DeviceCapability Name="bluetooth.rfcomm">
<Device Id="any">
<Function Type="serviceId:34B1CF4D-1069-4AD6-89B6-E161D79BE4D8" />
</Device>
</DeviceCapability>