title: Windows 10 Bluetooth Low Energy Connection c#
body: <p>For a project I need to get some data from a Bluetooth device on windows 10 using C#. I'm not too familiar with the Bluetooth API and can't figure out why the following is not working: </p>
  
  <p>Using the <code>BluetoothLEAdvertisementWatcher</code> I search for advertisements, which works fine. I do receive the advertisement from the device (local name fits) as well as it's <code>ServiceUuids</code>. Next I try to connect to the device using the <code>BluetoothAddress</code> received together with the advertisement:</p>
  
  <pre><code>private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher watcher, 
                      BluetoothLEAdvertisementReceivedEventArgs eventArgs)
  {
      ulong blAdress = eventArgs.BluetoothAddress;
      BluetoothLEDevice blDevice = await 
           Windows.Devices.Bluetooth.BluetoothLEDevice.FromBluetoothAddressAsync(blAdress);
  }
  </code></pre>
  
  <p>However, doing so results in an exception: </p>
  
  <blockquote>
    <p>Element not found. (Exception from HRESULT: 0x80070490).</p>
  </blockquote>
  
  <p>Is this the correct way to read data from the device? Are other options available to read the data from the services? Manually pairing the device in windows is not really an option and also seems to fail.</p>
  
  <p>/Edit 1: I check for the local name of the device to make sure I only try to connect to the right one. So I guess there is a problem with connecting to this specific device, still I have no idea how to work around that. The service data was succesfully read on iOS, so it should be possible.</p>