Lines Matching refs:p_ccb
49 static void avdt_ccb_clear_ccb(AvdtpCcb* p_ccb) { in avdt_ccb_clear_ccb() argument
53 p_ccb->cong = false; in avdt_ccb_clear_ccb()
54 p_ccb->ret_count = 0; in avdt_ccb_clear_ccb()
57 osi_free_and_reset((void**)&p_ccb->p_curr_msg); in avdt_ccb_clear_ccb()
60 osi_free_and_reset((void**)&p_ccb->p_rx_msg); in avdt_ccb_clear_ccb()
63 while ((p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->rsp_q)) != NULL) in avdt_ccb_clear_ccb()
78 void avdt_ccb_chan_open(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_chan_open() argument
79 BTM_SetOutService(p_ccb->peer_addr, BTM_SEC_SERVICE_AVDTP, AVDT_CHAN_SIG); in avdt_ccb_chan_open()
80 avdt_ad_open_req(AVDT_CHAN_SIG, p_ccb, NULL, AVDT_INT); in avdt_ccb_chan_open()
94 void avdt_ccb_chan_close(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_chan_close() argument
96 avdt_ad_close_req(AVDT_CHAN_SIG, p_ccb, NULL); in avdt_ccb_chan_close()
110 void avdt_ccb_chk_close(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_chk_close() argument
112 AvdtpScb* p_scb = &(p_ccb->scb[0]); in avdt_ccb_chk_close()
116 if ((p_scb->allocated) && (p_scb->p_ccb == p_ccb)) { in avdt_ccb_chk_close()
123 alarm_cancel(p_ccb->ret_ccb_timer); in avdt_ccb_chk_close()
124 alarm_cancel(p_ccb->rsp_ccb_timer); in avdt_ccb_chk_close()
126 alarm_set_on_mloop(p_ccb->idle_ccb_timer, interval_ms, in avdt_ccb_chk_close()
127 avdt_ccb_idle_ccb_timer_timeout, p_ccb); in avdt_ccb_chk_close()
144 void avdt_ccb_hdl_discover_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_discover_cmd() argument
146 AvdtpScb* p_scb = &(p_ccb->scb[0]); in avdt_ccb_hdl_discover_cmd()
148 AVDT_TRACE_DEBUG("%s: p_ccb index=%d", __func__, avdt_ccb_to_idx(p_ccb)); in avdt_ccb_hdl_discover_cmd()
169 avdt_ccb_event(p_ccb, AVDT_CCB_API_DISCOVER_RSP_EVT, p_data); in avdt_ccb_hdl_discover_cmd()
184 void avdt_ccb_hdl_discover_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_discover_rsp() argument
186 p_ccb->proc_busy = false; in avdt_ccb_hdl_discover_rsp()
189 (*p_ccb->proc_cback)(0, p_ccb->peer_addr, AVDT_DISCOVER_CFM_EVT, in avdt_ccb_hdl_discover_rsp()
191 p_ccb->BtaAvScbIndex()); in avdt_ccb_hdl_discover_rsp()
207 void avdt_ccb_hdl_getcap_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_getcap_cmd() argument
215 avdt_ccb_event(p_ccb, AVDT_CCB_API_GETCAP_RSP_EVT, p_data); in avdt_ccb_hdl_getcap_cmd()
230 void avdt_ccb_hdl_getcap_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_getcap_rsp() argument
232 p_ccb->proc_busy = false; in avdt_ccb_hdl_getcap_rsp()
235 (*p_ccb->proc_cback)(0, p_ccb->peer_addr, AVDT_GETCAP_CFM_EVT, in avdt_ccb_hdl_getcap_rsp()
237 p_ccb->BtaAvScbIndex()); in avdt_ccb_hdl_getcap_rsp()
253 void avdt_ccb_hdl_start_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_start_cmd() argument
258 avdt_scb_verify(p_ccb, AVDT_VERIFY_START, p_data->msg.multi.seid_list, in avdt_ccb_hdl_start_cmd()
262 avdt_ccb_event(p_ccb, AVDT_CCB_API_START_RSP_EVT, p_data); in avdt_ccb_hdl_start_cmd()
267 avdt_msg_send_rej(p_ccb, AVDT_SIG_START, &p_data->msg); in avdt_ccb_hdl_start_cmd()
284 void avdt_ccb_hdl_start_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_start_rsp() argument
295 p = (uint8_t*)(p_ccb->p_curr_cmd + 1); in avdt_ccb_hdl_start_rsp()
298 for (i = 0; i < p_ccb->p_curr_cmd->len; i++) { in avdt_ccb_hdl_start_rsp()
320 void avdt_ccb_hdl_suspend_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_suspend_cmd() argument
325 if ((seid = avdt_scb_verify(p_ccb, AVDT_VERIFY_SUSPEND, in avdt_ccb_hdl_suspend_cmd()
330 avdt_ccb_event(p_ccb, AVDT_CCB_API_SUSPEND_RSP_EVT, p_data); in avdt_ccb_hdl_suspend_cmd()
335 avdt_msg_send_rej(p_ccb, AVDT_SIG_SUSPEND, &p_data->msg); in avdt_ccb_hdl_suspend_cmd()
354 void avdt_ccb_hdl_suspend_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_hdl_suspend_rsp() argument
365 p = (uint8_t*)(p_ccb->p_curr_cmd + 1); in avdt_ccb_hdl_suspend_rsp()
368 for (i = 0; i < p_ccb->p_curr_cmd->len; i++) { in avdt_ccb_hdl_suspend_rsp()
389 void avdt_ccb_snd_discover_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_discover_cmd() argument
391 p_ccb->p_proc_data = p_data->discover.p_sep_info; in avdt_ccb_snd_discover_cmd()
392 p_ccb->proc_cback = p_data->discover.p_cback; in avdt_ccb_snd_discover_cmd()
393 p_ccb->proc_param = p_data->discover.num_seps; in avdt_ccb_snd_discover_cmd()
396 p_ccb->proc_busy = true; in avdt_ccb_snd_discover_cmd()
399 avdt_msg_send_cmd(p_ccb, NULL, AVDT_SIG_DISCOVER, NULL); in avdt_ccb_snd_discover_cmd()
414 void avdt_ccb_snd_discover_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_discover_rsp() argument
416 avdt_msg_send_rsp(p_ccb, AVDT_SIG_DISCOVER, &p_data->msg); in avdt_ccb_snd_discover_rsp()
432 void avdt_ccb_snd_getcap_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_getcap_cmd() argument
436 p_ccb->p_proc_data = p_data->getcap.p_cfg; in avdt_ccb_snd_getcap_cmd()
437 p_ccb->proc_cback = p_data->getcap.p_cback; in avdt_ccb_snd_getcap_cmd()
440 p_ccb->proc_busy = true; in avdt_ccb_snd_getcap_cmd()
446 avdt_msg_send_cmd(p_ccb, NULL, sig_id, (tAVDT_MSG*)&p_data->getcap.single); in avdt_ccb_snd_getcap_cmd()
461 void avdt_ccb_snd_getcap_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_getcap_rsp() argument
468 avdt_msg_send_rsp(p_ccb, sig_id, &p_data->msg); in avdt_ccb_snd_getcap_rsp()
484 void avdt_ccb_snd_start_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_start_cmd() argument
497 avdt_scb_verify(p_ccb, AVDT_VERIFY_OPEN, p_data->msg.multi.seid_list, in avdt_ccb_snd_start_cmd()
506 avdt_msg_send_cmd(p_ccb, seid_list, AVDT_SIG_START, &p_data->msg); in avdt_ccb_snd_start_cmd()
534 void avdt_ccb_snd_start_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_start_rsp() argument
539 avdt_msg_send_rsp(p_ccb, AVDT_SIG_START, &p_data->msg); in avdt_ccb_snd_start_rsp()
564 void avdt_ccb_snd_suspend_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_suspend_cmd() argument
575 avdt_scb_verify(p_ccb, AVDT_VERIFY_STREAMING, p_data->msg.multi.seid_list, in avdt_ccb_snd_suspend_cmd()
582 avdt_msg_send_cmd(p_ccb, seid_list, AVDT_SIG_SUSPEND, &p_data->msg); in avdt_ccb_snd_suspend_cmd()
609 void avdt_ccb_snd_suspend_rsp(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_suspend_rsp() argument
614 avdt_msg_send_rsp(p_ccb, AVDT_SIG_SUSPEND, &p_data->msg); in avdt_ccb_snd_suspend_rsp()
639 void avdt_ccb_clear_cmds(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_clear_cmds() argument
641 AvdtpScb* p_scb = &(p_ccb->scb[0]); in avdt_ccb_clear_cmds()
645 avdt_ccb_clear_ccb(p_ccb); in avdt_ccb_clear_cmds()
655 avdt_ccb_cmd_fail(p_ccb, &avdt_ccb_evt); in avdt_ccb_clear_cmds()
658 p_ccb->p_curr_cmd = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->cmd_q); in avdt_ccb_clear_cmds()
660 } while (p_ccb->p_curr_cmd != NULL); in avdt_ccb_clear_cmds()
664 if ((p_scb->allocated) && (p_scb->p_ccb == p_ccb)) { in avdt_ccb_clear_cmds()
682 void avdt_ccb_cmd_fail(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_cmd_fail() argument
687 if (p_ccb->p_curr_cmd != NULL) { in avdt_ccb_cmd_fail()
691 msg.hdr.ccb_idx = avdt_ccb_to_idx(p_ccb); in avdt_ccb_cmd_fail()
694 evt = avdt_msg_rej_2_evt[p_ccb->p_curr_cmd->event - 1]; in avdt_ccb_cmd_fail()
699 avdt_ccb_event(p_ccb, (uint8_t)(evt & ~AVDT_CCB_MKR), &avdt_ccb_evt); in avdt_ccb_cmd_fail()
702 p_scb = avdt_scb_by_hdl(*((uint8_t*)(p_ccb->p_curr_cmd + 1))); in avdt_ccb_cmd_fail()
710 osi_free_and_reset((void**)&p_ccb->p_curr_cmd); in avdt_ccb_cmd_fail()
725 void avdt_ccb_free_cmd(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_free_cmd() argument
726 osi_free_and_reset((void**)&p_ccb->p_curr_cmd); in avdt_ccb_free_cmd()
740 void avdt_ccb_cong_state(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_cong_state() argument
741 p_ccb->cong = p_data->llcong; in avdt_ccb_cong_state()
757 void avdt_ccb_ret_cmd(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_ret_cmd() argument
758 p_ccb->ret_count++; in avdt_ccb_ret_cmd()
759 if (p_ccb->ret_count == AVDT_RET_MAX) { in avdt_ccb_ret_cmd()
761 p_ccb->ret_count = 0; in avdt_ccb_ret_cmd()
764 avdt_ccb_cmd_fail(p_ccb, &avdt_ccb_evt); in avdt_ccb_ret_cmd()
767 avdt_ccb_snd_cmd(p_ccb, p_data); in avdt_ccb_ret_cmd()
770 if ((!p_ccb->cong) && (p_ccb->p_curr_msg == NULL) && in avdt_ccb_ret_cmd()
771 (p_ccb->p_curr_cmd != NULL)) { in avdt_ccb_ret_cmd()
774 memcpy(p_msg, p_ccb->p_curr_cmd, in avdt_ccb_ret_cmd()
775 (sizeof(BT_HDR) + p_ccb->p_curr_cmd->offset + in avdt_ccb_ret_cmd()
776 p_ccb->p_curr_cmd->len)); in avdt_ccb_ret_cmd()
777 avdt_msg_send(p_ccb, p_msg); in avdt_ccb_ret_cmd()
781 alarm_cancel(p_ccb->idle_ccb_timer); in avdt_ccb_ret_cmd()
782 alarm_cancel(p_ccb->rsp_ccb_timer); in avdt_ccb_ret_cmd()
784 alarm_set_on_mloop(p_ccb->ret_ccb_timer, interval_ms, in avdt_ccb_ret_cmd()
785 avdt_ccb_ret_ccb_timer_timeout, p_ccb); in avdt_ccb_ret_cmd()
800 void avdt_ccb_snd_cmd(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_cmd() argument
806 if ((!p_ccb->cong) && (p_ccb->p_curr_msg == NULL) && in avdt_ccb_snd_cmd()
807 (p_ccb->p_curr_cmd == NULL)) { in avdt_ccb_snd_cmd()
808 p_msg = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->cmd_q); in avdt_ccb_snd_cmd()
811 p_ccb->p_curr_cmd = (BT_HDR*)osi_malloc(AVDT_CMD_BUF_SIZE); in avdt_ccb_snd_cmd()
812 memcpy(p_ccb->p_curr_cmd, p_msg, in avdt_ccb_snd_cmd()
814 avdt_msg_send(p_ccb, p_msg); in avdt_ccb_snd_cmd()
829 void avdt_ccb_snd_msg(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_snd_msg() argument
833 if (!p_ccb->cong) { in avdt_ccb_snd_msg()
835 if (p_ccb->p_curr_msg != NULL) { in avdt_ccb_snd_msg()
836 avdt_msg_send(p_ccb, NULL); in avdt_ccb_snd_msg()
839 else if (!fixed_queue_is_empty(p_ccb->rsp_q)) { in avdt_ccb_snd_msg()
840 while ((p_msg = (BT_HDR*)fixed_queue_try_dequeue(p_ccb->rsp_q)) != NULL) { in avdt_ccb_snd_msg()
841 if (avdt_msg_send(p_ccb, p_msg)) { in avdt_ccb_snd_msg()
849 avdt_ccb_snd_cmd(p_ccb, NULL); in avdt_ccb_snd_msg()
865 void avdt_ccb_set_reconn(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_set_reconn() argument
866 p_ccb->reconn = true; in avdt_ccb_set_reconn()
879 void avdt_ccb_clr_reconn(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_clr_reconn() argument
880 p_ccb->reconn = false; in avdt_ccb_clr_reconn()
895 void avdt_ccb_chk_reconn(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_chk_reconn() argument
896 if (p_ccb->reconn) { in avdt_ccb_chk_reconn()
897 p_ccb->reconn = false; in avdt_ccb_chk_reconn()
900 avdt_ccb_clear_ccb(p_ccb); in avdt_ccb_chk_reconn()
906 avdt_ccb_cmd_fail(p_ccb, &avdt_ccb_evt); in avdt_ccb_chk_reconn()
909 avdt_ccb_event(p_ccb, AVDT_CCB_UL_OPEN_EVT, NULL); in avdt_ccb_chk_reconn()
911 avdt_ccb_ll_closed(p_ccb, NULL); in avdt_ccb_chk_reconn()
926 void avdt_ccb_chk_timer(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_chk_timer() argument
927 alarm_cancel(p_ccb->idle_ccb_timer); in avdt_ccb_chk_timer()
940 void avdt_ccb_set_conn(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_set_conn() argument
942 p_ccb->p_conn_cback = p_data->connect.p_cback; in avdt_ccb_set_conn()
960 void avdt_ccb_set_disconn(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_set_disconn() argument
967 p_ccb->p_conn_cback = p_data->disconnect.p_cback; in avdt_ccb_set_disconn()
980 void avdt_ccb_do_disconn(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_do_disconn() argument
982 avdt_ccb_clear_cmds(p_ccb, NULL); in avdt_ccb_do_disconn()
985 avdt_ccb_chan_close(p_ccb, NULL); in avdt_ccb_do_disconn()
998 void avdt_ccb_ll_closed(AvdtpCcb* p_ccb, UNUSED_ATTR tAVDT_CCB_EVT* p_data) { in avdt_ccb_ll_closed() argument
1002 AVDT_TRACE_DEBUG("%s peer %s", __func__, p_ccb->peer_addr.ToString().c_str()); in avdt_ccb_ll_closed()
1005 avdt_ccb_clear_cmds(p_ccb, NULL); in avdt_ccb_ll_closed()
1008 p_cback = p_ccb->p_conn_cback; in avdt_ccb_ll_closed()
1010 RawAddress bd_addr = p_ccb->peer_addr; in avdt_ccb_ll_closed()
1011 uint8_t bta_av_scb_index = p_ccb->BtaAvScbIndex(); in avdt_ccb_ll_closed()
1014 avdt_ccb_dealloc(p_ccb, NULL); in avdt_ccb_ll_closed()
1034 void avdt_ccb_ll_opened(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* p_data) { in avdt_ccb_ll_opened() argument
1038 p_ccb->peer_addr.ToString().c_str(), p_ccb->BtaAvScbIndex(), in avdt_ccb_ll_opened()
1039 p_ccb); in avdt_ccb_ll_opened()
1040 p_ccb->ll_opened = true; in avdt_ccb_ll_opened()
1042 if (!p_ccb->p_conn_cback) p_ccb->p_conn_cback = avdtp_cb.p_conn_cback; in avdt_ccb_ll_opened()
1045 if (p_ccb->p_conn_cback) { in avdt_ccb_ll_opened()
1048 (*p_ccb->p_conn_cback)(0, p_ccb->peer_addr, AVDT_CONNECT_IND_EVT, in avdt_ccb_ll_opened()
1049 &avdt_ctrl, p_ccb->BtaAvScbIndex()); in avdt_ccb_ll_opened()