0

I have a Visual Studio 2017 C++ MFC project. I need to add code to enumerate and connect to a Bluetooth LE device. I can find sample code for connecting to Bluetooth Classic via C++ but everything I am finding for Bluetooth LE for Windows C++ is using C++/WinRT and XAML. I'm not sure that these C++/WinRT solutions can be incorporated into an existing C++ project.

Is there any Windows API for connecting to BT Low Energy that can be used in a straight C++ app?

TIA

ehardin
  • 47
  • 6
  • You can use WinRT API in C++ MFC application. Or you can use any third-party lib. For example Bluetooth Framework. – Mike Petrichenko Jun 21 '22 at 21:27
  • "*I'm not sure that these C++/WinRT solutions can be incorporated into an existing C++ project*" - per the [documentation](https://learn.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt): "*C++/WinRT is an entirely standard modern C++17 language projection for Windows Runtime (WinRT) APIs, **implemented as a header-file-based library**, and designed to provide you with first-class access to the modern Windows API. With C++/WinRT, you can author and consume Windows Runtime APIs **using any standards-compliant C++17 compiler**.*" – Remy Lebeau Jun 21 '22 at 21:58
  • Studying the code in the Windows-universal-samples -> BluetoothLE sample, I can't figure out what snippets I could even use in my project. Not only is this like a different language all together but they have compounded the confusion by making each sample so complex with multiple scenarios in a single Solution that one doesn't know what is part of what. Maybe it is just me. – ehardin Jun 22 '22 at 13:42

0 Answers0