GattServiceProvider.StartAdvertising fails : Bluetooth device issue?

674 views Asked by At

I'm trying to publish a GATT Server following this tutorial :

https://learn.microsoft.com/en-us/windows/uwp/devices-sensors/gatt-server

The code fails on my Asus Zenbook with onboard bluetooth 4.0 :

System.Runtime.InteropServices.COMException (0x8007013C) : Bluetooth device doesnt support peripheral role

which is confirmed by this call :

BluetoothAdapter bta = await BluetoothAdapter.GetDefaultAsync(); bta.IsPeripheralRoleSupported is set to false

Do you think it is a driver issue, API issue or missing hardware feature ?

Somebody knows a bluetooth LE dongle I could manage with the new .Net API ?

I already bought a Bluegiga BLE dongle and it doesn't seem compatible...

1

There are 1 answers

0
ArturoE On

This works on desktop PCs. Some PCs might not support peripheral role, so you would need to update the IsConnectable flag to false on StartAdvertising to prevent it from advertising as peripheral role, assuming it fits your application:

GattServiceProviderAdvertisingParameters advParameters = new GattServiceProviderAdvertisingParameters
{
    IsDiscoverable = true,
    IsConnectable = false
};
serviceProvider.StartAdvertising(advParameters);