2019-05-06 12:50 AM
Hi everyone,
I'm working with an steval bluemic-1 board and a nucleo with x-nucleo-idb05a1 expansion. For the moment i'm only able to notify a characteristic, but now i also want to read or write. bluemic-1 is the server, i want to receive the read request, update the characteristic and then allow the gatt to send the response. What i did since now is adding the characteristic as the following:
aci_gatt_add_char(service_handle,
UUID_TYPE_128,
(Char_UUID_t *) my_UUID,
8,
CHAR_PROP_READ,
ATTR_PERMISSION_NONE,
GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP,
16,
1,
(uint16_t*)&AccHandle);
As you can see i use the "CHAR_PROP_READ" to set it as readable and "GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP" to be notified when a read occurs. Then i implement the "aci_gatt_read_permit_req_event" (that should be given to the application when a read request is received if i'm not wrong) in which i update my characteristic using the "aci_gatt_update_char_value" and then i allow the gatt to response using the "aci_gatt_allow_read". On the client, when i press the user button i send a read request using the "aci_gatt_read_charac_val". Debugging i see that on the client the read request starts correctly, but on the server side i didn't receive the "aci_gatt_read_permit_req_event". In a similar way if i add the characteristic using "CHAR_PROP_WRITE", sending an "aci_gatt_write_charac_descriptor" (from the client), i didn't receive the "aci_gatt_attribute_modified_event" on the server. I noticed that i receive that event only if i set the characteristic as "CHAR_PROP_NOTIFY".
What's wrong in my project? how can i read/write a characteristic?
Thanks
Enrico