5

How to scan for Bluetooth Low Energy devices in Windows-8 Desktop?

I've tried to use WinSock APIs but all I'm get is Bluetooth Classic devices.

I've also tried to use Bluetooth APIs but all I'm get is Bluetooth Classic devices.

I know that it is possible, since windows is doing that. For example, I can run C:\Windows\System32\DevicePairingWizard.exe and it will display the list of all devices, Classic & Low Energy.

Pupsik
  • 741
  • 3
  • 8
  • 25

2 Answers2

7

In case other people are looking for an answer.

In Windows 8 (Desktop & Metro App) there are NO APIs for BLE device discovery and pairing.

This is not lack of implementation, it is by design. Windows folks want us to use "inbox experience" to search & pair BLE devices.

For more details, see this MSDN forum thread.

Good luck!

Pupsik
  • 741
  • 3
  • 8
  • 25
  • Regarding Windows Desktop APIs there are no changes. Regarding Metro APIs I can't not be sure since I didn't check them since the last time. – Pupsik Jun 17 '14 at 11:04
  • 2
    There's a GATT BLE API in Windows 8: https://msdn.microsoft.com/en-us/library/windows/hardware/hh450825(v=vs.85).aspx – Jay Koutavas Apr 01 '15 at 22:12
  • 1
    Yes, these APIs are funny. Do you know how to get hDevice HANDLE that is used in most of these APIs? It is well documented... NOT! – Pupsik Apr 08 '15 at 08:02
  • I guess based on the MSDN thread, best to try with Windows 10. – David Dec 05 '15 at 02:23
  • Sample for Windows 10, which I've tested and it works. Unfortunately it seems to be Universal platform only which wasn't quite what I wanted, but it might work for others. https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BluetoothLE – Chris Rae Nov 21 '17 at 00:10
  • @ChrisRae know of a UWP C++ example? I found what I thought would work but it's not finding devices, as it fails during SetupDiEnumDeviceInterfaces, debug points to these errors "onecore\drivers\bluetooth\legacy\win32leadapter\client\lib\gattlegacyapiclient.cpp(164)\BluetoothApis.dll!00007FFBB8755323: (caller: 00007FFBB87517D2) ReturnHr(1) tid(4ee8) 80070006 The handle is invalid." Which makes me think it's legacy code now: https://github.com/namitjuneja/gatt-ble/blob/master/gatt.c – scape Jan 20 '19 at 19:26
  • I'm afraid I do not. – Chris Rae Jan 22 '19 at 01:15
2

You could use BLE hardware module that you can control via a serial interface. Depending on your use case this may not be what you want as it does not make use of Windows 8's internal BLE stack! Basically this solution is for tinkering/development.

I know these two devices that can do this and have APIs for BLE discovery: