1.2.2.1.2.4.5 GATTC_DiscoverPrimaryServiceByUUID
C
uint16_t GATTC_DiscoverPrimaryServiceByUUID(uint16_t connHandle, GATTC_DiscoverPrimaryServiceByUuidParams_T *p_discParams);
Description
GATT Client starts the procedure for discovering primary service by UUID within the given input handle range. Multiple instances of the primary service with specified UUID may be present on the GATT server. Hence, the event GATTC_EVT_DISC_PRIM_SERV_BY_UUID_RESP may be generated multiple times until all the service instances are discovered.
Following events may be generated:
Event GATTC_EVT_DISC_PRIM_SERV_BY_UUID_RESP with procedureStatus in GATT_EvtDiscPrimServByUuidResp_T set to continue. This indicates service instance(s) found but the discovery not complete (more instances may be present. See p_attrData in GATT_EvtDiscPrimServByUuidResp_T for extracting service data received.)
Event GATTC_EVT_DISC_PRIM_SERV_BY_UUID_RESP with procedureStatus in GATT_EvtDiscPrimServByUuidResp_T set to Finish. This indicates termination of the procedure (End Group Handle of last found service instance is equal to End handle in input handle range (See GATTC_DiscoverPrimaryServiceByUuidParams_T. p_attrData in GATT_EvtDiscPrimServByUuidResp_T contains the End Group Handle of the service found.)
Event GATTC_EVT_ERROR_RESP with error code ATT_ERRCODE_ATTRIBUTE_NOT_FOUND is generated. This indicates termination of the procedure. (End Group handle of last found service is less that End handle in input handle range)
Events generated
GATTC_EVT_ERROR_RESP Generated when service not found or discovery procedure is end.
GATTC_EVT_DISC_PRIM_SERV_BY_UUID_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. |
[in] p_discParams | Pointer to structure containing the UUID of the primary service and handle range to be queried. |
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. |