Lines Matching refs:a2dp

76 static int bt_a2dp_get_sep_caps(struct bt_a2dp *a2dp);
80 struct bt_a2dp *a2dp = &connection[bt_conn_index(conn)]; in a2dp_get_connection() local
82 if (a2dp->session.br_chan.chan.conn == NULL) { in a2dp_get_connection()
84 (void)memset(a2dp, 0, sizeof(struct bt_a2dp)); in a2dp_get_connection()
86 return a2dp; in a2dp_get_connection()
92 struct bt_a2dp *a2dp = A2DP_AVDTP(session); in a2dp_connected() local
94 a2dp->a2dp_state = INTERNAL_STATE_AVDTP_CONNECTED; in a2dp_connected()
97 a2dp_cb->connected(a2dp, 0); in a2dp_connected()
104 struct bt_a2dp *a2dp = A2DP_AVDTP(session); in a2dp_disconnected() local
108 a2dp_cb->disconnected(a2dp); in a2dp_disconnected()
152 struct bt_a2dp *a2dp = A2DP_AVDTP(session); in a2dp_process_config_ind() local
224 err = a2dp_cb->config_req(a2dp, ep, &cfg, &stream, &rsp_err_code); in a2dp_process_config_ind()
226 stream->a2dp = a2dp; in a2dp_process_config_ind()
394 struct bt_a2dp *a2dp = SET_CONF_PARAM(SET_CONF_REQ(req)); in bt_a2dp_set_config_cb() local
399 ep = CONTAINER_OF(a2dp->set_config_param.sep, struct bt_a2dp_ep, sep); in bt_a2dp_set_config_cb()
403 if ((ep->stream == NULL) || (SET_CONF_REQ(req) != &a2dp->set_config_param)) { in bt_a2dp_set_config_cb()
425 struct bt_a2dp *a2dp = GET_CAP_PARAM(GET_CAP_REQ(req)); in bt_a2dp_get_capabilities_cb() local
430 if (GET_CAP_REQ(req) != &a2dp->get_capabilities_param) { in bt_a2dp_get_capabilities_cb()
436 if ((a2dp->discover_cb_param != NULL) && (a2dp->discover_cb_param->cb != NULL)) { in bt_a2dp_get_capabilities_cb()
437 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_get_capabilities_cb()
438 a2dp->discover_cb_param = NULL; in bt_a2dp_get_capabilities_cb()
443 err = bt_avdtp_parse_capability_codec(a2dp->get_capabilities_param.buf, &codec_type, in bt_a2dp_get_capabilities_cb()
454 if ((a2dp->discover_cb_param != NULL) && (a2dp->discover_cb_param->cb != NULL)) { in bt_a2dp_get_capabilities_cb()
456 struct bt_a2dp_ep_info *info = &a2dp->discover_cb_param->info; in bt_a2dp_get_capabilities_cb()
459 info->sep_info = a2dp->discover_cb_param->seps_info[a2dp->get_cap_index]; in bt_a2dp_get_capabilities_cb()
462 user_ret = a2dp->discover_cb_param->cb(a2dp, info, &ep); in bt_a2dp_get_capabilities_cb()
471 if (bt_a2dp_get_sep_caps(a2dp) != 0) { in bt_a2dp_get_capabilities_cb()
472 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_get_capabilities_cb()
473 a2dp->discover_cb_param = NULL; in bt_a2dp_get_capabilities_cb()
476 a2dp->discover_cb_param = NULL; in bt_a2dp_get_capabilities_cb()
483 static int bt_a2dp_get_sep_caps(struct bt_a2dp *a2dp) in bt_a2dp_get_sep_caps() argument
487 if ((a2dp->discover_cb_param == NULL) || (a2dp->discover_cb_param->cb == NULL)) { in bt_a2dp_get_sep_caps()
491 if (a2dp->get_cap_index == 0xFFu) { in bt_a2dp_get_sep_caps()
492 a2dp->get_cap_index = 0U; in bt_a2dp_get_sep_caps()
494 a2dp->get_cap_index++; in bt_a2dp_get_sep_caps()
497 for (; a2dp->get_cap_index < a2dp->peer_seps_count; a2dp->get_cap_index++) { in bt_a2dp_get_sep_caps()
498 if (a2dp->discover_cb_param->seps_info[a2dp->get_cap_index].media_type == in bt_a2dp_get_sep_caps()
500 a2dp->get_capabilities_param.req.func = bt_a2dp_get_capabilities_cb; in bt_a2dp_get_sep_caps()
501 a2dp->get_capabilities_param.buf = NULL; in bt_a2dp_get_sep_caps()
502 a2dp->get_capabilities_param.stream_endpoint_id = in bt_a2dp_get_sep_caps()
503 a2dp->discover_cb_param->seps_info[a2dp->get_cap_index].id; in bt_a2dp_get_sep_caps()
504 err = bt_avdtp_get_capabilities(&a2dp->session, in bt_a2dp_get_sep_caps()
505 &a2dp->get_capabilities_param); in bt_a2dp_get_sep_caps()
508 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_get_sep_caps()
509 a2dp->discover_cb_param = NULL; in bt_a2dp_get_sep_caps()
519 struct bt_a2dp *a2dp = DISCOVER_PARAM(DISCOVER_REQ(req)); in bt_a2dp_discover_cb() local
524 if (a2dp->discover_cb_param == NULL) { in bt_a2dp_discover_cb()
527 a2dp->peer_seps_count = 0U; in bt_a2dp_discover_cb()
529 if (a2dp->discover_cb_param->sep_count == 0) { in bt_a2dp_discover_cb()
530 if (a2dp->discover_cb_param->cb != NULL) { in bt_a2dp_discover_cb()
531 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_discover_cb()
532 a2dp->discover_cb_param = NULL; in bt_a2dp_discover_cb()
538 sep_info = &a2dp->discover_cb_param->seps_info[a2dp->peer_seps_count]; in bt_a2dp_discover_cb()
543 a2dp->peer_seps_count++; in bt_a2dp_discover_cb()
546 } while (a2dp->peer_seps_count < a2dp->discover_cb_param->sep_count); in bt_a2dp_discover_cb()
549 a2dp->get_cap_index = 0xFFu; in bt_a2dp_discover_cb()
550 if (bt_a2dp_get_sep_caps(a2dp) != 0) { in bt_a2dp_discover_cb()
552 if (a2dp->discover_cb_param->cb != NULL) { in bt_a2dp_discover_cb()
553 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_discover_cb()
554 a2dp->discover_cb_param = NULL; in bt_a2dp_discover_cb()
558 if (a2dp->discover_cb_param->cb != NULL) { in bt_a2dp_discover_cb()
559 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_discover_cb()
560 a2dp->discover_cb_param = NULL; in bt_a2dp_discover_cb()
567 int bt_a2dp_discover(struct bt_a2dp *a2dp, struct bt_a2dp_discover_param *param) in bt_a2dp_discover() argument
571 if ((a2dp == NULL) || (param == NULL)) { in bt_a2dp_discover()
575 if (a2dp->a2dp_state != INTERNAL_STATE_AVDTP_CONNECTED) { in bt_a2dp_discover()
579 if (a2dp->discover_cb_param != NULL) { in bt_a2dp_discover()
583 a2dp->discover_cb_param = param; in bt_a2dp_discover()
584 a2dp->discover_param.req.func = bt_a2dp_discover_cb; in bt_a2dp_discover()
585 a2dp->discover_param.buf = NULL; in bt_a2dp_discover()
586 err = bt_avdtp_discover(&a2dp->session, &a2dp->discover_param); in bt_a2dp_discover()
588 if (a2dp->discover_cb_param->cb != NULL) { in bt_a2dp_discover()
589 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_discover()
591 a2dp->discover_cb_param = NULL; in bt_a2dp_discover()
603 static inline void bt_a2dp_stream_config_set_param(struct bt_a2dp *a2dp, in bt_a2dp_stream_config_set_param() argument
609 a2dp->set_config_param.req.func = cb; in bt_a2dp_stream_config_set_param()
610 a2dp->set_config_param.acp_stream_ep_id = remote_id; in bt_a2dp_stream_config_set_param()
611 a2dp->set_config_param.int_stream_endpoint_id = int_id; in bt_a2dp_stream_config_set_param()
612 a2dp->set_config_param.media_type = BT_AVDTP_AUDIO; in bt_a2dp_stream_config_set_param()
613 a2dp->set_config_param.media_codec_type = codec_type; in bt_a2dp_stream_config_set_param()
614 a2dp->set_config_param.codec_specific_ie_len = config->codec_config->len; in bt_a2dp_stream_config_set_param()
615 a2dp->set_config_param.codec_specific_ie = &config->codec_config->codec_ie[0]; in bt_a2dp_stream_config_set_param()
616 a2dp->set_config_param.sep = sep; in bt_a2dp_stream_config_set_param()
619 int bt_a2dp_stream_config(struct bt_a2dp *a2dp, struct bt_a2dp_stream *stream, in bt_a2dp_stream_config() argument
623 if ((a2dp == NULL) || (stream == NULL) || (local_ep == NULL) || (remote_ep == NULL) || in bt_a2dp_stream_config()
636 stream->a2dp = a2dp; in bt_a2dp_stream_config()
639 bt_a2dp_stream_config_set_param(a2dp, config, bt_a2dp_set_config_cb, in bt_a2dp_stream_config()
642 return bt_avdtp_set_configuration(&a2dp->session, &a2dp->set_config_param); in bt_a2dp_stream_config()
651 struct bt_a2dp *a2dp = CTRL_PARAM(CTRL_REQ(req)); in bt_a2dp_ctrl_cb() local
655 ep = CONTAINER_OF(a2dp->ctrl_param.sep, struct bt_a2dp_ep, sep); in bt_a2dp_ctrl_cb()
656 if ((ep->stream == NULL) || (CTRL_REQ(req) != &a2dp->ctrl_param)) { in bt_a2dp_ctrl_cb()
729 struct bt_a2dp *a2dp; in bt_a2dp_stream_ctrl_pre() local
731 if ((stream == NULL) || (stream->local_ep == NULL) || (stream->a2dp == NULL)) { in bt_a2dp_stream_ctrl_pre()
735 a2dp = stream->a2dp; in bt_a2dp_stream_ctrl_pre()
736 a2dp->ctrl_param.req.func = cb; in bt_a2dp_stream_ctrl_pre()
737 a2dp->ctrl_param.acp_stream_ep_id = stream->remote_ep != NULL in bt_a2dp_stream_ctrl_pre()
740 a2dp->ctrl_param.sep = &stream->local_ep->sep; in bt_a2dp_stream_ctrl_pre()
747 struct bt_a2dp *a2dp = stream->a2dp; in bt_a2dp_stream_establish() local
753 return bt_avdtp_open(&a2dp->session, &a2dp->ctrl_param); in bt_a2dp_stream_establish()
759 struct bt_a2dp *a2dp = stream->a2dp; in bt_a2dp_stream_release() local
765 return bt_avdtp_close(&a2dp->session, &a2dp->ctrl_param); in bt_a2dp_stream_release()
771 struct bt_a2dp *a2dp = stream->a2dp; in bt_a2dp_stream_start() local
777 return bt_avdtp_start(&a2dp->session, &a2dp->ctrl_param); in bt_a2dp_stream_start()
783 struct bt_a2dp *a2dp = stream->a2dp; in bt_a2dp_stream_suspend() local
789 return bt_avdtp_suspend(&a2dp->session, &a2dp->ctrl_param); in bt_a2dp_stream_suspend()
795 struct bt_a2dp *a2dp = stream->a2dp; in bt_a2dp_stream_abort() local
801 return bt_avdtp_abort(&a2dp->session, &a2dp->ctrl_param); in bt_a2dp_stream_abort()
814 bt_a2dp_stream_config_set_param(stream->a2dp, config, bt_a2dp_set_config_cb, remote_id, in bt_a2dp_stream_reconfig()
817 return bt_avdtp_reconfigure(&stream->a2dp->session, &stream->a2dp->set_config_param); in bt_a2dp_stream_reconfig()
898 struct bt_a2dp *a2dp; in a2dp_accept() local
900 a2dp = a2dp_get_connection(conn); in a2dp_accept()
901 if (!a2dp) { in a2dp_accept()
905 *session = &(a2dp->session); in a2dp_accept()
906 a2dp->session.ops = &signaling_avdtp_ops; in a2dp_accept()
907 LOG_DBG("session: %p", &(a2dp->session)); in a2dp_accept()
938 struct bt_a2dp *a2dp; in bt_a2dp_connect() local
941 a2dp = a2dp_get_connection(conn); in bt_a2dp_connect()
942 if (!a2dp) { in bt_a2dp_connect()
947 a2dp->a2dp_state = INTERNAL_STATE_IDLE; in bt_a2dp_connect()
949 a2dp->session.ops = &signaling_avdtp_ops; in bt_a2dp_connect()
950 err = bt_avdtp_connect(conn, &(a2dp->session)); in bt_a2dp_connect()
957 return a2dp; in bt_a2dp_connect()
960 int bt_a2dp_disconnect(struct bt_a2dp *a2dp) in bt_a2dp_disconnect() argument
962 __ASSERT_NO_MSG(a2dp); in bt_a2dp_disconnect()
963 return bt_avdtp_disconnect(&a2dp->session); in bt_a2dp_disconnect()