[SOLVED] WINAPI/BluetoothAPIs.dll - call BluetoothGATTRegisterEvent - refer args?

07/20/2017 09:02 IceTrailer#1
Hello guys,

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 [Only registered and activated users can see links. Click Here To Register...] and tried to fix all syntax errors using the Visual Studio IDE.

[Only registered and activated users can see links. Click Here To Register...].

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".
[Only registered and activated users can see links. Click Here To Register...]

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);
to this
Code:
                hr = BluetoothGATTRegisterEvent(
                hLEDevice,
                EventType,
                &EventParameterIn,
               (PFNBLUETOOTH_GATT_EVENT_CALLBACK)SomethingHappened,
                NULL,
                &EventHandle,
                BLUETOOTH_GATT_FLAG_NONE);
did it.

Can get closed.