BT API support for C++

x_arrange
Posts: 12
Joined: Sat May 20, 2017 10:32 am

BT API support for C++

Postby x_arrange » Mon Aug 26, 2024 6:36 pm

Hi,

Dear IDF authors, this problem exists like since forever.

I wan't to write simple app on C++ but GAP/GATTS API doesn't support it. :cry:
I'm talking about event handlers.

Why esp_event_handler_register has custom arg parameter while neither esp_ble_gap_register_callback nor esp_ble_gatts_register_callback don't?

It's not so hard to add parameter and later call callback handler with it.
Please, add it in future releases

ESP_Sprite
Posts: 9568
Joined: Thu Nov 26, 2015 4:08 am

Re: BT API support for C++

Postby ESP_Sprite » Tue Aug 27, 2024 12:11 am

I agree that it's good practice to have some user pointer in callbacks in general terms, but is it really an issue here? Those callbacks you mention are system-wide (as in: you don't set the callbacks on an object or connection or whatever) so if the callback were to take a user pointer, that pointer would be exactly the same every time the callback would be called. In that case, the user pointer doesn't really add anything: you might as well use a global variable, and that saves the BT code from shuttling around the user pointer.

Who is online

Users browsing this forum: No registered users and 121 guests