Bluetooth: ISO: Add function to get info of ISO channel
The application may want to want the type of an ISO channel, and take action based on what the type is. It has been implemented as a get_info to be consistent with other get_info functions in the Bluetooth subsystem. The bt_iso_info struct can be expanded with more information later as required. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
c6b78b93d9
commit
0785e9479d
2 changed files with 48 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue