A Microsoft platform for building and publishing apps for Windows devices.
GetGattServicesAsync() throws "Value does not fall within the expected range." exception
oregonduckman
6
Reputation points
I added the following code to the BluetoothLEExplorer sample and I am seeing GetGattServicesAsync() occasionally throwing "Value does not fall within the expected range." exceptions in the AdvertisementWatcher_Received event handler. Any help on this matter is appreciated.
The code was inserted right after the call to await BluetoothLEDevicesLock.WaitAsync();.
var device = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);
if (device == null)
{
Debug.WriteLine("FromBluetoothAddressAsync failed");
return;
}
Debug.WriteLine("++++++++++++++++++++++++FromBluetoothAddressAsync succeded");
try
{
var gatt = await device.GetGattServicesAsync();
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
Developer technologies | Universal Windows Platform (UWP)
Developer technologies | Universal Windows Platform (UWP)
Sign in to answer