What happend with BLE StringsReceived

While I'm learning to work with the wonderful MIT Inventor APP
I found and old app what uses a BLE StringsReceived brick.
Will this not supported in the future anymore It would be perfect to have a BLE Callback function
and not a polling solution.

The StringsReceived block is in the current version of the BLE extension.


1 Like

is it possible to make a Callback function with StringReceived?

I tried it with RegisterforStrings but this does not work
this works

how get I RegisterforStrings work.

Does the device in question provide notifications for that (service, characteristic) pair? If not, RegisterForStrings won't work for you. It needs the device to notify when they change, it isn't a polling operation.

Thank you ewpatton
I don't understand Does the device in question is that my smartphone ?

The device in question is the BLE peripheral that you are trying to read strings from/request notifications from.

BLE characteristics can have 5 different types, read, notify, indicate, write, and write with response (and combinations of these). It may be the case that the BLE device you are connecting to only supports reading that characteristic and not notifications. In that case, you would need to continually call ReadStrings. If the device does support notify on that characteristic, then RegisterForStrings will register with Android's BLE apis that it wants notifications when the value changes. If the value doesn't change frequently, you may want to do a ReadStrings followed by a RegisterForStrings in order to read the current value and then be notified of future changes. If you tell us more about the device you're trying to connect to with BLE we might be able to give more specific advice than that.

Thanks a lot ewpatton I use a Android Smartphone to receive and an esp32 to transmit.
I have nRF Connet installed and it tells me that I can read and write
so what I need is a notify event is that right. I think now I get it

Yes, that's correct. nRF Connect should tell you that the characteristic can be used to notify (IIRC it provides a (N) icon you can turn on to get updates from the device).

It's working now but the MTU is shorter so I have to fix my JSon Data, when the whole Project it's working , I will post the Solution right here. I'm so happy that the callback is working

Interesting that it changed the size of the MTU... If you have a BLE 5 capable device you may want to try the method to request a larger MTU.

Check this out the whole Project

So with BLE 5 we have a larger MTU But I think the limitation is the ESP32 but I'm not sure
ewpaton could you change the Name of the Topic "ESP32 BLE and Callback "