Can somebody please look for me at the function declaration of procedure NotificationCallback() in System.Win.Bluetooth.pas for Delphi XE8 or XE10?

Can somebody please look for me at the function declaration of procedure NotificationCallback() in System.Win.Bluetooth.pas for Delphi XE8 or XE10?

It should be declared as stdcall but is actually cdecl in the file shipped with DX7.1, which triggers an annoying stack overflow when you use BluetoothLE GATT notifications. When lowering stack size to 64KB, I managed to get the overflow in about 15 seconds of full BLE data traffic -  a bit less than 5000 notifications.

M$ documentation is not helpful either, but there is example code that uses WINAPI for this callback.

Background (EDN login required):
https://quality.embarcadero.com/browse/RSP-11715


#Delphi #BluetoothLowEnergy  
https://code.msdn.microsoft.com/windowsapps/Windows-Driver-Kit-WDK-80-e3161626/sourcecode?fileId=92302&pathId=1810634922

Comments

  1. Jörg Fischer It is "cdecl" in both XE8.1 and #D10Seattle.

    ReplyDelete
  2. Hi Jörg, did you ever find a fix/work around for this? I have a Win32 app written with XE7 that connects to an AckMe BLE device and once the Callback function executes I receive the event and get the data from the characteristic but then my app crashes. If I do nothing in the callback event it still crashes. If I continually poll the characteristic I get 20 bytes of 0 data. Any thoughts?

    ReplyDelete

Post a Comment