GATTC_DiscoverAllPrimaryServices
C
uint16_t GATTC_DiscoverAllPrimaryServices(uint16_t connHandle);
Description
GATT Client starts the discovery of all primary services when this API is called. All primary services in the handle range 0x0001 - 0xFFFF will be discovered with a single call to this API.
The event GATTC_EVT_DISC_PRIM_SERV_RESP may be generated multiple times until all services are discovered.
Following events may be generated on the GATT client:
Event GATTC_EVT_DISC_PRIM_SERV_RESP with procedureStatus in GATT_EvtDiscPrimServResp_T set to continue. This indicates some services are found but the discovery of all services is not complete. (See p_attrData in GATT_EvtDiscPrimServResp_T for extracting service data received.)
Event GATTC_EVT_DISC_PRIM_SERV_RESP with procedureStatus in GATT_EvtDiscPrimServResp_T set to Finish. This indicates termination of the procedure (End Handle for last found service is 0xFFFF. See p_attrData in GATT_EvtDiscPrimServResp_T for End Group Handle of a discovered service)
Event GATTC_EVT_ERROR_RESP with error code ATT_ERR_ATTRIBUTE_NOT_FOUND is generated. This indicates termination of the procedure. (End Group handle of last found service is less that 0xFFFF)
Events generated
GATTC_EVT_ERROR_RESP Generated when service not found or discovery procedure is end.
GATTC_EVT_DISC_PRIM_SERV_RESP Generated when services discovered from remote.
ATT_EVT_TIMEOUT Generated when server does not respond the request.
Parameters
Parameter | Description |
---|---|
[in] connHandle | Handle of the connection to discover the services for. |
Return values
Return value | Description |
---|---|
MBA_RES_SUCCESS | Successfully starts the discovering. |
MBA_RES_OOM | Internal memory allocation failure. |
MBA_RES_INVALID_PARA | Invalid parameters. Connection handle is not valid. |
MBA_RES_BUSY | GATT Client is busy. Another request is ongoing. |