Bluetooth custom Pairing using a windows service

347 views Asked by At

We're working on an .net core 3.0 app under UWP win 10. The app runs as a BLE central, connecting to BLE peripherals. We use the Windows.Devices.Bluetooth namespace which defines a Windows Runtime API that allows UWP desktop apps to interact with Bluetooth devices.

When we run the app as is, we can pair without issues. However when we wrap the model within a windows service, everything works but the pairing process which returns a Failed DevicePairingResultStatus for the pairAsync(pin_number) request. The code which is run remains exactly the same in both cases. Pairing is performed with DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ProvidePin, DevicePairingProtectionLevel.Encryption) method.

We've tried running the service as logged on as Local System, Local Service, local user with admin privileges, Administrator and Network Service with the same results.

Windows 10 is updated as well as Bluetooth drivers, Bios etc.

Does anyone have any suggestions as to why the difference exists between running as a windows service and running as an app? And how to bypass this?

Thanks!

0

There are 0 answers