none
Scanning for Bluetooth LE devices RRS feed

  • Question

  • Hi,

    I've done very little with windows in the last years. Now I try to port a simple application from OS/X to Windows 10 (and if possible windows 8.1 too). I'm a little bit overwhelmed by the amount of APIs and technologies provided. I wrote my application in C++ and designed the Bluetooth LE part as a set of C functions and struct, because I hope for this to be available on most platforms.

    I hoped to find something like the win32 API that would give me access to the required functions. But the only thing that comes close to what I need, is BluetoothLEAdvertisementWatcher, which seems to be written in some kind of C++ dialect. I wonder if this is the "official" and only way to scan for Bluetooth LE devices? Is there a C compatible interface to this sort of functionality?

    Kind regards and thanks in advance,

    Torsten 


    Friday, September 22, 2017 1:40 PM

Answers

  • Hi Torsten,

    Our richest set of functionality is in the UWP under Windows.Devices.Bluetooth. As you've observed the newest functionality like scanning for advertisements and implementing a GATT server is only implemented in UWP, there are no flat C interfaces. We have a limited set of legacy functionality in flat C for Win32

    Most of our UWP APIs are marked with the DualApiPartition attribute, for these you are able to use them from native applications written in C++ (many system services and our own tests do this). Using DualApiPartition APIs via C is technically possible but quiet challenging and requires a deep understanding of COM. There is an article called COM in plain C that explains how, we don't implement tests for this so you would be forging new ground with our APIs here.

    I hope this helps,

    Frank

    Friday, September 22, 2017 3:17 PM
  • Yes 👍
    Saturday, September 23, 2017 11:49 PM

All replies

  • Hi Torsten,

    Our richest set of functionality is in the UWP under Windows.Devices.Bluetooth. As you've observed the newest functionality like scanning for advertisements and implementing a GATT server is only implemented in UWP, there are no flat C interfaces. We have a limited set of legacy functionality in flat C for Win32

    Most of our UWP APIs are marked with the DualApiPartition attribute, for these you are able to use them from native applications written in C++ (many system services and our own tests do this). Using DualApiPartition APIs via C is technically possible but quiet challenging and requires a deep understanding of COM. There is an article called COM in plain C that explains how, we don't implement tests for this so you would be forging new ground with our APIs here.

    I hope this helps,

    Frank

    Friday, September 22, 2017 3:17 PM
  • Hello,

    thank you very much for yor answer. So in my case, I have either restrict my application to the functions provided by the C API or I have to learn how to use UWP from C++. If I got it right, there is some kind of adaptation from UWP/C++/CX to standard C++ called WRL, right?

    kind regards,

    Torsten



    Saturday, September 23, 2017 9:26 AM
  • Yes 👍
    Saturday, September 23, 2017 11:49 PM