Lines Matching full:p_tcb
91 void gatt_free_pending_ind(tGATT_TCB *p_tcb)
95 while (p_tcb->pending_ind_q.p_first)
96 GKI_freebuf (GKI_dequeue (&p_tcb->pending_ind_q));
108 void gatt_free_pending_enc_queue(tGATT_TCB *p_tcb)
112 while (p_tcb->pending_enc_clcb.p_first)
113 GKI_freebuf (GKI_dequeue (&p_tcb->pending_enc_clcb));
214 tGATT_VALUE *gatt_add_pending_ind(tGATT_TCB *p_tcb, tGATT_VALUE *p_ind)
222 GKI_enqueue (&p_tcb->pending_ind_q, p_buf);
739 BOOLEAN gatt_is_srv_chg_ind_pending (tGATT_TCB *p_tcb)
741 tGATT_VALUE *p_buf = (tGATT_VALUE *)GKI_getfirst(&p_tcb->pending_ind_q);
744 GATT_TRACE_DEBUG1("gatt_is_srv_chg_ind_pending is_queue_empty=%d", GKI_queue_is_empty(&p_tcb->pending_ind_q) );
746 if (p_tcb->indicate_handle == gatt_cb.handle_of_h_r)
860 tGATT_TCB *p_tcb = NULL;
863 p_tcb = &gatt_cb.tcb[tcb_idx];
865 return p_tcb;
879 tGATT_TCB *p_tcb = NULL;
883 p_tcb = &gatt_cb.tcb[i];
885 return p_tcb;
923 tGATT_TCB *p_tcb = NULL;
935 p_tcb = &gatt_cb.tcb[i];
939 memset(p_tcb, 0, sizeof(tGATT_TCB));
940 GKI_init_q (&p_tcb->pending_enc_clcb);
941 GKI_init_q (&p_tcb->pending_ind_q);
942 p_tcb->in_use = TRUE;
943 p_tcb->tcb_idx = i;
945 memcpy(p_tcb->peer_bda, bda, BD_ADDR_LEN);
947 return p_tcb;
1119 void gatt_start_rsp_timer(tGATT_TCB *p_tcb)
1121 p_tcb->rsp_timer_ent.param = (TIMER_PARAM_TYPE)p_tcb;
1122 btu_start_timer (&p_tcb->rsp_timer_ent, BTU_TTYPE_ATT_WAIT_FOR_RSP,
1134 void gatt_start_conf_timer(tGATT_TCB *p_tcb)
1136 p_tcb->conf_timer_ent.param = (TIMER_PARAM_TYPE)p_tcb;
1137 btu_start_timer (&p_tcb->conf_timer_ent, BTU_TTYPE_ATT_WAIT_FOR_RSP,
1149 void gatt_start_ind_ack_timer(tGATT_TCB *p_tcb)
1151 p_tcb->ind_ack_timer_ent.param = (TIMER_PARAM_TYPE)p_tcb;
1153 btu_start_timer (&p_tcb->ind_ack_timer_ent, BTU_TTYPE_ATT_WAIT_FOR_IND_ACK,
1183 tGATT_TCB * p_tcb = (tGATT_TCB *)p_tle->param;
1187 if (p_tcb != NULL)
1188 p_tcb->ind_count = 0;
1354 tGATT_STATUS gatt_send_error_rsp (tGATT_TCB *p_tcb, UINT8 err_code, UINT8 op_code,
1365 if ((p_buf = attp_build_sr_msg(p_tcb, GATT_RSP_ERROR, (tGATT_SR_MSG *)&error)) != NULL)
1367 status = attp_send_sr_msg (p_tcb, p_buf);
1373 gatt_dequeue_sr_cmd(p_tcb);
1527 tGATT_TCB *p_tcb = gatt_get_tcb_by_idx(tcb_idx);
1540 p_clcb->p_tcb = p_tcb;
1579 tGATT_TCB *p_tcb = NULL;
1585 p_tcb = &gatt_cb.tcb[xx];
1589 return p_tcb;
1602 UINT8 gatt_num_apps_hold_link(tGATT_TCB *p_tcb)
1608 if (p_tcb->app_hold_link[i])
1632 if (gatt_cb.clcb[i].in_use && memcmp(gatt_cb.clcb[i].p_tcb->peer_bda, bda, BD_ADDR_LEN) == 0)
1647 void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb )
1651 if (p_tcb)
1655 if (p_tcb->prep_cnt[i])
1657 p_tcb->sr_cmd.cback_cnt[i]=1;
1673 BOOLEAN gatt_sr_is_cback_cnt_zero(tGATT_TCB *p_tcb )
1678 if (p_tcb)
1682 if (p_tcb->sr_cmd.cback_cnt[i])
1705 BOOLEAN gatt_sr_is_prep_cnt_zero(tGATT_TCB *p_tcb)
1710 if (p_tcb)
1714 if (p_tcb->prep_cnt[i])
1738 void gatt_sr_reset_cback_cnt(tGATT_TCB *p_tcb )
1742 if (p_tcb)
1746 p_tcb->sr_cmd.cback_cnt[i]=0;
1760 void gatt_sr_reset_prep_cnt(tGATT_TCB *p_tcb )
1763 if (p_tcb)
1767 p_tcb->prep_cnt[i]=0;
1782 void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc, BOOLEAN is_reset_first)
1787 if (p_tcb)
1791 gatt_sr_reset_cback_cnt(p_tcb);
1795 p_tcb->sr_cmd.cback_cnt[idx]++;
1799 if ( p_tcb->sr_cmd.cback_cnt[idx])
1801 p_tcb->sr_cmd.cback_cnt[idx]--;
1817 void gatt_sr_update_prep_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc, BOOLEAN is_reset_first)
1822 p_tcb->tcb_idx, gatt_if, is_inc, is_reset_first);
1824 if (p_tcb)
1828 gatt_sr_reset_prep_cnt(p_tcb);
1832 p_tcb->prep_cnt[idx]++;
1836 if (p_tcb->prep_cnt[idx])
1838 p_tcb->prep_cnt[idx]--;
1854 tGATT_TCB *p_tcb=NULL;
1857 p_tcb = gatt_find_tcb_by_addr(bda);
1858 if (p_tcb)
1860 if (gatt_get_ch_state(p_tcb) == GATT_CH_OPEN)
1867 gatt_update_app_use_link_flag(gatt_if, p_tcb, FALSE, FALSE);
1868 if (!gatt_num_apps_hold_link(p_tcb))
1870 gatt_disconnect(p_tcb->peer_bda);
1887 BOOLEAN gatt_find_app_hold_link(tGATT_TCB *p_tcb, UINT8 start_idx, UINT8 *p_found_idx, tGATT_IF *p_gatt_if)
1894 if (p_tcb->app_hold_link[i])
1914 BOOLEAN gatt_cmd_enq(tGATT_TCB *p_tcb, UINT16 clcb_idx, BOOLEAN to_send, UINT8 op_code, BT_HDR *p_buf)
1916 tGATT_CMD_Q *p_cmd = &p_tcb->cl_cmd_q[p_tcb->next_slot_inq];
1925 p_tcb->pending_cl_req = p_tcb->next_slot_inq;
1928 p_tcb->next_slot_inq ++;
1929 p_tcb->next_slot_inq %= GATT_CL_MAX_LCB;
1943 tGATT_CLCB * gatt_cmd_dequeue(tGATT_TCB *p_tcb, UINT8 *p_op_code)
1945 tGATT_CMD_Q *p_cmd = &p_tcb->cl_cmd_q[p_tcb->pending_cl_req];
1948 if (p_tcb->pending_cl_req != p_tcb->next_slot_inq)
1954 p_tcb->pending_cl_req ++;
1955 p_tcb->pending_cl_req %= GATT_CL_MAX_LCB;
1970 UINT8 gatt_send_write_msg (tGATT_TCB *p_tcb, UINT16 clcb_idx, UINT8 op_code,
1983 return attp_send_cl_msg(p_tcb, clcb_idx, op_code, &msg);
1996 UINT8 gatt_act_send_browse(tGATT_TCB *p_tcb, UINT16 index, UINT8 op, UINT16 s_handle,
2006 return attp_send_cl_msg(p_tcb, index, op, &msg);
2061 cb_data.mtu = p_clcb->p_tcb->payload_size;
2100 tGATT_TCB *p_tcb = NULL;
2109 if ((p_tcb = gatt_find_tcb_by_addr(bda)) != NULL)
2111 GATT_TRACE_DEBUG0 ("found p_tcb ");
2115 if (p_clcb->in_use && p_clcb->p_tcb == p_tcb)
2126 btu_stop_timer (&p_tcb->rsp_timer_ent);
2127 btu_stop_timer (&p_tcb->ind_ack_timer_ent);
2128 btu_stop_timer (&p_tcb->conf_timer_ent);
2129 gatt_free_pending_ind(p_tcb);
2130 gatt_free_pending_enc_queue(p_tcb);
2137 conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, p_reg->gatt_if);
2138 GATT_TRACE_DEBUG3 ("found p_reg tcb_idx=%d gatt_if=%d conn_id=0x%x", p_tcb->tcb_idx, p_reg->gatt_if, conn_id);
2142 memset(p_tcb, 0, sizeof(tGATT_TCB));
2373 tGATT_TCB *p_tcb = gatt_find_tcb_by_addr(bd_addr);
2376 if (p_tcb)
2377 gatt_update_app_use_link_flag(gatt_if, p_tcb, FALSE, FALSE);
2595 tGATT_TCB *p_tcb = gatt_find_tcb_by_addr(bd_addr);
2609 if (ret && p_tcb != NULL)
2612 gatt_update_app_use_link_flag(gatt_if, p_tcb, TRUE, TRUE);
2641 tGATT_TCB *p_tcb;
2646 if ((p_tcb = gatt_find_tcb_by_addr(bd_addr)) == NULL)
2662 if ( p_clcb->in_use && (p_clcb->p_reg == p_reg) && (p_clcb->p_tcb == p_tcb) )
2681 tGATT_PENDING_ENC_CLCB* gatt_add_pending_enc_channel_clcb(tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb )
2690 GKI_enqueue (&p_tcb->pending_enc_clcb, p_buf);