Lines Matching refs:a2dp

84 static int bt_a2dp_get_sep_caps(struct bt_a2dp *a2dp);
86 static void a2dp_reset(struct bt_a2dp *a2dp) in a2dp_reset() argument
88 (void)memset(a2dp, 0, sizeof(struct bt_a2dp)); in a2dp_reset()
130 struct bt_a2dp *a2dp = A2DP_AVDTP(session); in a2dp_connected() local
132 a2dp->a2dp_state = INTERNAL_STATE_AVDTP_CONNECTED; in a2dp_connected()
135 a2dp_cb->connected(a2dp, 0); in a2dp_connected()
142 struct bt_a2dp *a2dp = A2DP_AVDTP(session); in a2dp_disconnected() local
146 a2dp_cb->disconnected(a2dp); in a2dp_disconnected()
188 struct bt_a2dp *a2dp = A2DP_AVDTP(session); in a2dp_set_config_ind() local
244 err = a2dp_cb->config_req(a2dp, ep, &cfg, &stream, &rsp_err_code); in a2dp_set_config_ind()
248 stream->a2dp = a2dp; in a2dp_set_config_ind()
426 struct bt_a2dp *a2dp = OPEN_PARAM(OPEN_REQ(req)); in bt_a2dp_open_cb() local
431 ep = CONTAINER_OF(a2dp->open_param.sep, struct bt_a2dp_ep, sep); in bt_a2dp_open_cb()
437 LOG_DBG("OPEN result:%d", a2dp->open_param.status); in bt_a2dp_open_cb()
440 a2dp_cb->establish_rsp(stream, a2dp->open_param.status); in bt_a2dp_open_cb()
444 if ((!a2dp->open_param.status) && (ops->established != NULL)) { in bt_a2dp_open_cb()
452 struct bt_a2dp *a2dp = SET_CONF_PARAM(SET_CONF_REQ(req)); in bt_a2dp_set_config_cb() local
457 ep = CONTAINER_OF(a2dp->set_config_param.sep, struct bt_a2dp_ep, sep); in bt_a2dp_set_config_cb()
463 LOG_DBG("SET CONFIGURATION result:%d", a2dp->set_config_param.status); in bt_a2dp_set_config_cb()
466 a2dp_cb->config_rsp(stream, a2dp->set_config_param.status); in bt_a2dp_set_config_cb()
470 if ((!a2dp->set_config_param.status) && (ops->configured != NULL)) { in bt_a2dp_set_config_cb()
480 struct bt_a2dp *a2dp = GET_CAP_PARAM(GET_CAP_REQ(req)); in bt_a2dp_get_capabilities_cb() local
485 LOG_DBG("GET CAPABILITIES result:%d", a2dp->get_capabilities_param.status); in bt_a2dp_get_capabilities_cb()
486 if (a2dp->get_capabilities_param.status) { in bt_a2dp_get_capabilities_cb()
487 if ((a2dp->discover_cb_param != NULL) && in bt_a2dp_get_capabilities_cb()
488 (a2dp->discover_cb_param->cb != NULL)) { in bt_a2dp_get_capabilities_cb()
489 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_get_capabilities_cb()
490 a2dp->discover_cb_param = NULL; in bt_a2dp_get_capabilities_cb()
495 err = bt_avdtp_parse_capability_codec(a2dp->get_capabilities_param.buf, in bt_a2dp_get_capabilities_cb()
506 if ((a2dp->discover_cb_param != NULL) && (a2dp->discover_cb_param->cb != NULL)) { in bt_a2dp_get_capabilities_cb()
508 struct bt_a2dp_ep_info *info = &a2dp->discover_cb_param->info; in bt_a2dp_get_capabilities_cb()
511 info->sep_info = a2dp->discover_cb_param->seps_info[a2dp->get_cap_index]; in bt_a2dp_get_capabilities_cb()
515 user_ret = a2dp->discover_cb_param->cb(a2dp, info, &ep); in bt_a2dp_get_capabilities_cb()
524 if (bt_a2dp_get_sep_caps(a2dp) != 0) { in bt_a2dp_get_capabilities_cb()
525 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_get_capabilities_cb()
526 a2dp->discover_cb_param = NULL; in bt_a2dp_get_capabilities_cb()
529 a2dp->discover_cb_param = NULL; in bt_a2dp_get_capabilities_cb()
536 static int bt_a2dp_get_sep_caps(struct bt_a2dp *a2dp) in bt_a2dp_get_sep_caps() argument
540 if ((a2dp->discover_cb_param == NULL) || (a2dp->discover_cb_param->cb == NULL)) { in bt_a2dp_get_sep_caps()
544 if (a2dp->get_cap_index == 0xFFu) { in bt_a2dp_get_sep_caps()
545 a2dp->get_cap_index = 0U; in bt_a2dp_get_sep_caps()
547 a2dp->get_cap_index++; in bt_a2dp_get_sep_caps()
550 for (; a2dp->get_cap_index < a2dp->peer_seps_count; in bt_a2dp_get_sep_caps()
551 a2dp->get_cap_index++) { in bt_a2dp_get_sep_caps()
552 if (a2dp->discover_cb_param->seps_info[a2dp->get_cap_index].media_type == in bt_a2dp_get_sep_caps()
554 a2dp->get_capabilities_param.req.func = bt_a2dp_get_capabilities_cb; in bt_a2dp_get_sep_caps()
555 a2dp->get_capabilities_param.buf = NULL; in bt_a2dp_get_sep_caps()
556 a2dp->get_capabilities_param.stream_endpoint_id = in bt_a2dp_get_sep_caps()
557 a2dp->discover_cb_param->seps_info[a2dp->get_cap_index].id; in bt_a2dp_get_sep_caps()
558 err = bt_avdtp_get_capabilities(&a2dp->session, in bt_a2dp_get_sep_caps()
559 &a2dp->get_capabilities_param); in bt_a2dp_get_sep_caps()
562 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_get_sep_caps()
563 a2dp->discover_cb_param = NULL; in bt_a2dp_get_sep_caps()
573 struct bt_a2dp *a2dp = DISCOVER_PARAM(DISCOVER_REQ(req)); in bt_a2dp_discover_cb() local
578 if (a2dp->discover_cb_param == NULL) { in bt_a2dp_discover_cb()
581 a2dp->peer_seps_count = 0U; in bt_a2dp_discover_cb()
583 if (a2dp->discover_cb_param->sep_count == 0) { in bt_a2dp_discover_cb()
584 if (a2dp->discover_cb_param->cb != NULL) { in bt_a2dp_discover_cb()
585 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_discover_cb()
586 a2dp->discover_cb_param = NULL; in bt_a2dp_discover_cb()
592 sep_info = &a2dp->discover_cb_param->seps_info[a2dp->peer_seps_count]; in bt_a2dp_discover_cb()
597 a2dp->peer_seps_count++; in bt_a2dp_discover_cb()
603 } while (a2dp->peer_seps_count < a2dp->discover_cb_param->sep_count); in bt_a2dp_discover_cb()
606 a2dp->get_cap_index = 0xFFu; in bt_a2dp_discover_cb()
607 if (bt_a2dp_get_sep_caps(a2dp) != 0) { in bt_a2dp_discover_cb()
609 if (a2dp->discover_cb_param->cb != NULL) { in bt_a2dp_discover_cb()
610 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_discover_cb()
611 a2dp->discover_cb_param = NULL; in bt_a2dp_discover_cb()
615 if (a2dp->discover_cb_param->cb != NULL) { in bt_a2dp_discover_cb()
616 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_discover_cb()
617 a2dp->discover_cb_param = NULL; in bt_a2dp_discover_cb()
626 struct bt_a2dp *a2dp = START_PARAM(START_REQ(req)); in bt_a2dp_start_cb() local
631 ep = CONTAINER_OF(a2dp->start_param.sep, struct bt_a2dp_ep, sep); in bt_a2dp_start_cb()
637 LOG_DBG("START result:%d", a2dp->start_param.status); in bt_a2dp_start_cb()
640 a2dp_cb->start_rsp(stream, a2dp->start_param.status); in bt_a2dp_start_cb()
644 if ((!a2dp->start_param.status) && (ops->started != NULL)) { in bt_a2dp_start_cb()
650 int bt_a2dp_discover(struct bt_a2dp *a2dp, struct bt_a2dp_discover_param *param) in bt_a2dp_discover() argument
654 if ((a2dp == NULL) || (param == NULL)) { in bt_a2dp_discover()
658 if (a2dp->a2dp_state != INTERNAL_STATE_AVDTP_CONNECTED) { in bt_a2dp_discover()
662 if (a2dp->discover_cb_param != NULL) { in bt_a2dp_discover()
666 a2dp->discover_cb_param = param; in bt_a2dp_discover()
667 a2dp->discover_param.req.func = bt_a2dp_discover_cb; in bt_a2dp_discover()
668 a2dp->discover_param.buf = NULL; in bt_a2dp_discover()
669 err = bt_avdtp_discover(&a2dp->session, &a2dp->discover_param); in bt_a2dp_discover()
671 if (a2dp->discover_cb_param->cb != NULL) { in bt_a2dp_discover()
672 a2dp->discover_cb_param->cb(a2dp, NULL, NULL); in bt_a2dp_discover()
674 a2dp->discover_cb_param = NULL; in bt_a2dp_discover()
686 int bt_a2dp_stream_config(struct bt_a2dp *a2dp, struct bt_a2dp_stream *stream, in bt_a2dp_stream_config() argument
690 if ((a2dp == NULL) || (stream == NULL) || (local_ep == NULL) || in bt_a2dp_stream_config()
703 stream->a2dp = a2dp; in bt_a2dp_stream_config()
706 a2dp->set_config_param.req.func = bt_a2dp_set_config_cb; in bt_a2dp_stream_config()
707 a2dp->set_config_param.acp_stream_ep_id = remote_ep->sep.sep_info.id; in bt_a2dp_stream_config()
708 a2dp->set_config_param.int_stream_endpoint_id = local_ep->sep.sep_info.id; in bt_a2dp_stream_config()
709 a2dp->set_config_param.media_type = BT_AVDTP_AUDIO; in bt_a2dp_stream_config()
710 a2dp->set_config_param.media_codec_type = local_ep->codec_type; in bt_a2dp_stream_config()
711 a2dp->set_config_param.codec_specific_ie_len = config->codec_config->len; in bt_a2dp_stream_config()
712 a2dp->set_config_param.codec_specific_ie = &config->codec_config->codec_ie[0]; in bt_a2dp_stream_config()
713 a2dp->set_config_param.sep = &local_ep->sep; in bt_a2dp_stream_config()
714 return bt_avdtp_set_configuration(&a2dp->session, &a2dp->set_config_param); in bt_a2dp_stream_config()
719 struct bt_a2dp *a2dp; in bt_a2dp_stream_establish() local
721 if ((stream == NULL) || (stream->local_ep == NULL) || (stream->a2dp == NULL)) { in bt_a2dp_stream_establish()
725 a2dp = stream->a2dp; in bt_a2dp_stream_establish()
726 a2dp->open_param.req.func = bt_a2dp_open_cb; in bt_a2dp_stream_establish()
727 a2dp->open_param.acp_stream_ep_id = stream->remote_ep != NULL ? in bt_a2dp_stream_establish()
729 a2dp->open_param.sep = &stream->local_ep->sep; in bt_a2dp_stream_establish()
730 return bt_avdtp_open(&a2dp->session, &a2dp->open_param); in bt_a2dp_stream_establish()
741 struct bt_a2dp *a2dp; in bt_a2dp_stream_start() local
743 if ((stream == NULL) || (stream->local_ep == NULL) || (stream->a2dp == NULL)) { in bt_a2dp_stream_start()
747 a2dp = stream->a2dp; in bt_a2dp_stream_start()
748 a2dp->start_param.req.func = bt_a2dp_start_cb; in bt_a2dp_stream_start()
749 a2dp->start_param.acp_stream_ep_id = stream->remote_ep != NULL ? in bt_a2dp_stream_start()
751 a2dp->start_param.sep = &stream->local_ep->sep; in bt_a2dp_stream_start()
752 return bt_avdtp_start(&a2dp->session, &a2dp->start_param); in bt_a2dp_stream_start()
817 struct bt_a2dp *a2dp; in a2dp_accept() local
819 a2dp = get_new_connection(conn); in a2dp_accept()
820 if (!a2dp) { in a2dp_accept()
824 *session = &(a2dp->session); in a2dp_accept()
825 a2dp->session.ops = &signaling_avdtp_ops; in a2dp_accept()
826 LOG_DBG("session: %p", &(a2dp->session)); in a2dp_accept()
857 struct bt_a2dp *a2dp; in bt_a2dp_connect() local
861 a2dp = get_new_connection(conn); in bt_a2dp_connect()
862 if (!a2dp) { in bt_a2dp_connect()
868 a2dp->a2dp_state = INTERNAL_STATE_IDLE; in bt_a2dp_connect()
870 a2dp->session.ops = &signaling_avdtp_ops; in bt_a2dp_connect()
871 err = bt_avdtp_connect(conn, &(a2dp->session)); in bt_a2dp_connect()
874 a2dp_reset(a2dp); in bt_a2dp_connect()
882 return a2dp; in bt_a2dp_connect()
885 int bt_a2dp_disconnect(struct bt_a2dp *a2dp) in bt_a2dp_disconnect() argument