Page 1 of 1

Can a BLE Client send back messages after a connection with a server?

Posted: Mon Aug 12, 2024 9:01 am
by Bob@63
Hi, I'm new of this forum and I don't have a long experience with ESP32.
For a my project I've implemented in Micropython on two ESP32-C3 a BLE server with two buttons that based on which button is pressed send two different commands to a BLE client that then drive two different strips of ws2812 led.

Both codes seems work quite well but the problem is that sometime also if the buttons are pressed
and the relative isr is activated , for some reason the client dosen't receive any command.

Due that I must be sure the the command is received I would like implement on the client a sort
of aknoledge message to be sent back to the server as confirmation of received command , and in case the server
dosen't receive an aknoledge within a certain time send the same command again.

To do that I've implemented in both side (client and server ) two additional characteristics to be used only
to communicate/recive the ack message . On the Client code I simply write a value in the characteristic ,
as is

Code: Select all

left_characteristic_ACK.write(b'ok_l', send_update=True)
but I'm not able to see any ack message on the server side and i get aslways a "None" a resul tothe read the ack characteristic .

I've also tried to encode the ack message in UTF-8 without any change

Now my doubt is if the client after have estabilished the connection with the server can send back some data to the server or the data flow must always go from server side to client.

If usefull I can post the omplete codes.

Tks.