GATTC_Read
C
uint16_t GATTC_Read(uint16_t connHandle, uint16_t charHandle, uint16_t valueOffset);
Description
Initiates a read operation from the GATT Client to the GATT Server.
Note
This API is used to read a Characteristic Value or a Characteristic Descriptor. - For non-long attributes, set valueOffset to 0. A Read Request is sent. - For long attributes, read the first (ATT_MTU-1) bytes with valueOffset set to 0. Subsequent bytes are read with a non-zero valueOffset using Read Blob Requests. Continue issuing GATTC_Read with updated offsets upon receiving each GATTC_EVT_READ_RESP until the entire attribute is read.
Events generated
GATTC_EVT_ERROR_RESP is generated when Read operation failed.
GATTC_EVT_READ_RESP is generated when ead operation successful.
ATT_EVT_TIMEOUT is generated when no response from the server.
Parameters
Parameter | Description |
---|---|
[in] connHandle | Handle of the connection to send read operation. |
[in] charHandle | The handle of the characteristic or descriptor to read. |
[in] valueOffset | The offset for a Read Blob Request. Set to 0 for a normal Read Request. |
Return values
Return value | Description |
---|---|
MBA_RES_SUCCESS | Successfully starts the read operation. |
MBA_RES_OOM | Memory allocation failure occurred internally. |
MBA_RES_INVALID_PARA | Invalid parameters, such as an invalid connection handle. |
MBA_RES_BUSY | GATT Client is busy with another ongoing request. |