title: Connect to BLE peripheral on Windows 10
body: <p>I try to connect to BLE peripheral. First, I watch for advertisements:</p>
  
  <pre class="lang-cs prettyprint-override"><code>watcher = new BluetoothLEAdvertisementWatcher { ScanningMode = BluetoothLEScanningMode.Active };
  watcher.Received += WatcherOnReceived;
  watcher.Start();
  </code></pre>
  
  <p>and in the WatcherOnReceived callback I try to create BluetoothLEDevice</p>
  
  <pre class="lang-cs prettyprint-override"><code>public async void WatcherOnReceived(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs btAdv)
  {
      BluetoothLEDevice bleDevice = await BluetoothLEDevice.FromBluetoothAddressAsync(btAdv.BluetoothAddress);
  }
  </code></pre>
  
  <p>However, I always get bleDevice == null in WatcherOnReceived callback. Why and how to fix it? What is the proper way of creating BLE device in UWP application? I then need to connect to that device, discover its GATT services and characteristics, enable notifications on some of them and read/write some of them.</p>