title: How to scan and connect to advertising BLE devices from C++ code?
body: <p>I'm trying to search and connect to advertising Bluetooth Low Energy devices from C++ code.
  I would like a piece of code to use laptop's wireless chip to discover and connect to BLE devices, regardless of their GATT Services.
  I want <em>in fine</em> to use GATT properties (Services, Characteristics, Descriptors, Notification).</p>
  
  <h2>Programmatically</h2>
  
  <p>I have the <a href="https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.advertisement.bluetoothleadvertisementwatcher" rel="nofollow noreferrer">BluetoothLEAdvertisementWatcher Class</a> documentation from Windows API.</p>
  
  <p>I tried to make working <a href="https://www.codeproject.com/Questions/1193565/Bluetooth-low-energy-windows-programming" rel="nofollow noreferrer">this example</a> but without good results.</p>
  
  <p>I also tried <a href="https://github.com/urish/win-ble-cpp/blob/master/BLEScanner/BLEScanner.cpp" rel="nofollow noreferrer">this example</a>, but no success.</p>
  
  <h2>Manually</h2>
  
  <p>I figured out using Windows 10 Action Center, and use manual pairing to connect devices (because Windows con see and connect my device).</p>
  
  <p>Then I could use directely the <a href="https://docs.microsoft.com/en-us/uwp/api/Windows.Devices.Bluetooth.GenericAttributeProfile" rel="nofollow noreferrer">Windows.Devices.Bluetooth.GenericAttributeProfile Namespace</a></p>
  
  <p>Is there a way to implement that automatically?</p>