diff --git a/include/bluetooth/iso.h b/include/bluetooth/iso.h index 61a531a4060..ce901925245 100644 --- a/include/bluetooth/iso.h +++ b/include/bluetooth/iso.h @@ -607,6 +607,31 @@ int bt_iso_chan_disconnect(struct bt_iso_chan *chan); */ int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf); +/** ISO channel Info Structure */ +struct bt_iso_info { + /** Channel Type. */ + enum bt_iso_chan_type type; +}; + +/** @brief Get ISO channel info + * + * @param chan Channel object. + * @param info Channel info object. + * + * @return Zero on success or (negative) error code on failure. + */ +int bt_iso_chan_get_info(const struct bt_iso_chan *chan, + struct bt_iso_info *info); + +/** @brief Get the type of an ISO channel + * + * @param chan Channel object. + * + * @return enum bt_iso_chan_type The type of the channel. If @p is NULL this + * will be BT_ISO_CHAN_TYPE_NONE. + */ +enum bt_iso_chan_type bt_iso_chan_get_type(const struct bt_iso_chan *chan); + /** @brief Creates a BIG as a broadcaster * * @param[in] padv Pointer to the periodic advertising object the BIGInfo shall be sent on. diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index 63fa848663c..0193fe92a21 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -560,6 +560,29 @@ void bt_iso_chan_set_state(struct bt_iso_chan *chan, uint8_t state) } #endif /* CONFIG_BT_DEBUG_ISO */ +int bt_iso_chan_get_info(const struct bt_iso_chan *chan, + struct bt_iso_info *info) +{ + CHECKIF(chan == NULL) { + BT_DBG("chan is NULL"); + return -EINVAL; + } + + CHECKIF(chan->iso == NULL) { + BT_DBG("chan->iso is NULL"); + return -EINVAL; + } + + CHECKIF(info == NULL) { + BT_DBG("info is NULL"); + return -EINVAL; + } + + info->type = chan->iso->iso.type; + + return 0; +} + #if defined(CONFIG_BT_ISO_UNICAST) || defined(CONFIG_BT_ISO_SYNC_RECEIVER) struct net_buf *bt_iso_get_rx(k_timeout_t timeout) {