Bluetooth: host: Initial support for BIS
Added initial support for BIS (broadcast ISO stream), which adds support for creating BISes as both broadcaster and receiver, as well as managing and creating BIGs. Extends PA sync to handle BIGInfo adveritising reports. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
3fbff9ab77
commit
a264efbcbc
13 changed files with 1025 additions and 38 deletions
|
@ -54,6 +54,9 @@ struct bt_le_per_adv_sync;
|
|||
/* Don't require everyone to include conn.h */
|
||||
struct bt_conn;
|
||||
|
||||
/* Don't require everyone to include iso.h */
|
||||
struct bt_iso_biginfo;
|
||||
|
||||
struct bt_le_ext_adv_sent_info {
|
||||
/** The number of advertising events completed. */
|
||||
uint8_t num_sent;
|
||||
|
@ -1191,6 +1194,17 @@ struct bt_le_per_adv_sync_cb {
|
|||
void (*state_changed)(struct bt_le_per_adv_sync *sync,
|
||||
const struct bt_le_per_adv_sync_state_info *info);
|
||||
|
||||
/**
|
||||
* @brief BIGInfo advertising report received.
|
||||
*
|
||||
* This callback notifies the application of a BIGInfo advertising report.
|
||||
* This is received if the advertiser is broadcasting isochronous streams in a BIG.
|
||||
* See iso.h for more information.
|
||||
*
|
||||
* @param sync The advertising set object.
|
||||
* @param biginfo The BIGInfo report.
|
||||
*/
|
||||
void (*biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo);
|
||||
|
||||
sys_snode_t node;
|
||||
};
|
||||
|
|
|
@ -2396,6 +2396,7 @@ struct bt_hci_evt_le_big_complete {
|
|||
uint8_t pto;
|
||||
uint8_t irc;
|
||||
uint16_t max_pdu;
|
||||
uint16_t iso_interval;
|
||||
uint8_t num_bis;
|
||||
uint16_t handle[0];
|
||||
} __packed;
|
||||
|
@ -2416,6 +2417,7 @@ struct bt_hci_evt_le_big_sync_established {
|
|||
uint8_t pto;
|
||||
uint8_t irc;
|
||||
uint16_t max_pdu;
|
||||
uint16_t iso_interval;
|
||||
uint8_t num_bis;
|
||||
uint16_t handle[0];
|
||||
} __packed;
|
||||
|
|
|
@ -79,24 +79,25 @@ struct bt_iso_chan_qos {
|
|||
/** @brief Channel direction
|
||||
*
|
||||
* Possible values: BT_ISO_CHAN_QOS_IN, BT_ISO_CHAN_QOS_OUT or
|
||||
* BT_ISO_CHAN_QOS_INOUT.
|
||||
* BT_ISO_CHAN_QOS_INOUT. Shall be BT_ISO_CHAN_QOS_IN for broadcast
|
||||
* transmitting, and BT_ISO_CHAN_QOS_OUT for broadcast receiver.
|
||||
*/
|
||||
uint8_t dir;
|
||||
/** Channel interval */
|
||||
/** Channel interval in us. Value range 0x0000FF - 0x0FFFFFF. */
|
||||
uint32_t interval;
|
||||
/** Channel SCA */
|
||||
/** Channel SCA - Only for CIS */
|
||||
uint8_t sca;
|
||||
/** Channel packing mode */
|
||||
/** Channel packing mode. 0 for unpacked, 1 for packed. */
|
||||
uint8_t packing;
|
||||
/** Channel framing mode */
|
||||
/** Channel framing mode. 0 for unframed, 1 for framed. */
|
||||
uint8_t framing;
|
||||
/** Channel Latency */
|
||||
/** Channel Latency in ms. Value range 0x0005 - 0x0FA0. */
|
||||
uint16_t latency;
|
||||
/** Channel SDU */
|
||||
/** Channel SDU. Value range 0x0000 0 0x0FFF. */
|
||||
uint8_t sdu;
|
||||
/** Channel PHY */
|
||||
/** Channel PHY - See BT_GAP_LE_PHY for values. Shall not be BT_GAP_LE_PHY_NONE. */
|
||||
uint8_t phy;
|
||||
/** Channel Retransmission Number */
|
||||
/** Channel Retransmission Number. Value range 0x00 - 0x0F. */
|
||||
uint8_t rtn;
|
||||
};
|
||||
|
||||
|
@ -118,6 +119,103 @@ struct bt_iso_chan_path {
|
|||
uint8_t cc[0];
|
||||
};
|
||||
|
||||
|
||||
/** Opaque type representing an Broadcast Isochronous Group (BIG). */
|
||||
struct bt_iso_big;
|
||||
|
||||
struct bt_iso_big_create_param {
|
||||
/** Array of pointers to BIS channels */
|
||||
struct bt_iso_chan **bis_channels;
|
||||
|
||||
/** Number channels in @p bis_channels */
|
||||
uint8_t num_bis;
|
||||
|
||||
/** Whether or not to encrypt the streams. */
|
||||
bool encryption;
|
||||
|
||||
/** @brief Broadcast code
|
||||
*
|
||||
* The code used to derive the session key that is used to encrypt and
|
||||
* decrypt BIS payloads.
|
||||
*/
|
||||
uint8_t bcode[16];
|
||||
};
|
||||
|
||||
struct bt_iso_big_sync_param {
|
||||
/** Array of pointers to BIS channels */
|
||||
struct bt_iso_chan **bis_channels;
|
||||
|
||||
/** Number channels in @p bis_channels */
|
||||
uint8_t num_bis;
|
||||
|
||||
/** Bitfield of the BISes to sync to */
|
||||
uint32_t bis_bitfield;
|
||||
|
||||
/** @brief Maximum subevents
|
||||
*
|
||||
* The MSE (Maximum Subevents) parameter is the maximum number of subevents that a
|
||||
* Controller should use to receive data payloads in each interval for a BIS
|
||||
*/
|
||||
uint32_t mse;
|
||||
|
||||
/** Synchronization timeout for the BIG (N * 10 MS) */
|
||||
uint16_t sync_timeout;
|
||||
|
||||
/** Whether or not the streams of the BIG are encrypted */
|
||||
bool encryption;
|
||||
|
||||
/** @brief Broadcast code
|
||||
*
|
||||
* The code used to derive the session key that is used to encrypt and
|
||||
* decrypt BIS payloads.
|
||||
*/
|
||||
uint8_t bcode[16];
|
||||
};
|
||||
|
||||
struct bt_iso_biginfo {
|
||||
/** Address of the advertiser */
|
||||
const bt_addr_le_t *addr;
|
||||
|
||||
/** Advertiser SID */
|
||||
uint8_t sid;
|
||||
|
||||
/** Number of BISes in the BIG */
|
||||
uint8_t num_bis;
|
||||
|
||||
/** Maximum number of subevents in each isochronous event */
|
||||
uint8_t sub_evt_count;
|
||||
|
||||
/** Interval between two BIG anchor point (N * 1.25 ms) */
|
||||
uint16_t iso_interval;
|
||||
|
||||
/** The number of new payloads in each BIS event */
|
||||
uint8_t burst_number;
|
||||
|
||||
/** Offset used for pre-transmissions */
|
||||
uint8_t offset;
|
||||
|
||||
/** The number of times a payload is transmitted in a BIS event */
|
||||
uint8_t rep_count;
|
||||
|
||||
/** Maximum size, in octets, of the payload */
|
||||
uint16_t max_pdu;
|
||||
|
||||
/** The interval, in microseconds, of periodic SDUs. */
|
||||
uint32_t sdu_interval;
|
||||
|
||||
/** Maximum size of an SDU, in octets. */
|
||||
uint16_t max_sdu;
|
||||
|
||||
/** Channel PHY */
|
||||
uint8_t phy;
|
||||
|
||||
/** Channel framing mode */
|
||||
uint8_t framing;
|
||||
|
||||
/** Whether or not the BIG is encrypted */
|
||||
bool encryption;
|
||||
};
|
||||
|
||||
/** @brief ISO Channel operations structure. */
|
||||
struct bt_iso_chan_ops {
|
||||
/** @brief Channel connected callback
|
||||
|
@ -245,6 +343,38 @@ int bt_iso_chan_disconnect(struct bt_iso_chan *chan);
|
|||
*/
|
||||
int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf);
|
||||
|
||||
/** @brief Creates a BIG as a broadcaster
|
||||
*
|
||||
* @param[in] padv Pointer to the periodic advertising object the BIGInfo shall be sent on.
|
||||
* @param[in] param The parameters used to create and enable the BIG. The QOS parameters are
|
||||
* determined by the QOS field of the first BIS in the BIS list of this
|
||||
* parameter.
|
||||
* @param[out] out_big Broadcast Isochronous Group object on success.
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_iso_big_create(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param,
|
||||
struct bt_iso_big **out_big);
|
||||
|
||||
/** @brief Terminates a BIG as a broadcaster or receiver
|
||||
*
|
||||
* @param big Pointer to the BIG structure.
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_iso_big_terminate(struct bt_iso_big *big);
|
||||
|
||||
/** @brief Creates a BIG as a receiver
|
||||
*
|
||||
* @param[in] sync Pointer to the periodic advertising sync object the BIGInfo was received on.
|
||||
* @param[in] param The parameters used to create and enable the BIG sync.
|
||||
* @param[out] out_big Broadcast Isochronous Group object on success.
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param,
|
||||
struct bt_iso_big **out_big);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue