You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My setup: Raspberry Pi Pico on Arduino IDE, Board definition github.com/earlephilhower/arduino-pico
This board definition relies on the Arduino port of BTstack. The wrapper and the examples are derived from the files published in port/arduino.
The example port/arduino/examples/LECentral/LECentral.ino uses the function device->subscribeForNotifications() in line 252 to subscribe to notifications. This calls the lower level function BTstackManager::subscribeForNotifications() in line 665 of port/arduino/BTstack.cpp
The subscription is acknowledged, but the callback routine for notifications is not called when the server sends a notification.
Comparing to the example pico_w/bt/standalone/client.c, I find that when subscribing to notifications, an additional function of the BTstack library has to be called: gatt_client_listen_for_characteristic_value_updates() (line 119 of this example). This function, however, is not implemented in port/arduino/BTstack.cpp.
If I add the function gatt_client_listen_for_characteristic_value_updates() to BTstacklib.cpp in a quick and dirty way, the notifications work as expected.
But this is probably not the correct way since there ist some bookkeeping around notification_listener involved in the example client.c mentioned above.
I guess that the solution might be to add the function gatt_client_listen_for_characteristic_value_updates() to BTstacklib.cpp either by adding it to BTstackManager::subscribeForNotifications() or by giving it a separate function definition. I tried both methods and they work. But there ist still the issue of keeping track of notification_listener and call
I posted this issue in earlephilhower/arduino-pico#2231 but later found that the function wrapper is based on the Arduino port of the BTstack library. Therefore, I am posting this issue here, hoping that the experts here can find a proper and reliable solution to this issue.
Thanks!
The text was updated successfully, but these errors were encountered:
I don't have a working setup to test this Arduino wrapper on my desktop (without using hardware) and never tried/played with Arduino on ESP32 or Pico W.
On both platforms, BTstack can be used directly.
Anywya, the missing call to gatt_client_listen_for_characteristic_value_updates has been reported before, but others haven't been able to test changes.
As your quick fix works, please try to add this call to BTstackManager::setup(void) after the call to gatt_client_init():
My setup: Raspberry Pi Pico on Arduino IDE, Board definition github.com/earlephilhower/arduino-pico
This board definition relies on the Arduino port of BTstack. The wrapper and the examples are derived from the files published in port/arduino.
The example port/arduino/examples/LECentral/LECentral.ino uses the function
device->subscribeForNotifications() in line 252 to subscribe to notifications. This calls the lower level function BTstackManager::subscribeForNotifications() in line 665 of port/arduino/BTstack.cpp
The subscription is acknowledged, but the callback routine for notifications is not called when the server sends a notification.
Comparing to the example pico_w/bt/standalone/client.c, I find that when subscribing to notifications, an additional function of the BTstack library has to be called: gatt_client_listen_for_characteristic_value_updates() (line 119 of this example). This function, however, is not implemented in port/arduino/BTstack.cpp.
If I add the function gatt_client_listen_for_characteristic_value_updates() to BTstacklib.cpp in a quick and dirty way, the notifications work as expected.
But this is probably not the correct way since there ist some bookkeeping around notification_listener involved in the example client.c mentioned above.
I guess that the solution might be to add the function gatt_client_listen_for_characteristic_value_updates() to BTstacklib.cpp either by adding it to BTstackManager::subscribeForNotifications() or by giving it a separate function definition. I tried both methods and they work. But there ist still the issue of keeping track of notification_listener and call
gatt_client_stop_listening_for_characteristic_value_updates(¬ification_listener);
when disconnecting from the device.
I posted this issue in earlephilhower/arduino-pico#2231 but later found that the function wrapper is based on the Arduino port of the BTstack library. Therefore, I am posting this issue here, hoping that the experts here can find a proper and reliable solution to this issue.
Thanks!
The text was updated successfully, but these errors were encountered: