Lines Matching full:ep
75 struct bt_bap_ep ep; member
143 static int unicast_client_ep_set_metadata(struct bt_bap_ep *ep, void *data, uint8_t len,
146 static int unicast_client_ep_set_codec_cfg(struct bt_bap_ep *ep, uint8_t id, uint16_t cid,
149 static int unicast_client_ep_start(struct bt_bap_ep *ep,
154 static void unicast_client_reset(struct bt_bap_ep *ep, uint8_t reason);
157 static void unicast_client_ep_set_status(struct bt_bap_ep *ep, struct net_buf_simple *buf);
159 static int unicast_client_send_start(struct bt_bap_ep *ep) in unicast_client_send_start() argument
161 if (ep->receiver_ready != true || ep->dir != BT_AUDIO_DIR_SOURCE) { in unicast_client_send_start()
162 LOG_DBG("Invalid ep %p %u %s", in unicast_client_send_start()
163 ep, ep->receiver_ready, bt_audio_dir_str(ep->dir)); in unicast_client_send_start()
172 buf = bt_bap_unicast_client_ep_create_pdu(ep->stream->conn, BT_ASCS_START_OP); in unicast_client_send_start()
181 err = unicast_client_ep_start(ep, buf); in unicast_client_send_start()
189 err = bt_bap_unicast_client_ep_send(ep->stream->conn, ep, buf); in unicast_client_send_start()
199 static void unicast_client_ep_idle_state(struct bt_bap_ep *ep);
215 if (client_ep->ep.status.id == id) { in audio_stream_by_ep_id()
216 return client_ep->ep.stream; in audio_stream_by_ep_id()
226 if (client_ep->ep.status.id == id) { in audio_stream_by_ep_id()
227 return client_ep->ep.stream; in audio_stream_by_ep_id()
248 struct bt_bap_ep *ep = iso->rx.ep; in unicast_client_ep_iso_recv() local
250 if (ep == NULL) { in unicast_client_ep_iso_recv()
260 LOG_DBG("Valid ISO packet of len %zu received for iso %p not bound with ep", in unicast_client_ep_iso_recv()
267 if (ep->status.state != BT_BAP_EP_STATE_STREAMING) { in unicast_client_ep_iso_recv()
269 LOG_DBG("ep %p is not in the streaming state: %s", ep, in unicast_client_ep_iso_recv()
270 bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_iso_recv()
276 stream = ep->stream; in unicast_client_ep_iso_recv()
278 LOG_ERR("No stream for ep %p", ep); in unicast_client_ep_iso_recv()
285 LOG_DBG("stream %p ep %p len %zu", stream, ep, net_buf_frags_len(buf)); in unicast_client_ep_iso_recv()
301 struct bt_bap_ep *ep = iso->tx.ep; in unicast_client_ep_iso_sent() local
303 if (ep == NULL) { in unicast_client_ep_iso_sent()
304 LOG_ERR("iso %p not bound with ep", chan); in unicast_client_ep_iso_sent()
308 stream = ep->stream; in unicast_client_ep_iso_sent()
310 LOG_ERR("No stream for ep %p", ep); in unicast_client_ep_iso_sent()
315 LOG_DBG("stream %p ep %p", stream, ep); in unicast_client_ep_iso_sent()
324 static void unicast_client_ep_iso_connected(struct bt_bap_ep *ep) in unicast_client_ep_iso_connected() argument
329 if (ep->unicast_group != NULL) { in unicast_client_ep_iso_connected()
330 ep->unicast_group->has_been_connected = true; in unicast_client_ep_iso_connected()
333 if (ep->status.state != BT_BAP_EP_STATE_ENABLING) { in unicast_client_ep_iso_connected()
335 bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_iso_connected()
339 stream = ep->stream; in unicast_client_ep_iso_connected()
341 LOG_ERR("No stream for ep %p", ep); in unicast_client_ep_iso_connected()
345 LOG_DBG("stream %p ep %p dir %s receiver_ready %u", in unicast_client_ep_iso_connected()
346 stream, ep, bt_audio_dir_str(ep->dir), ep->receiver_ready); in unicast_client_ep_iso_connected()
363 if (iso->rx.ep == NULL && iso->tx.ep == NULL) { in unicast_client_iso_connected()
364 LOG_ERR("iso %p not bound with ep", chan); in unicast_client_iso_connected()
368 if (iso->rx.ep != NULL) { in unicast_client_iso_connected()
369 unicast_client_ep_iso_connected(iso->rx.ep); in unicast_client_iso_connected()
372 if (iso->tx.ep != NULL) { in unicast_client_iso_connected()
373 unicast_client_ep_iso_connected(iso->tx.ep); in unicast_client_iso_connected()
377 static void unicast_client_ep_iso_disconnected(struct bt_bap_ep *ep, uint8_t reason) in unicast_client_ep_iso_disconnected() argument
382 stream = ep->stream; in unicast_client_ep_iso_disconnected()
384 LOG_ERR("Stream not associated with an ep"); in unicast_client_ep_iso_disconnected()
388 LOG_DBG("stream %p ep %p reason 0x%02x", stream, ep, reason); in unicast_client_ep_iso_disconnected()
389 ep->reason = reason; in unicast_client_ep_iso_disconnected()
400 if (ep->status.state == BT_BAP_EP_STATE_IDLE) { in unicast_client_ep_iso_disconnected()
402 unicast_client_ep_idle_state(ep); in unicast_client_ep_iso_disconnected()
410 /* Retrigger the reset of the EP if the ACL is disconnected before in unicast_client_ep_iso_disconnected()
413 unicast_client_reset(ep, reason); in unicast_client_ep_iso_disconnected()
423 if (iso->rx.ep == NULL && iso->tx.ep == NULL) { in unicast_client_iso_disconnected()
424 LOG_ERR("iso %p not bound with ep", chan); in unicast_client_iso_disconnected()
428 if (iso->rx.ep != NULL) { in unicast_client_iso_disconnected()
429 unicast_client_ep_iso_disconnected(iso->rx.ep, reason); in unicast_client_iso_disconnected()
432 if (iso->tx.ep != NULL) { in unicast_client_iso_disconnected()
433 unicast_client_ep_iso_disconnected(iso->tx.ep, reason); in unicast_client_iso_disconnected()
448 bool bt_bap_ep_is_unicast_client(const struct bt_bap_ep *ep) in bt_bap_ep_is_unicast_client() argument
452 if (PART_OF_ARRAY(uni_cli_insts[i].snks, ep)) { in bt_bap_ep_is_unicast_client()
458 if (PART_OF_ARRAY(uni_cli_insts[i].srcs, ep)) { in bt_bap_ep_is_unicast_client()
467 static void unicast_client_ep_init(struct bt_bap_ep *ep, uint16_t handle, uint8_t dir) in unicast_client_ep_init() argument
471 LOG_DBG("ep %p dir %s handle 0x%04x", ep, bt_audio_dir_str(dir), handle); in unicast_client_ep_init()
473 client_ep = CONTAINER_OF(ep, struct bt_bap_unicast_client_ep, ep); in unicast_client_ep_init()
475 (void)memset(ep, 0, sizeof(*ep)); in unicast_client_ep_init()
477 ep->status.id = 0U; in unicast_client_ep_init()
478 ep->dir = dir; in unicast_client_ep_init()
479 ep->reason = BT_HCI_ERR_SUCCESS; in unicast_client_ep_init()
494 return &client_ep->ep; in unicast_client_ep_find()
504 return &client_ep->ep; in unicast_client_ep_find()
558 unicast_client_ep_init(&client_ep->ep, handle, dir); in unicast_client_ep_new()
559 return &client_ep->ep; in unicast_client_ep_new()
569 struct bt_bap_ep *ep; in unicast_client_ep_get() local
571 ep = unicast_client_ep_find(conn, handle); in unicast_client_ep_get()
572 if (ep || !handle) { in unicast_client_ep_get()
573 return ep; in unicast_client_ep_get()
579 static void unicast_client_ep_set_local_idle_state(struct bt_bap_ep *ep) in unicast_client_ep_set_local_idle_state() argument
582 .id = ep->status.id, in unicast_client_ep_set_local_idle_state()
589 unicast_client_ep_set_status(ep, &buf); in unicast_client_ep_set_local_idle_state()
636 static void unicast_client_notify_endpoint(struct bt_conn *conn, struct bt_bap_ep *ep) in unicast_client_notify_endpoint() argument
644 listener->endpoint(conn, dir, ep); in unicast_client_notify_endpoint()
771 static void unicast_client_ep_idle_state(struct bt_bap_ep *ep) in unicast_client_ep_idle_state() argument
774 CONTAINER_OF(ep, struct bt_bap_unicast_client_ep, ep); in unicast_client_ep_idle_state()
775 struct bt_bap_stream *stream = ep->stream; in unicast_client_ep_idle_state()
778 ep->receiver_ready = false; in unicast_client_ep_idle_state()
796 } else if (ep->iso != NULL && ep->iso->chan.state == BT_ISO_STATE_DISCONNECTING) { in unicast_client_ep_idle_state()
827 static void unicast_client_ep_qos_update(struct bt_bap_ep *ep, in unicast_client_ep_qos_update() argument
832 LOG_DBG("ep %p dir %s bap_iso %p", ep, bt_audio_dir_str(ep->dir), ep->iso); in unicast_client_ep_qos_update()
834 if (ep->dir == BT_AUDIO_DIR_SOURCE) { in unicast_client_ep_qos_update()
838 iso_io_qos = &ep->iso->rx.qos; in unicast_client_ep_qos_update()
839 } else if (ep->dir == BT_AUDIO_DIR_SINK) { in unicast_client_ep_qos_update()
843 iso_io_qos = &ep->iso->tx.qos; in unicast_client_ep_qos_update()
845 __ASSERT(false, "Invalid ep->dir: %u", ep->dir); in unicast_client_ep_qos_update()
854 static void unicast_client_ep_config_state(struct bt_bap_ep *ep, struct net_buf_simple *buf) in unicast_client_ep_config_state() argument
857 CONTAINER_OF(ep, struct bt_bap_unicast_client_ep, ep); in unicast_client_ep_config_state()
863 ep->receiver_ready = false; in unicast_client_ep_config_state()
867 ep->reason = BT_HCI_ERR_LOCALHOST_TERM_CONN; in unicast_client_ep_config_state()
868 unicast_client_ep_set_local_idle_state(ep); in unicast_client_ep_config_state()
877 stream = ep->stream; in unicast_client_ep_config_state()
903 pref = &stream->ep->qos_pref; in unicast_client_ep_config_state()
917 bt_audio_dir_str(ep->dir), pref->unframed_supported, pref->phy, pref->rtn, in unicast_client_ep_config_state()
931 unicast_client_ep_set_codec_cfg(ep, cfg->codec.id, sys_le16_to_cpu(cfg->codec.cid), in unicast_client_ep_config_state()
942 static void unicast_client_ep_qos_state(struct bt_bap_ep *ep, struct net_buf_simple *buf, in unicast_client_ep_qos_state() argument
949 ep->receiver_ready = false; in unicast_client_ep_qos_state()
956 stream = ep->stream; in unicast_client_ep_qos_state()
964 if (ep->dir == BT_AUDIO_DIR_SINK && ops->disabled != NULL) { in unicast_client_ep_qos_state()
975 } else if (ep->dir == BT_AUDIO_DIR_SOURCE && in unicast_client_ep_qos_state()
980 uint8_t reason = ep->reason; in unicast_client_ep_qos_state()
987 ep->reason = BT_HCI_ERR_SUCCESS; in unicast_client_ep_qos_state()
997 unicast_client_ep_qos_update(ep, qos); in unicast_client_ep_qos_state()
999 ep->cig_id = qos->cig_id; in unicast_client_ep_qos_state()
1000 ep->cis_id = qos->cis_id; in unicast_client_ep_qos_state()
1011 bt_audio_dir_str(ep->dir), ep->cig_id, ep->cis_id, stream->codec_cfg->id, in unicast_client_ep_qos_state()
1024 * we have the ISO <-> EP coupling completed (due to setting in unicast_client_ep_qos_state()
1028 bt_bap_iso_configure_data_path(ep, stream->codec_cfg); in unicast_client_ep_qos_state()
1039 static void unicast_client_ep_enabling_state(struct bt_bap_ep *ep, struct net_buf_simple *buf, in unicast_client_ep_enabling_state() argument
1051 stream = ep->stream; in unicast_client_ep_enabling_state()
1067 LOG_DBG("dir %s cig 0x%02x cis 0x%02x", bt_audio_dir_str(ep->dir), ep->cig_id, ep->cis_id); in unicast_client_ep_enabling_state()
1069 unicast_client_ep_set_metadata(ep, metadata, enable->metadata_len, NULL); in unicast_client_ep_enabling_state()
1090 static void unicast_client_ep_streaming_state(struct bt_bap_ep *ep, struct net_buf_simple *buf, in unicast_client_ep_streaming_state() argument
1101 stream = ep->stream; in unicast_client_ep_streaming_state()
1109 LOG_DBG("dir %s cig 0x%02x cis 0x%02x", bt_audio_dir_str(ep->dir), ep->cig_id, ep->cis_id); in unicast_client_ep_streaming_state()
1130 static void unicast_client_ep_disabling_state(struct bt_bap_ep *ep, struct net_buf_simple *buf) in unicast_client_ep_disabling_state() argument
1135 ep->receiver_ready = false; in unicast_client_ep_disabling_state()
1142 stream = ep->stream; in unicast_client_ep_disabling_state()
1150 LOG_DBG("dir %s cig 0x%02x cis 0x%02x", bt_audio_dir_str(ep->dir), ep->cig_id, ep->cis_id); in unicast_client_ep_disabling_state()
1160 static void unicast_client_ep_releasing_state(struct bt_bap_ep *ep, struct net_buf_simple *buf) in unicast_client_ep_releasing_state() argument
1164 ep->receiver_ready = false; in unicast_client_ep_releasing_state()
1166 stream = ep->stream; in unicast_client_ep_releasing_state()
1172 LOG_DBG("dir %s", bt_audio_dir_str(ep->dir)); in unicast_client_ep_releasing_state()
1189 static void unicast_client_ep_set_status(struct bt_bap_ep *ep, struct net_buf_simple *buf) in unicast_client_ep_set_status() argument
1196 if (!ep) { in unicast_client_ep_set_status()
1200 client_ep = CONTAINER_OF(ep, struct bt_bap_unicast_client_ep, ep); in unicast_client_ep_set_status()
1204 old_state = ep->status.state; in unicast_client_ep_set_status()
1205 ep->status = *status; in unicast_client_ep_set_status()
1206 state_changed = old_state != ep->status.state; in unicast_client_ep_set_status()
1211 struct bt_bap_stream *stream = ep->stream; in unicast_client_ep_set_status()
1215 uint8_t reason = ep->reason; in unicast_client_ep_set_status()
1222 ep->reason = BT_HCI_ERR_SUCCESS; in unicast_client_ep_set_status()
1233 LOG_DBG("ep %p handle 0x%04x id 0x%02x dir %s state %s -> %s", ep, client_ep->handle, in unicast_client_ep_set_status()
1234 status->id, bt_audio_dir_str(ep->dir), bt_bap_ep_state_str(old_state), in unicast_client_ep_set_status()
1239 unicast_client_ep_idle_state(ep); in unicast_client_ep_set_status()
1255 bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_set_status()
1259 unicast_client_ep_config_state(ep, buf); in unicast_client_ep_set_status()
1263 if (ep->dir == BT_AUDIO_DIR_SOURCE) { in unicast_client_ep_set_status()
1277 bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_set_status()
1294 bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_set_status()
1299 unicast_client_ep_qos_state(ep, buf, old_state); in unicast_client_ep_set_status()
1311 bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_set_status()
1315 unicast_client_ep_enabling_state(ep, buf, state_changed); in unicast_client_ep_set_status()
1327 bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_set_status()
1331 unicast_client_ep_streaming_state(ep, buf, state_changed); in unicast_client_ep_set_status()
1334 if (ep->dir == BT_AUDIO_DIR_SOURCE) { in unicast_client_ep_set_status()
1344 bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_set_status()
1351 bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_set_status()
1355 unicast_client_ep_disabling_state(ep, buf); in unicast_client_ep_set_status()
1370 if (ep->dir == BT_AUDIO_DIR_SOURCE) { in unicast_client_ep_set_status()
1378 bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_set_status()
1382 unicast_client_ep_releasing_state(ep, buf); in unicast_client_ep_set_status()
1393 static int unicast_client_ep_set_codec_cfg(struct bt_bap_ep *ep, uint8_t id, uint16_t cid, in unicast_client_ep_set_codec_cfg() argument
1397 if (!ep && !codec_cfg) { in unicast_client_ep_set_codec_cfg()
1401 LOG_DBG("ep %p codec id 0x%02x cid 0x%04x vid 0x%04x len %u", ep, id, cid, vid, len); in unicast_client_ep_set_codec_cfg()
1404 codec_cfg = &ep->codec_cfg; in unicast_client_ep_set_codec_cfg()
1488 static int unicast_client_ep_set_metadata(struct bt_bap_ep *ep, void *data, uint8_t len, in unicast_client_ep_set_metadata() argument
1491 if (!ep && !codec_cfg) { in unicast_client_ep_set_metadata()
1495 LOG_DBG("ep %p len %u codec_cfg %p", ep, len, codec_cfg); in unicast_client_ep_set_metadata()
1498 codec_cfg = &ep->codec_cfg; in unicast_client_ep_set_metadata()
1567 client_ep = CONTAINER_OF(stream->ep, struct bt_bap_unicast_client_ep, ep); in unicast_client_cp_notify()
1624 struct bt_bap_ep *ep; in unicast_client_ase_ntf_read_func() local
1672 ep = unicast_client_ep_get(conn, client->dir, handle); in unicast_client_ase_ntf_read_func()
1673 if (!ep) { in unicast_client_ase_ntf_read_func()
1674 LOG_DBG("Unknown %s ep for handle 0x%04X", bt_audio_dir_str(client->dir), handle); in unicast_client_ase_ntf_read_func()
1677 if (ep->reason == BT_HCI_ERR_SUCCESS) { in unicast_client_ase_ntf_read_func()
1678 ep->reason = BT_HCI_ERR_REMOTE_USER_TERM_CONN; in unicast_client_ase_ntf_read_func()
1681 unicast_client_ep_set_status(ep, &buf_clone); in unicast_client_ase_ntf_read_func()
1690 struct bt_conn *conn = client_ep->ep.stream->conn; in long_ase_read()
1695 LOG_DBG("conn %p ep %p 0x%04X", conn, &client_ep->ep, client_ep->handle); in long_ase_read()
1738 LOG_DBG("ep %p 0x%04X", &client_ep->ep, client_ep->handle); in delayed_ase_read_handler()
1752 struct bt_bap_ep *ep; in unicast_client_ep_notify() local
1755 ep = &client_ep->ep; in unicast_client_ep_notify()
1757 LOG_DBG("conn %p ep %p len %u", conn, ep, length); in unicast_client_ep_notify()
1793 if (ep->reason == BT_HCI_ERR_SUCCESS) { in unicast_client_ep_notify()
1794 ep->reason = BT_HCI_ERR_REMOTE_USER_TERM_CONN; in unicast_client_ep_notify()
1797 unicast_client_ep_set_status(ep, &buf); in unicast_client_ep_notify()
1802 static int unicast_client_ep_subscribe(struct bt_conn *conn, struct bt_bap_ep *ep) in unicast_client_ep_subscribe() argument
1807 client_ep = CONTAINER_OF(ep, struct bt_bap_unicast_client_ep, ep); in unicast_client_ep_subscribe()
1809 LOG_DBG("ep %p handle 0x%02x", ep, client_ep->handle); in unicast_client_ep_subscribe()
1906 static int unicast_client_ep_config(struct bt_bap_ep *ep, struct net_buf_simple *buf, in unicast_client_ep_config() argument
1911 LOG_DBG("ep %p buf %p codec %p", ep, buf, codec_cfg); in unicast_client_ep_config()
1913 if (!ep) { in unicast_client_ep_config()
1917 switch (ep->status.state) { in unicast_client_ep_config()
1926 LOG_ERR("Invalid state: %s", bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_config()
1930 LOG_DBG("id 0x%02x dir %s codec 0x%02x", ep->status.id, bt_audio_dir_str(ep->dir), in unicast_client_ep_config()
1934 req->ase = ep->status.id; in unicast_client_ep_config()
1947 int bt_bap_unicast_client_ep_qos(struct bt_bap_ep *ep, struct net_buf_simple *buf, in bt_bap_unicast_client_ep_qos() argument
1953 LOG_DBG("ep %p buf %p qos %p", ep, buf, qos); in bt_bap_unicast_client_ep_qos()
1955 if (!ep) { in bt_bap_unicast_client_ep_qos()
1959 switch (ep->status.state) { in bt_bap_unicast_client_ep_qos()
1966 LOG_ERR("Invalid state: %s", bt_bap_ep_state_str(ep->status.state)); in bt_bap_unicast_client_ep_qos()
1970 conn_iso = &ep->iso->chan.iso->iso; in bt_bap_unicast_client_ep_qos()
1974 ep->status.id, conn_iso->cig_id, conn_iso->cis_id, qos->interval, qos->framing, in bt_bap_unicast_client_ep_qos()
1978 req->ase = ep->status.id; in bt_bap_unicast_client_ep_qos()
1993 static int unicast_client_ep_enable(struct bt_bap_ep *ep, struct net_buf_simple *buf, in unicast_client_ep_enable() argument
1998 LOG_DBG("ep %p buf %p meta_len %zu", ep, buf, meta_len); in unicast_client_ep_enable()
2000 if (!ep) { in unicast_client_ep_enable()
2004 if (ep->status.state != BT_BAP_EP_STATE_QOS_CONFIGURED) { in unicast_client_ep_enable()
2005 LOG_ERR("Invalid state: %s", bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_enable()
2009 LOG_DBG("id 0x%02x", ep->status.id); in unicast_client_ep_enable()
2012 req->ase = ep->status.id; in unicast_client_ep_enable()
2020 static int unicast_client_ep_metadata(struct bt_bap_ep *ep, struct net_buf_simple *buf, in unicast_client_ep_metadata() argument
2025 LOG_DBG("ep %p buf %p meta_len %zu", ep, buf, meta_len); in unicast_client_ep_metadata()
2027 if (!ep) { in unicast_client_ep_metadata()
2031 switch (ep->status.state) { in unicast_client_ep_metadata()
2038 LOG_ERR("Invalid state: %s", bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_metadata()
2042 LOG_DBG("id 0x%02x", ep->status.id); in unicast_client_ep_metadata()
2045 req->ase = ep->status.id; in unicast_client_ep_metadata()
2053 static int unicast_client_ep_start(struct bt_bap_ep *ep, struct net_buf_simple *buf) in unicast_client_ep_start() argument
2055 LOG_DBG("ep %p buf %p", ep, buf); in unicast_client_ep_start()
2057 if (!ep) { in unicast_client_ep_start()
2061 if (ep->status.state != BT_BAP_EP_STATE_ENABLING && in unicast_client_ep_start()
2062 ep->status.state != BT_BAP_EP_STATE_DISABLING) { in unicast_client_ep_start()
2063 LOG_ERR("Invalid state: %s", bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_start()
2067 LOG_DBG("id 0x%02x", ep->status.id); in unicast_client_ep_start()
2069 net_buf_simple_add_u8(buf, ep->status.id); in unicast_client_ep_start()
2074 static int unicast_client_ep_disable(struct bt_bap_ep *ep, struct net_buf_simple *buf) in unicast_client_ep_disable() argument
2076 LOG_DBG("ep %p buf %p", ep, buf); in unicast_client_ep_disable()
2078 if (!ep) { in unicast_client_ep_disable()
2082 switch (ep->status.state) { in unicast_client_ep_disable()
2089 LOG_ERR("Invalid state: %s", bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_disable()
2093 LOG_DBG("id 0x%02x", ep->status.id); in unicast_client_ep_disable()
2095 net_buf_simple_add_u8(buf, ep->status.id); in unicast_client_ep_disable()
2100 static int unicast_client_ep_stop(struct bt_bap_ep *ep, struct net_buf_simple *buf) in unicast_client_ep_stop() argument
2102 LOG_DBG("ep %p buf %p", ep, buf); in unicast_client_ep_stop()
2104 if (!ep) { in unicast_client_ep_stop()
2109 if (ep->status.state != BT_BAP_EP_STATE_DISABLING) { in unicast_client_ep_stop()
2110 LOG_ERR("Invalid state: %s", bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_stop()
2114 LOG_DBG("id 0x%02x", ep->status.id); in unicast_client_ep_stop()
2116 net_buf_simple_add_u8(buf, ep->status.id); in unicast_client_ep_stop()
2121 static int unicast_client_ep_release(struct bt_bap_ep *ep, struct net_buf_simple *buf) in unicast_client_ep_release() argument
2123 LOG_DBG("ep %p buf %p", ep, buf); in unicast_client_ep_release()
2125 if (!ep) { in unicast_client_ep_release()
2129 switch (ep->status.state) { in unicast_client_ep_release()
2142 LOG_ERR("Invalid state: %s", bt_bap_ep_state_str(ep->status.state)); in unicast_client_ep_release()
2146 LOG_DBG("id 0x%02x", ep->status.id); in unicast_client_ep_release()
2148 net_buf_simple_add_u8(buf, ep->status.id); in unicast_client_ep_release()
2166 int bt_bap_unicast_client_ep_send(struct bt_conn *conn, struct bt_bap_ep *ep, in bt_bap_unicast_client_ep_send() argument
2173 CONTAINER_OF(ep, struct bt_bap_unicast_client_ep, ep); in bt_bap_unicast_client_ep_send()
2176 LOG_DBG("conn %p ep %p buf %p len %u", conn, ep, buf, buf->len); in bt_bap_unicast_client_ep_send()
2216 static void unicast_client_reset(struct bt_bap_ep *ep, uint8_t reason) in unicast_client_reset() argument
2219 CONTAINER_OF(ep, struct bt_bap_unicast_client_ep, ep); in unicast_client_reset()
2221 LOG_DBG("ep %p", ep); in unicast_client_reset()
2222 ep->reason = reason; in unicast_client_reset()
2225 unicast_client_ep_set_local_idle_state(ep); in unicast_client_reset()
2227 if (ep->iso != NULL && ep->iso->chan.state == BT_ISO_STATE_DISCONNECTING) { in unicast_client_reset()
2233 (void)memset(ep, 0, sizeof(*ep)); in unicast_client_reset()
2254 struct bt_bap_ep *ep = &uni_cli_insts[index].snks[i].ep; in unicast_client_ep_reset() local
2256 unicast_client_reset(ep, reason); in unicast_client_ep_reset()
2262 struct bt_bap_ep *ep = &uni_cli_insts[index].srcs[i].ep; in unicast_client_ep_reset() local
2264 unicast_client_reset(ep, reason); in unicast_client_ep_reset()
2388 if (stream->ep == NULL) { in audio_stream_qos_cleanup()
2393 bt_bap_iso_unbind_ep(stream->ep->iso, stream->ep); in audio_stream_qos_cleanup()
2440 if (stream->ep->iso == iso) { in unicast_group_del_iso()
2526 __ASSERT_NO_MSG(stream->ep == NULL || (stream->ep != NULL && stream->ep->iso == NULL)); in unicast_group_add_stream()
2533 if (stream->ep != NULL) { in unicast_group_add_stream()
2534 bt_bap_iso_bind_ep(iso, stream->ep); in unicast_group_add_stream()
2583 struct bt_bap_ep *ep = stream->ep; in unicast_group_del_stream() local
2589 if (ep != NULL && ep->iso != NULL) { in unicast_group_del_stream()
2590 unicast_group_del_iso(group, ep->iso); in unicast_group_del_stream()
2592 bt_bap_iso_unbind_ep(ep->iso, ep); in unicast_group_del_stream()
2645 struct bt_bap_ep *ep = stream->ep; in unicast_group_free() local
2660 if (ep != NULL && ep->iso != NULL) { in unicast_group_free()
2661 bt_bap_iso_unbind_ep(ep->iso, ep); in unicast_group_free()
3120 if (stream->ep != NULL) { in bt_bap_unicast_group_delete()
3144 struct bt_bap_ep *ep = stream->ep; in bt_bap_unicast_client_config() local
3166 err = unicast_client_ep_config(ep, buf, codec_cfg); in bt_bap_unicast_client_config()
3171 err = bt_bap_unicast_client_ep_send(stream->conn, ep, buf); in bt_bap_unicast_client_config()
3184 struct bt_bap_ep *ep; in bt_bap_unicast_client_qos() local
3207 ep = stream->ep; in bt_bap_unicast_client_qos()
3208 if (ep == NULL) { in bt_bap_unicast_client_qos()
3209 LOG_DBG("stream->ep is NULL"); in bt_bap_unicast_client_qos()
3216 switch (ep->status.state) { in bt_bap_unicast_client_qos()
3221 LOG_DBG("Invalid state: %s", bt_bap_ep_state_str(stream->ep->status.state)); in bt_bap_unicast_client_qos()
3229 /* Verify ep->dir */ in bt_bap_unicast_client_qos()
3230 switch (ep->dir) { in bt_bap_unicast_client_qos()
3235 __ASSERT(false, "invalid endpoint dir: %u", ep->dir); in bt_bap_unicast_client_qos()
3263 ep = NULL; /* Needed to find the control point handle */ in bt_bap_unicast_client_qos()
3272 if (stream->ep->iso == NULL) { in bt_bap_unicast_client_qos()
3274 bt_bap_iso_bind_ep(stream->bap_iso, stream->ep); in bt_bap_unicast_client_qos()
3277 err = bt_bap_unicast_client_ep_qos(stream->ep, buf, stream->qos); in bt_bap_unicast_client_qos()
3284 if (ep == NULL) { in bt_bap_unicast_client_qos()
3285 ep = stream->ep; in bt_bap_unicast_client_qos()
3289 err = bt_bap_unicast_client_ep_send(conn, ep, buf); in bt_bap_unicast_client_qos()
3303 struct bt_bap_ep *ep = stream->ep; in bt_bap_unicast_client_enable() local
3325 err = unicast_client_ep_enable(ep, buf, meta, meta_len); in bt_bap_unicast_client_enable()
3330 return bt_bap_unicast_client_ep_send(stream->conn, ep, buf); in bt_bap_unicast_client_enable()
3336 struct bt_bap_ep *ep = stream->ep; in bt_bap_unicast_client_metadata() local
3358 err = unicast_client_ep_metadata(ep, buf, meta, meta_len); in bt_bap_unicast_client_metadata()
3363 return bt_bap_unicast_client_ep_send(stream->conn, ep, buf); in bt_bap_unicast_client_metadata()
3417 struct bt_bap_ep *ep = stream->ep; in bt_bap_unicast_client_start() local
3429 if (ep->dir == BT_AUDIO_DIR_SINK) { in bt_bap_unicast_client_start()
3435 ep->receiver_ready = true; in bt_bap_unicast_client_start()
3437 err = unicast_client_send_start(ep); in bt_bap_unicast_client_start()
3442 ep->receiver_ready = false; in bt_bap_unicast_client_start()
3452 struct bt_bap_ep *ep = stream->ep; in bt_bap_unicast_client_disable() local
3474 err = unicast_client_ep_disable(ep, buf); in bt_bap_unicast_client_disable()
3479 return bt_bap_unicast_client_ep_send(stream->conn, ep, buf); in bt_bap_unicast_client_disable()
3484 struct bt_bap_ep *ep = stream->ep; in bt_bap_unicast_client_stop() local
3508 if (ep->iso == NULL) { in bt_bap_unicast_client_stop()
3513 iso_state = ep->iso->chan.state; in bt_bap_unicast_client_stop()
3531 if (ep->dir == BT_AUDIO_DIR_SOURCE) { in bt_bap_unicast_client_stop()
3532 err = unicast_client_ep_stop(ep, buf); in bt_bap_unicast_client_stop()
3538 err = bt_bap_unicast_client_ep_send(stream->conn, ep, buf); in bt_bap_unicast_client_stop()
3558 struct bt_bap_ep *ep = stream->ep; in bt_bap_unicast_client_release() local
3582 if (stream->ep->status.state == BT_BAP_EP_STATE_IDLE) { in bt_bap_unicast_client_release()
3585 err = unicast_client_ep_release(ep, buf); in bt_bap_unicast_client_release()
3596 err = bt_bap_unicast_client_ep_send(stream->conn, ep, buf); in bt_bap_unicast_client_release()
3601 client_ep = CONTAINER_OF(ep, struct bt_bap_unicast_client_ep, ep); in bt_bap_unicast_client_release()
3654 struct bt_bap_ep *ep; in unicast_client_ase_read_func() local
3695 ep = unicast_client_ep_get(conn, client->dir, handle); in unicast_client_ase_read_func()
3696 if (!ep) { in unicast_client_ase_read_func()
3707 unicast_client_ep_set_status(ep, buf); in unicast_client_ase_read_func()
3708 cb_err = unicast_client_ep_subscribe(conn, ep); in unicast_client_ase_read_func()
3710 LOG_DBG("Failed to subscribe to ep %p: %d", ep, cb_err); in unicast_client_ase_read_func()
3716 unicast_client_notify_endpoint(conn, ep); in unicast_client_ase_read_func()