For a project, I need to get some data from a Bluetooth device in Windows 10 using C #. I am not very familiar with the Bluetooth API and cannot understand why the following does not work:
Using BluetoothLEAdvertisementWatcher
, I'm looking for an ad that works fine. I get ads from the device (the local name is suitable) as well ServiceUuids
. Then I try to connect to the device with the help BluetoothAddress
obtained with the advertisement:
private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher watcher,
BluetoothLEAdvertisementReceivedEventArgs eventArgs)
{
ulong blAdress = eventArgs.BluetoothAddress;
BluetoothLEDevice blDevice = await
Windows.Devices.Bluetooth.BluetoothLEDevice.FromBluetoothAddressAsync(blAdress);
}
However, this leads to an exception:
Item not found. (Exception from HRESULT: 0x80070490).
Is it right to read data from the device? Are other options available for reading data from services? Manually pairing a device in windows is not really an option, and doesn't seem to work either.
/ 1: , , . , , , . iOS, .