1 of 1 people found this helpful
There may be orthogonal events like authentication requests, MTU exchange requests, etc. that can occurr, but generally
You need to make sure that your characteristic is allowed for reading based on the configuration settings of authentication, encryption, etc.
Afaik, you shouldn't need to explicitly handle the read request from the android phone in your callback if you have it setup properly. The DB on the BLE peripheral device should be sending the value upon request if allowed. Can you tell us what you have tried? Or what issues you are running into specifically?
While looking for above issue i get some solutions but they(solutions) come with some more queries.
CYBLE_EVT_GATTS_WRITE_REQ event is responsible for writing data from ble client to ble server.
CyBle_GattsWriteAttributeValue() with this function we can write attribute value to server database what ever we got from client.
Now,BLE comonent Datasheet says that
CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ event will be called when client initiates read request.
CyBle_GattsReadAttributeValue() will be used to read attribute value from database.
I am able to READ attribute value from server database without above mentioned event as well as CyBle_GattsReadAttributeValue().
Please correct me if there is any misunderstanding with me.
1. yes, the CYBLE_EVT_GATTS_WRITE_REQ event is what you handle for writing values received from the Client onto the Server GATT DB.
2. CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ only occurs when the characteristic:
/** Event parameter type is CYBLE_GATTS_CHAR_VAL_READ_REQ_T. It is triggered on server side
when client sends read request and when characteristic has CYBLE_GATT_DB_ATTR_CHAR_VAL_RD_EVENT
property set. This event could be ignored by application unless it need to response by error response which
needs to be set in gattErrorCode field of event parameter. */
Thus, you only need to handle the read event if you set the characteristic to require permissions of authentication or encryption for the client to access it.
So you got one of the two correct