BLE GATTC subscribe characteristic for indicate

#1

Hi all,

I need to subscribe a BLE characteristic for ‘indicate’ and think, this must be possible without a fortnight full of work! Mongoose does provide subscription for ‘notify’ only, as far as I know …

Can anybody help me?

Thanks a lot
Rolf

#2

I will try…
So your ESP32 is the client ?
You want a BLE client to subscribe to some characteristic on some server in order to get a notification. Is that the point ?
Mongoose-OS BLE implementation is mostly a wrapper over Espressif IDF, as the ESP32 so far is the only chip supported (or at least so it was the last time I checked). Whatever you don’t find in MOS you can directly use on the IDF, if available.
So far, if things haven’t changed, the available API in MOS is a BLE server, here.
The full Bluetooth API in the IDF you’ll find here, while the specific client API is here. To use IDF functions from within MOS you can call them directly in C (and either ffi or provide a ffi-able C alternative from your code to use them in mJS). See an example here.

#3

Hi Scaprile,
Thanks for your inputs!
But my problem is, that the function ‘mgos_bt_gattc_subscribe(…)’ subscribes for ‘notify’ only. To have a subscription for ‘indicate’, I need either to change/extend this function or another function doing my job.
My question now is: How can I change/extend the Mongoose library to do what I need?
Kind regards
Rolf

#4

One of the links I shared is a pull request in where I shared to the community the way I extended one of the Mongoose-OS libraries…
You basically develop the code and when you are certain it works you fork the library, branch, add the changes, commit, push and then generate a pull request asking the maintainers to add it. There are github docs on how to do that.
You can also develop your own libraries or you can share your own version of a library somewhere else as I did. If you do the latter, don’t fork the repo, create a new one from scratch and manually copy the files; otherwise mos manages to find the original library.