{
UNUSED(gatt_if);
- GATT_TRACE_EVENT ("%s: from %08x%04x connected:%d conn_id=%d reason = 0x%04x", __FUNCTION__,
- (bda[0]<<24)+(bda[1]<<16)+(bda[2]<<8)+bda[3],
- (bda[4]<<8)+bda[5], connected, conn_id, reason);
+ GATT_TRACE_EVENT("%s: from %08x%04x connected:%d conn_id=%d reason = 0x%04x", __func__,
+ (bda[0]<<24)+(bda[1]<<16)+(bda[2]<<8)+bda[3],
+ (bda[4]<<8)+bda[5], connected, conn_id, reason);
tGATT_PROFILE_CLCB *p_clcb = gatt_profile_find_clcb_by_bd_addr(bda, transport);
- if (p_clcb == NULL)
- return;
+ if (connected) {
+ if (p_clcb == NULL)
+ p_clcb = gatt_profile_clcb_alloc(conn_id, bda, transport);
- if (connected)
- {
- p_clcb->conn_id = conn_id;
- p_clcb->connected = TRUE;
+ if (p_clcb == NULL)
+ return;
- if (p_clcb->ccc_stage == GATT_SVC_CHANGED_CONNECTING)
- {
- p_clcb->ccc_stage ++;
- gatt_cl_start_config_ccc(p_clcb);
- }
+ p_clcb->connected = TRUE;
+ p_clcb->ccc_stage = GATT_SVC_CHANGED_SERVICE;
+ gatt_cl_start_config_ccc(p_clcb);
} else {
- gatt_profile_clcb_dealloc(p_clcb);
+ if (p_clcb != NULL)
+ gatt_profile_clcb_dealloc(p_clcb);
}
}
**
*******************************************************************************/
static void gatt_cl_op_cmpl_cback (UINT16 conn_id, tGATTC_OPTYPE op,
- tGATT_STATUS status, tGATT_CL_COMPLETE *p_data)
+ tGATT_STATUS status, tGATT_CL_COMPLETE *p_data)
{
- tGATT_PROFILE_CLCB *p_clcb = gatt_profile_find_clcb_by_conn_id(conn_id);
-
- if (p_clcb == NULL)
- return;
-
- if (op == GATTC_OPTYPE_WRITE)
- {
- GATT_TRACE_DEBUG("%s() - ccc write status : %d", __FUNCTION__, status);
- }
-
- /* free the connection */
- gatt_config_ccc_complete (p_clcb);
+ UNUSED(conn_id);
+ UNUSED(op);
+ UNUSED(status);
+ UNUSED(p_data);
}
/*******************************************************************************