I have the task to communicate with a bluetooth low energy (BLE) device using the PC.
Apart from my bad UWP knowledge, I would appreciate using C++ /WINAPI in this case (although I did not really work with WINAPI before).
I picked some code
and tried to fix all syntax errors using the Visual Studio IDE.
.Unfortunately there is one error I don't know how to fix it:
Quote:
C2664 (HRESULT BluetoothGATTRegisterEvent(HANDLE,BTH_LE_GATT_EVEN T_TYPE,PVOID,PFNBLUETOOTH_GATT_EVENT_CALLBACK,PVOI D,BLUETOOTH_GATT_EVENT_HANDLE *,ULONG)" : Cannot convert argument 4 from "void (__cdecl *)(BTH_LE_GATT_EVENT_TYPE,PVOID,PVOID)" to "PFNBLUETOOTH_GATT_EVENT_CALLBACK".

Do you have any approaches to help me?
Best regards
Solved.
After multiple approaches using trial and error, I found the solution.
A simple cast fixed the error.
From this
Code:
hr = BluetoothGATTRegisterEvent(
hLEDevice,
EventType,
&EventParameterIn,
SomethingHappened,
NULL,
&EventHandle,
BLUETOOTH_GATT_FLAG_NONE);
Code:
hr = BluetoothGATTRegisterEvent(
hLEDevice,
EventType,
&EventParameterIn,
(PFNBLUETOOTH_GATT_EVENT_CALLBACK)SomethingHappened,
NULL,
&EventHandle,
BLUETOOTH_GATT_FLAG_NONE);
Can get closed.







