cancel
Showing results for 
Search instead for 
Did you mean: 

How do I handle write operations from client to server?

paul19
Associate III

My project involves a Nucleo-64+X-NUCLEO-BNRG2A1 communicating with an Android phone via Bluetooth.

I successfully sent data from the server (BNRG2A1) to the client (Android phone), but I cannot figure out how to do the same from client to server.

Under Android, I can write data to the characteristic (in NO RESPONSE mode), but I fail to understand how to handle the write operation server-side.

My characteristic is declared as follow:

ret = aci_gatt_add_char(HWServW2STHandle,

UUID_TYPE_128,

&char_uuid,

2+2+4, CHAR_PROP_NOTIFY|CHAR_PROP_READ|CHAR_PROP_WRITE_WITHOUT_RESP,

ATTR_PERMISSION_NONE, GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP|GATT_NOTIFY_ATTRIBUTE_WRITE,

16,

1,

&EnvironmentalCharHandle);

What is it supposed to happen server-side? I've tried to implement aci_gatt_write_permit_req_event(), aci_att_exec_write_resp_event() and aci_gatt_indication_event(), but they are never called. Also, nothing is displayed in the console (with full debug info) when writing data client -> server.

1 ACCEPTED SOLUTION

Accepted Solutions
paul19
Associate III

Found it: I needed to handle the aci_gatt_attribute_modified_event() callback.

View solution in original post

1 REPLY 1
paul19
Associate III

Found it: I needed to handle the aci_gatt_attribute_modified_event() callback.