Including Bluetoothleapis.h Not Working

I’m trying to create a C++ class that will read the output of a heart rate monitor, but Visual Studio is unable to recognise identifiers within the included header files, mainly within bluetoothleapis.h. I’m including the header files inside the class header like this:

#include "AllowWindowsPlatformTypes.h"
#include "stdio.h"
#include "windows.h"
#include "setupapi.h"
#include "devguid.h"
#include "regstr.h"
#include "bthdef.h"
#include "Bluetoothleapis.h"
#include "HideWindowsPlatformTypes.h"

However Visual Studio still doesn’t seem to recognise identifiers from these files. I’m also getting an unrecognised pragma in bthdef.h. Is there something else I need to consider when including these files within a UE4 C++ class?

Did you eventually find a solution for this?

Yeah. I added a line to disable the unrecognised pragma warning:

#pragma warning( disable : 4068 )

And I also included another header which fixed most of the missing Windows identifiers:

#include "Windows/COMPointer.h"

And finally I forced definitions of the Windows version types to be Windows 8 (generally not a good idea, but not a problem in this instance because Bluetooth LE only works in Windows 8 and up anyway):

#define _WIN32_WINNT _WIN32_WINNT_WIN8

After that, everything worked fine.

Thanks for sharing!

i need to do exact the same thing like you with the same headers. But i still can’t find out why its not working for me. I get lots of C4668 Errors.
Would you mind helping me?

Does Visual Studio tell you where the errors are occurring? C4668 errors happen when the compiler tries to use undefined symbols in preprocessor directives. This usually means you just have to use #define with whatever symbol is undefined.

Also, if you’re using the defines I mentioned before, make sure you’re using both, as _WIN32_WINNT will default to undefined if NTDDI_VERSION is redefined in your program.

Oh wow, did not expect you to answer me since this topic is a year old. I appreciate it so much.

This is the code that’s working correctly as a command line tool. I want to get this code working in UE, but instead of printing the current heart rate, i just want to store the variable.

What i did for now is, i created a function library plugin which creates by singleton pattern a HeartRateConnector who should just do what the command line tool did.

so i get the following code in UE.

is this the wrong approach?
Or is it possible to get your code that i can compare what i’ve done wrong since we both tried to get a BLE Heart Rate Monitor working in UE

What I did was create a class that inherits from Unreal Engine’s FRunnable class, which has some thread handling functionality built into it. I used this class to set up communication with the heart rate monitor. I then created a second class which would create an object of the previous class and and get the heart rate from that object. Objects of the second class could be placed in the scene, and they would communicate with Blueprint scripts to get the heart rate.

HeartRateRetriever (Bluetooth implementation that inherits from FRunnable): //HeartRateRetriever.h#pragma once#pragma comment(lib, "SetupAPI")#pra -

HeartRateActorDummy (Class which can be used in scenes): // HeartRateActorDummy.h#pragma once#include "CoreMinimal.h"#include " -

(Bear in mind that my implementation probably isn’t the best way of doing this, it was designed to meet a bare minimum standard of being functional).

I don‘t know how i can thank you. You saved my life, lol.
Using FRunnable and Threads was the exact right direction i needed. Thank you so much!