if (bta_gattc_cache_load(p_clcb)) {
p_clcb->p_srcb->state = BTA_GATTC_SERV_IDLE;
bta_gattc_reset_discover_st(p_clcb->p_srcb, BTA_GATT_OK);
+ //register service change
+ bta_gattc_register_service_change_notify(p_clcb->bta_conn_id, p_clcb->bda);
} else
#endif
{ /* cache is building */
cb_data.write.conn_id = p_clcb->bta_conn_id;
if (p_conn && p_conn->svc_change_descr_handle == cb_data.write.handle) {
if(cb_data.write.status != BTA_GATT_OK) {
+ p_conn->write_remote_svc_change_ccc_done = FALSE;
APPL_TRACE_ERROR("service change write ccc failed");
}
return;
/* if connection available, refresh cache by doing discovery now */
if (p_clcb != NULL) {
+ tBTA_GATTC_CONN *p_conn = bta_gattc_conn_find(p_clcb->bda);
+ if(p_conn) {
+ p_conn->write_remote_svc_change_ccc_done = FALSE;
+ }
bta_gattc_sm_execute(p_clcb, BTA_GATTC_INT_DISCOVER_EVT, NULL);
}
}
tBT_UUID gatt_service_uuid = {LEN_UUID_16, {UUID_SERVCLASS_GATT_SERVER}};
tBT_UUID gatt_service_change_uuid = {LEN_UUID_16, {GATT_UUID_GATT_SRV_CHGD}};
tBT_UUID gatt_ccc_uuid = {LEN_UUID_16, {GATT_UUID_CHAR_CLIENT_CONFIG}};
+ tBTA_GATTC_CONN *p_conn = bta_gattc_conn_find_alloc(remote_bda);
+ if(p_conn && p_conn->write_remote_svc_change_ccc_done) {
+ return SERVICE_CHANGE_CCC_WRITTEN_SUCCESS;
+ }
p_srcb = bta_gattc_find_srcb(remote_bda);
if ((p_srcb != NULL) && (p_srcb->p_srvc_cache != NULL)) {
}
if (gatt_ccc_found == TRUE){
- tBTA_GATTC_CONN *p_conn = bta_gattc_conn_find_alloc(remote_bda);
if (p_conn) {
p_conn->svc_change_descr_handle = p_desc->handle;
+ p_conn->write_remote_svc_change_ccc_done = TRUE;
}
result = SERVICE_CHANGE_CCC_WRITTEN_SUCCESS;
uint16_t indicate_value = GATT_CLT_CONFIG_INDICATION;