Bluetooth: Audio: Rename bt_audio_broadcast_source to bt_bap_...
Rename the bt_audio_broadcast_source API to bt_bap_broadcast_source and move the API to bap.h Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
06d00ff5f9
commit
be42429f90
22 changed files with 427 additions and 478 deletions
|
@ -11,5 +11,5 @@ API Reference
|
|||
.. doxygengroup:: bt_audio_client
|
||||
.. doxygengroup:: bt_bap_unicast_server
|
||||
.. doxygengroup:: bt_bap_broadcast_sink
|
||||
.. doxygengroup:: bt_audio_broadcast
|
||||
.. doxygengroup:: bt_bap_broadcast_source
|
||||
.. doxygengroup:: bt_audio_codec_cfg
|
||||
|
|
|
@ -211,9 +211,6 @@ enum bt_audio_metadata_type {
|
|||
/** @brief Abstract Audio Unicast Group structure. */
|
||||
struct bt_audio_unicast_group;
|
||||
|
||||
/** @brief Abstract Audio Broadcast Source structure. */
|
||||
struct bt_audio_broadcast_source;
|
||||
|
||||
/** @brief Codec configuration structure */
|
||||
struct bt_codec_data {
|
||||
struct bt_data data;
|
||||
|
@ -1405,11 +1402,8 @@ struct bt_audio_stream {
|
|||
struct bt_audio_iso *audio_iso;
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST_CLIENT */
|
||||
|
||||
union {
|
||||
/** Unicast or Broadcast group - Used internally */
|
||||
void *group;
|
||||
struct bt_audio_unicast_group *unicast_group;
|
||||
struct bt_audio_broadcast_source *broadcast_source;
|
||||
};
|
||||
|
||||
/** Stream user data */
|
||||
void *user_data;
|
||||
|
@ -1557,7 +1551,7 @@ struct bt_audio_stream_ops {
|
|||
struct net_buf *buf);
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
/** @brief Stream audio HCI sent callback
|
||||
*
|
||||
* If this callback is provided it will be called whenever a SDU has
|
||||
|
@ -1568,8 +1562,7 @@ struct bt_audio_stream_ops {
|
|||
* @param chan The channel which has sent data.
|
||||
*/
|
||||
void (*sent)(struct bt_audio_stream *stream);
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
};
|
||||
|
||||
/** @brief Register Audio callbacks for a stream.
|
||||
|
@ -1579,8 +1572,7 @@ struct bt_audio_stream_ops {
|
|||
* @param stream Stream object.
|
||||
* @param ops Stream operations structure.
|
||||
*/
|
||||
void bt_audio_stream_cb_register(struct bt_audio_stream *stream,
|
||||
struct bt_audio_stream_ops *ops);
|
||||
void bt_audio_stream_cb_register(struct bt_audio_stream *stream, struct bt_audio_stream_ops *ops);
|
||||
|
||||
/** Structure holding information of audio stream endpoint */
|
||||
struct bt_audio_ep_info {
|
||||
|
@ -1601,8 +1593,7 @@ struct bt_audio_ep_info {
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_audio_ep_get_info(const struct bt_audio_ep *ep,
|
||||
struct bt_audio_ep_info *info);
|
||||
int bt_audio_ep_get_info(const struct bt_audio_ep *ep, struct bt_audio_ep_info *info);
|
||||
|
||||
/**
|
||||
* @defgroup bt_audio_client Audio Client APIs
|
||||
|
@ -1620,8 +1611,7 @@ struct bt_audio_discover_params;
|
|||
* The @p codec is only valid while in the callback, so the values must be stored by the receiver
|
||||
* if future use is wanted.
|
||||
*/
|
||||
typedef void (*bt_audio_discover_func_t)(struct bt_conn *conn,
|
||||
struct bt_codec *codec,
|
||||
typedef void (*bt_audio_discover_func_t)(struct bt_conn *conn, struct bt_codec *codec,
|
||||
struct bt_audio_ep *ep,
|
||||
struct bt_audio_discover_params *params);
|
||||
|
||||
|
@ -1651,8 +1641,7 @@ struct bt_audio_discover_params {
|
|||
* @param conn Connection object
|
||||
* @param params Discover parameters
|
||||
*/
|
||||
int bt_audio_discover(struct bt_conn *conn,
|
||||
struct bt_audio_discover_params *params);
|
||||
int bt_audio_discover(struct bt_conn *conn, struct bt_audio_discover_params *params);
|
||||
|
||||
/** @brief Configure Audio Stream
|
||||
*
|
||||
|
@ -1666,10 +1655,8 @@ int bt_audio_discover(struct bt_conn *conn,
|
|||
*
|
||||
* @return Allocated Audio Stream object or NULL in case of error.
|
||||
*/
|
||||
int bt_audio_stream_config(struct bt_conn *conn,
|
||||
struct bt_audio_stream *stream,
|
||||
struct bt_audio_ep *ep,
|
||||
struct bt_codec *codec);
|
||||
int bt_audio_stream_config(struct bt_conn *conn, struct bt_audio_stream *stream,
|
||||
struct bt_audio_ep *ep, struct bt_codec *codec);
|
||||
|
||||
/** @brief Reconfigure Audio Stream
|
||||
*
|
||||
|
@ -1683,8 +1670,7 @@ int bt_audio_stream_config(struct bt_conn *conn,
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_audio_stream_reconfig(struct bt_audio_stream *stream,
|
||||
struct bt_codec *codec);
|
||||
int bt_audio_stream_reconfig(struct bt_audio_stream *stream, struct bt_codec *codec);
|
||||
|
||||
/** @brief Configure Audio Stream QoS
|
||||
*
|
||||
|
@ -1698,8 +1684,7 @@ int bt_audio_stream_reconfig(struct bt_audio_stream *stream,
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_audio_stream_qos(struct bt_conn *conn,
|
||||
struct bt_audio_unicast_group *group);
|
||||
int bt_audio_stream_qos(struct bt_conn *conn, struct bt_audio_unicast_group *group);
|
||||
|
||||
/** @brief Enable Audio Stream
|
||||
*
|
||||
|
@ -1714,8 +1699,7 @@ int bt_audio_stream_qos(struct bt_conn *conn,
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_audio_stream_enable(struct bt_audio_stream *stream,
|
||||
struct bt_codec_data *meta,
|
||||
int bt_audio_stream_enable(struct bt_audio_stream *stream, struct bt_codec_data *meta,
|
||||
size_t meta_count);
|
||||
|
||||
/** @brief Change Audio Stream Metadata
|
||||
|
@ -1729,8 +1713,7 @@ int bt_audio_stream_enable(struct bt_audio_stream *stream,
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_audio_stream_metadata(struct bt_audio_stream *stream,
|
||||
struct bt_codec_data *meta,
|
||||
int bt_audio_stream_metadata(struct bt_audio_stream *stream, struct bt_codec_data *meta,
|
||||
size_t meta_count);
|
||||
|
||||
/** @brief Disable Audio Stream
|
||||
|
@ -1765,7 +1748,7 @@ int bt_audio_stream_disable(struct bt_audio_stream *stream);
|
|||
*
|
||||
* This shall only be called for unicast streams.
|
||||
* Broadcast sinks will always be started once synchronized, and broadcast
|
||||
* source streams shall be started with bt_audio_broadcast_source_start().
|
||||
* source streams shall be started with bt_bap_broadcast_source_start().
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
|
@ -1779,7 +1762,7 @@ int bt_audio_stream_start(struct bt_audio_stream *stream);
|
|||
*
|
||||
* This shall only be called for unicast streams.
|
||||
* Broadcast sinks cannot be stopped.
|
||||
* Broadcast sources shall be stopped with bt_audio_broadcast_source_stop().
|
||||
* Broadcast sources shall be stopped with bt_bap_broadcast_source_stop().
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
|
@ -1795,7 +1778,7 @@ int bt_audio_stream_stop(struct bt_audio_stream *stream);
|
|||
* Broadcast sink streams cannot be released, but can be deleted by
|
||||
* bt_bap_broadcast_sink_delete().
|
||||
* Broadcast source streams cannot be released, but can be deleted by
|
||||
* bt_audio_broadcast_source_delete().
|
||||
* bt_bap_broadcast_source_delete().
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
|
@ -1823,8 +1806,8 @@ int bt_audio_stream_release(struct bt_audio_stream *stream);
|
|||
*
|
||||
* @return Bytes sent in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_audio_stream_send(struct bt_audio_stream *stream, struct net_buf *buf,
|
||||
uint16_t seq_num, uint32_t ts);
|
||||
int bt_audio_stream_send(struct bt_audio_stream *stream, struct net_buf *buf, uint16_t seq_num,
|
||||
uint32_t ts);
|
||||
|
||||
struct bt_audio_unicast_group_stream_param {
|
||||
/** Pointer to a stream object. */
|
||||
|
@ -1917,201 +1900,6 @@ int bt_audio_unicast_group_delete(struct bt_audio_unicast_group *unicast_group);
|
|||
|
||||
/** @} */ /* End of group bt_audio_client */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Audio Broadcast APIs
|
||||
* @defgroup bt_audio_broadcast Audio Broadcast APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
struct bt_audio_broadcast_source_stream_param {
|
||||
/** Audio stream */
|
||||
struct bt_audio_stream *stream;
|
||||
|
||||
/** The number of elements in the @p data array.
|
||||
*
|
||||
* The BIS specific data may be omitted and this set to 0.
|
||||
*/
|
||||
size_t data_count;
|
||||
|
||||
/** BIS Codec Specific Configuration */
|
||||
struct bt_codec_data *data;
|
||||
};
|
||||
|
||||
struct bt_audio_broadcast_source_subgroup_param {
|
||||
/** The number of parameters in @p stream_params */
|
||||
size_t params_count;
|
||||
|
||||
/** Array of stream parameters */
|
||||
struct bt_audio_broadcast_source_stream_param *params;
|
||||
|
||||
/** Subgroup Codec configuration. */
|
||||
struct bt_codec *codec;
|
||||
};
|
||||
|
||||
struct bt_audio_broadcast_source_create_param {
|
||||
/** The number of parameters in @p subgroup_params */
|
||||
size_t params_count;
|
||||
|
||||
/** Array of stream parameters */
|
||||
struct bt_audio_broadcast_source_subgroup_param *params;
|
||||
|
||||
/** Quality of Service configuration. */
|
||||
struct bt_codec_qos *qos;
|
||||
|
||||
/** @brief Broadcast Source packing mode.
|
||||
*
|
||||
* @ref BT_ISO_PACKING_SEQUENTIAL or @ref BT_ISO_PACKING_INTERLEAVED.
|
||||
*
|
||||
* @note This is a recommendation to the controller, which the
|
||||
* controller may ignore.
|
||||
*/
|
||||
uint8_t packing;
|
||||
|
||||
/** Whether or not to encrypt the streams. */
|
||||
bool encryption;
|
||||
|
||||
/**
|
||||
* @brief Broadcast code
|
||||
*
|
||||
* If the value is a string or a the value is less than 16 octets,
|
||||
* the remaining octets shall be 0.
|
||||
*
|
||||
* Example:
|
||||
* The string "Broadcast Code" shall be
|
||||
* [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]
|
||||
*/
|
||||
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
|
||||
};
|
||||
|
||||
/** @brief Create audio broadcast source.
|
||||
*
|
||||
* Create a new audio broadcast source with one or more audio streams.
|
||||
*
|
||||
* The broadcast source will be visible for scanners once this has been called,
|
||||
* and the device will advertise audio announcements.
|
||||
*
|
||||
* No audio data can be sent until bt_audio_broadcast_source_start() has been
|
||||
* called and no audio information (BIGInfo) will be visible to scanners
|
||||
* (see bt_le_per_adv_sync_cb).
|
||||
*
|
||||
* @param[in] param Pointer to parameters used to create the broadcast
|
||||
* source.
|
||||
* @param[out] source Pointer to the broadcast source created
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_audio_broadcast_source_create(struct bt_audio_broadcast_source_create_param *param,
|
||||
struct bt_audio_broadcast_source **source);
|
||||
|
||||
/** @brief Reconfigure audio broadcast source.
|
||||
*
|
||||
* Reconfigure an audio broadcast source with a new codec and codec quality of
|
||||
* service parameters. This can only be done when the source is stopped.
|
||||
*
|
||||
* @param source Pointer to the broadcast source
|
||||
* @param codec Codec configuration.
|
||||
* @param qos Quality of Service configuration
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_audio_broadcast_source_reconfig(struct bt_audio_broadcast_source *source,
|
||||
struct bt_codec *codec,
|
||||
struct bt_codec_qos *qos);
|
||||
|
||||
/** @brief Modify the metadata of an audio broadcast source.
|
||||
*
|
||||
* Modify the metadata an audio broadcast source. This can only be done when
|
||||
* the source is started. To update the metadata in the stopped state, use
|
||||
* bt_audio_broadcast_source_reconfig().
|
||||
*
|
||||
* @param source Pointer to the broadcast source.
|
||||
* @param meta Metadata entries.
|
||||
* @param meta_count Number of metadata entries.
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_audio_broadcast_source_update_metadata(struct bt_audio_broadcast_source *source,
|
||||
const struct bt_codec_data meta[],
|
||||
size_t meta_count);
|
||||
|
||||
/** @brief Start audio broadcast source.
|
||||
*
|
||||
* Start an audio broadcast source with one or more audio streams.
|
||||
* The broadcast source will start advertising BIGInfo, and audio data can
|
||||
* be streamed.
|
||||
*
|
||||
* @param source Pointer to the broadcast source
|
||||
* @param adv Pointer to an extended advertising set with periodic
|
||||
* advertising configured.
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_audio_broadcast_source_start(struct bt_audio_broadcast_source *source,
|
||||
struct bt_le_ext_adv *adv);
|
||||
|
||||
/** @brief Stop audio broadcast source.
|
||||
*
|
||||
* Stop an audio broadcast source.
|
||||
* The broadcast source will stop advertising BIGInfo, and audio data can no
|
||||
* longer be streamed.
|
||||
*
|
||||
* @param source Pointer to the broadcast source
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_audio_broadcast_source_stop(struct bt_audio_broadcast_source *source);
|
||||
|
||||
/** @brief Delete audio broadcast source.
|
||||
*
|
||||
* Delete an audio broadcast source.
|
||||
* The broadcast source will stop advertising entirely, and the source can
|
||||
* no longer be used.
|
||||
*
|
||||
* @param source Pointer to the broadcast source
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_audio_broadcast_source_delete(struct bt_audio_broadcast_source *source);
|
||||
|
||||
/**
|
||||
* @brief Get the broadcast ID of a broadcast source
|
||||
*
|
||||
* This will return the 3-octet broadcast ID that should be advertised in the
|
||||
* extended advertising data with @ref BT_UUID_BROADCAST_AUDIO_VAL as
|
||||
* @ref BT_DATA_SVC_DATA16.
|
||||
*
|
||||
* See table 3.14 in the Basic Audio Profile v1.0.1 for the structure.
|
||||
*
|
||||
* @param[in] source Pointer to the broadcast source.
|
||||
* @param[out] broadcast_id Pointer to the 3-octet broadcast ID.
|
||||
*
|
||||
* @return int 0 if on success, errno on error.
|
||||
*/
|
||||
int bt_audio_broadcast_source_get_id(const struct bt_audio_broadcast_source *source,
|
||||
uint32_t *const broadcast_id);
|
||||
|
||||
/**
|
||||
* @brief Get the Broadcast Audio Stream Endpoint of a broadcast source
|
||||
*
|
||||
* This will encode the BASE of a broadcast source into a buffer, that can be
|
||||
* used for advertisement. The encoded BASE will thus be encoded as
|
||||
* little-endian. The BASE shall be put into the periodic advertising data
|
||||
* (see bt_le_per_adv_set_data()).
|
||||
*
|
||||
* See table 3.15 in the Basic Audio Profile v1.0.1 for the structure.
|
||||
*
|
||||
* @param source Pointer to the broadcast source.
|
||||
* @param base_buf Pointer to a buffer where the BASE will be inserted.
|
||||
*
|
||||
* @return int 0 if on success, errno on error.
|
||||
*/
|
||||
int bt_audio_broadcast_source_get_base(struct bt_audio_broadcast_source *source,
|
||||
struct net_buf_simple *base_buf);
|
||||
|
||||
/** @} */ /* End of bt_audio_broadcast */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Audio codec Config APIs
|
||||
* @defgroup bt_audio_codec_cfg Codec config parsing APIs
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
|
||||
#define BT_BAP_BIS_SYNC_NO_PREF 0xFFFFFFFF
|
||||
|
||||
/** @brief Abstract Audio Broadcast Source structure. */
|
||||
struct bt_bap_broadcast_source;
|
||||
|
||||
/** @brief Abstract Audio Broadcast Sink structure. */
|
||||
struct bt_bap_broadcast_sink;
|
||||
|
||||
|
@ -275,6 +278,198 @@ int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_audio_strea
|
|||
|
||||
/** @} */ /* End of group bt_bap_unicast_server */
|
||||
|
||||
/**
|
||||
* @brief BAP Broadcast Source APIs
|
||||
* @defgroup bt_bap_broadcast_source BAP Broadcast Source APIs
|
||||
* @ingroup bt_bap
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Broadcast Source stream parameters */
|
||||
struct bt_bap_broadcast_source_stream_param {
|
||||
/** Audio stream */
|
||||
struct bt_audio_stream *stream;
|
||||
|
||||
/**
|
||||
* @brief The number of elements in the @p data array.
|
||||
*
|
||||
* The BIS specific data may be omitted and this set to 0.
|
||||
*/
|
||||
size_t data_count;
|
||||
|
||||
/** BIS Codec Specific Configuration */
|
||||
struct bt_codec_data *data;
|
||||
};
|
||||
|
||||
/** Broadcast Source subgroup parameters*/
|
||||
struct bt_bap_broadcast_source_subgroup_param {
|
||||
/** The number of parameters in @p stream_params */
|
||||
size_t params_count;
|
||||
|
||||
/** Array of stream parameters */
|
||||
struct bt_bap_broadcast_source_stream_param *params;
|
||||
|
||||
/** Subgroup Codec configuration. */
|
||||
struct bt_codec *codec;
|
||||
};
|
||||
|
||||
/** Broadcast Source create parameters */
|
||||
struct bt_bap_broadcast_source_create_param {
|
||||
/** The number of parameters in @p subgroup_params */
|
||||
size_t params_count;
|
||||
|
||||
/** Array of stream parameters */
|
||||
struct bt_bap_broadcast_source_subgroup_param *params;
|
||||
|
||||
/** Quality of Service configuration. */
|
||||
struct bt_codec_qos *qos;
|
||||
|
||||
/**
|
||||
* @brief Broadcast Source packing mode.
|
||||
*
|
||||
* @ref BT_ISO_PACKING_SEQUENTIAL or @ref BT_ISO_PACKING_INTERLEAVED.
|
||||
*
|
||||
* @note This is a recommendation to the controller, which the controller may ignore.
|
||||
*/
|
||||
uint8_t packing;
|
||||
|
||||
/** Whether or not to encrypt the streams. */
|
||||
bool encryption;
|
||||
|
||||
/**
|
||||
* @brief Broadcast code
|
||||
*
|
||||
* If the value is a string or a the value is less than 16 octets,
|
||||
* the remaining octets shall be 0.
|
||||
*
|
||||
* Example:
|
||||
* The string "Broadcast Code" shall be
|
||||
* [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]
|
||||
*/
|
||||
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Create audio broadcast source.
|
||||
*
|
||||
* Create a new audio broadcast source with one or more audio streams.
|
||||
*
|
||||
* The broadcast source will be visible for scanners once this has been called,
|
||||
* and the device will advertise audio announcements.
|
||||
*
|
||||
* No audio data can be sent until bt_bap_broadcast_source_start() has been called and no audio
|
||||
* information (BIGInfo) will be visible to scanners (see @ref bt_le_per_adv_sync_cb).
|
||||
*
|
||||
* @param[in] param Pointer to parameters used to create the broadcast source.
|
||||
* @param[out] source Pointer to the broadcast source created
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_create_param *param,
|
||||
struct bt_bap_broadcast_source **source);
|
||||
|
||||
/**
|
||||
* @brief Reconfigure audio broadcast source.
|
||||
*
|
||||
* Reconfigure an audio broadcast source with a new codec and codec quality of
|
||||
* service parameters. This can only be done when the source is stopped.
|
||||
*
|
||||
* @param source Pointer to the broadcast source
|
||||
* @param codec Codec configuration.
|
||||
* @param qos Quality of Service configuration
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, struct bt_codec *codec,
|
||||
struct bt_codec_qos *qos);
|
||||
|
||||
/**
|
||||
* @brief Modify the metadata of an audio broadcast source.
|
||||
*
|
||||
* Modify the metadata an audio broadcast source. This can only be done when the source is started.
|
||||
* To update the metadata in the stopped state, use bt_bap_broadcast_source_reconfig().
|
||||
*
|
||||
* @param source Pointer to the broadcast source.
|
||||
* @param meta Metadata entries.
|
||||
* @param meta_count Number of metadata entries.
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_bap_broadcast_source_update_metadata(struct bt_bap_broadcast_source *source,
|
||||
const struct bt_codec_data meta[], size_t meta_count);
|
||||
|
||||
/**
|
||||
* @brief Start audio broadcast source.
|
||||
*
|
||||
* Start an audio broadcast source with one or more audio streams.
|
||||
* The broadcast source will start advertising BIGInfo, and audio data can be streamed.
|
||||
*
|
||||
* @param source Pointer to the broadcast source
|
||||
* @param adv Pointer to an extended advertising set with periodic advertising configured.
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_bap_broadcast_source_start(struct bt_bap_broadcast_source *source,
|
||||
struct bt_le_ext_adv *adv);
|
||||
|
||||
/**
|
||||
* @brief Stop audio broadcast source.
|
||||
*
|
||||
* Stop an audio broadcast source.
|
||||
* The broadcast source will stop advertising BIGInfo, and audio data can no longer be streamed.
|
||||
*
|
||||
* @param source Pointer to the broadcast source
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_bap_broadcast_source_stop(struct bt_bap_broadcast_source *source);
|
||||
|
||||
/**
|
||||
* @brief Delete audio broadcast source.
|
||||
*
|
||||
* Delete an audio broadcast source.
|
||||
* The broadcast source will stop advertising entirely, and the source can no longer be used.
|
||||
*
|
||||
* @param source Pointer to the broadcast source
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_bap_broadcast_source_delete(struct bt_bap_broadcast_source *source);
|
||||
|
||||
/**
|
||||
* @brief Get the broadcast ID of a broadcast source
|
||||
*
|
||||
* This will return the 3-octet broadcast ID that should be advertised in the
|
||||
* extended advertising data with @ref BT_UUID_BROADCAST_AUDIO_VAL as @ref BT_DATA_SVC_DATA16.
|
||||
*
|
||||
* See table 3.14 in the Basic Audio Profile v1.0.1 for the structure.
|
||||
*
|
||||
* @param[in] source Pointer to the broadcast source.
|
||||
* @param[out] broadcast_id Pointer to the 3-octet broadcast ID.
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_bap_broadcast_source_get_id(const struct bt_bap_broadcast_source *source,
|
||||
uint32_t *const broadcast_id);
|
||||
|
||||
/**
|
||||
* @brief Get the Broadcast Audio Stream Endpoint of a broadcast source
|
||||
*
|
||||
* This will encode the BASE of a broadcast source into a buffer, that can be used for
|
||||
* advertisement. The encoded BASE will thus be encoded as little-endian. The BASE shall be put into
|
||||
* the periodic advertising data (see bt_le_per_adv_set_data()).
|
||||
*
|
||||
* See table 3.15 in the Basic Audio Profile v1.0.1 for the structure.
|
||||
*
|
||||
* @param source Pointer to the broadcast source.
|
||||
* @param base_buf Pointer to a buffer where the BASE will be inserted.
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_bap_broadcast_source_get_base(struct bt_bap_broadcast_source *source,
|
||||
struct net_buf_simple *base_buf);
|
||||
|
||||
/** @} */ /* End of bt_bap_broadcast_source */
|
||||
|
||||
/**
|
||||
* @brief BAP Broadcast Sink APIs
|
||||
|
|
|
@ -322,7 +322,7 @@ struct bt_cap_initiator_broadcast_create_param {
|
|||
* bt_audio_stream_send().
|
||||
*
|
||||
* @note @kconfig{CONFIG_BT_CAP_INITIATOR} and
|
||||
* @kconfig{CONFIG_BT_AUDIO_BROADCAST_SOURCE} must be enabled for this function
|
||||
* @kconfig{CONFIG_BT_BAP_BROADCAST_SOURCE} must be enabled for this function
|
||||
* to be enabled.
|
||||
*
|
||||
* @param[in] param Parameters to start the audio streams.
|
||||
|
@ -339,7 +339,7 @@ int bt_cap_initiator_broadcast_audio_start(struct bt_cap_initiator_broadcast_cre
|
|||
* @brief Update broadcast audio streams for a Common Audio Profile broadcast source.
|
||||
*
|
||||
* @note @kconfig{CONFIG_BT_CAP_INITIATOR} and
|
||||
* @kconfig{CONFIG_BT_AUDIO_BROADCAST_SOURCE} must be enabled for this function
|
||||
* @kconfig{CONFIG_BT_BAP_BROADCAST_SOURCE} must be enabled for this function
|
||||
* to be enabled.
|
||||
*
|
||||
* @param broadcast_source The broadcast source to update.
|
||||
|
@ -357,7 +357,7 @@ int bt_cap_initiator_broadcast_audio_update(struct bt_cap_broadcast_source *broa
|
|||
* @brief Stop broadcast audio streams for a Common Audio Profile broadcast source.
|
||||
*
|
||||
* @note @kconfig{CONFIG_BT_CAP_INITIATOR} and
|
||||
* @kconfig{CONFIG_BT_AUDIO_BROADCAST_SOURCE} must be enabled for this function
|
||||
* @kconfig{CONFIG_BT_BAP_BROADCAST_SOURCE} must be enabled for this function
|
||||
* to be enabled.
|
||||
*
|
||||
* @param broadcast_source The broadcast source to stop. The audio streams
|
||||
|
@ -376,7 +376,7 @@ int bt_cap_initiator_broadcast_audio_stop(struct bt_cap_broadcast_source *broadc
|
|||
* broadcast source.
|
||||
*
|
||||
* @note @kconfig{CONFIG_BT_CAP_INITIATOR} and
|
||||
* @kconfig{CONFIG_BT_AUDIO_BROADCAST_SOURCE} must be enabled for this function
|
||||
* @kconfig{CONFIG_BT_BAP_BROADCAST_SOURCE} must be enabled for this function
|
||||
* to be enabled.
|
||||
*
|
||||
* @param broadcast_source The broadcast source to delete.
|
||||
|
@ -457,7 +457,7 @@ struct bt_cap_unicast_to_broadcast_param {
|
|||
*
|
||||
* @note @kconfig{CONFIG_BT_CAP_INITIATOR},
|
||||
* @kconfig{CONFIG_BT_AUDIO_UNICAST_CLIENT} and
|
||||
* @kconfig{CONFIG_BT_AUDIO_BROADCAST_SOURCE} must be enabled for this function
|
||||
* @kconfig{CONFIG_BT_BAP_BROADCAST_SOURCE} must be enabled for this function
|
||||
* to be enabled.
|
||||
*
|
||||
* @param param The parameters for the handover.
|
||||
|
@ -500,7 +500,7 @@ struct bt_cap_broadcast_to_unicast_param {
|
|||
*
|
||||
* @note @kconfig{CONFIG_BT_CAP_INITIATOR},
|
||||
* @kconfig{CONFIG_BT_AUDIO_UNICAST_CLIENT} and
|
||||
* @kconfig{CONFIG_BT_AUDIO_BROADCAST_SOURCE} must be enabled for this function
|
||||
* @kconfig{CONFIG_BT_BAP_BROADCAST_SOURCE} must be enabled for this function
|
||||
* to be enabled.
|
||||
*
|
||||
* @param[in] param The parameters for the handover.
|
||||
|
|
|
@ -3,11 +3,11 @@ CONFIG_MAIN_STACK_SIZE=2048
|
|||
CONFIG_BT=y
|
||||
CONFIG_BT_DEBUG_LOG=y
|
||||
CONFIG_BT_AUDIO=y
|
||||
CONFIG_BT_AUDIO_BROADCAST_SOURCE=y
|
||||
CONFIG_BT_BAP_BROADCAST_SOURCE=y
|
||||
|
||||
CONFIG_BT_ISO_MAX_CHAN=2
|
||||
CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT=2
|
||||
CONFIG_BT_AUDIO_BROADCAST_SRC_SUBGROUP_COUNT=2
|
||||
CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=2
|
||||
CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=2
|
||||
CONFIG_BT_ISO_TX_BUF_COUNT=4
|
||||
|
||||
CONFIG_BT_DEVICE_NAME="Broadcast Audio Source"
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2022-2023 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/bluetooth/bluetooth.h>
|
||||
#include <zephyr/bluetooth/audio/audio.h>
|
||||
#include <zephyr/bluetooth/audio/bap.h>
|
||||
|
||||
/* When BROADCAST_ENQUEUE_COUNT > 1 we can enqueue enough buffers to ensure that
|
||||
* the controller is never idle
|
||||
*/
|
||||
#define BROADCAST_ENQUEUE_COUNT 2U
|
||||
#define TOTAL_BUF_NEEDED (BROADCAST_ENQUEUE_COUNT * CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT)
|
||||
#define TOTAL_BUF_NEEDED (BROADCAST_ENQUEUE_COUNT * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT)
|
||||
|
||||
BUILD_ASSERT(CONFIG_BT_ISO_TX_BUF_COUNT >= TOTAL_BUF_NEEDED,
|
||||
"CONFIG_BT_ISO_TX_BUF_COUNT should be at least "
|
||||
"BROADCAST_ENQUEUE_COUNT * CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT");
|
||||
"BROADCAST_ENQUEUE_COUNT * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT");
|
||||
|
||||
static struct bt_audio_lc3_preset preset_16_2_1 =
|
||||
BT_AUDIO_LC3_BROADCAST_PRESET_16_2_1(BT_AUDIO_LOCATION_FRONT_LEFT,
|
||||
BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED);
|
||||
static struct bt_audio_stream streams[CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_audio_broadcast_source *broadcast_source;
|
||||
static struct bt_audio_stream streams[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_bap_broadcast_source *broadcast_source;
|
||||
|
||||
NET_BUF_POOL_FIXED_DEFINE(tx_pool,
|
||||
TOTAL_BUF_NEEDED,
|
||||
|
@ -85,13 +86,13 @@ static struct bt_audio_stream_ops stream_ops = {
|
|||
.sent = stream_sent_cb
|
||||
};
|
||||
|
||||
static int setup_broadcast_source(struct bt_audio_broadcast_source **source)
|
||||
static int setup_broadcast_source(struct bt_bap_broadcast_source **source)
|
||||
{
|
||||
struct bt_audio_broadcast_source_stream_param
|
||||
stream_params[CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT];
|
||||
struct bt_audio_broadcast_source_subgroup_param
|
||||
subgroup_param[CONFIG_BT_AUDIO_BROADCAST_SRC_SUBGROUP_COUNT];
|
||||
struct bt_audio_broadcast_source_create_param create_param;
|
||||
struct bt_bap_broadcast_source_stream_param
|
||||
stream_params[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT];
|
||||
struct bt_bap_broadcast_source_subgroup_param
|
||||
subgroup_param[CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT];
|
||||
struct bt_bap_broadcast_source_create_param create_param;
|
||||
const size_t streams_per_subgroup = ARRAY_SIZE(stream_params) / ARRAY_SIZE(subgroup_param);
|
||||
int err;
|
||||
|
||||
|
@ -120,7 +121,7 @@ static int setup_broadcast_source(struct bt_audio_broadcast_source **source)
|
|||
ARRAY_SIZE(subgroup_param),
|
||||
ARRAY_SIZE(subgroup_param) * streams_per_subgroup);
|
||||
|
||||
err = bt_audio_broadcast_source_create(&create_param, source);
|
||||
err = bt_bap_broadcast_source_create(&create_param, source);
|
||||
if (err != 0) {
|
||||
printk("Unable to create broadcast source: %d\n", err);
|
||||
return err;
|
||||
|
@ -178,8 +179,7 @@ void main(void)
|
|||
return;
|
||||
}
|
||||
|
||||
err = bt_audio_broadcast_source_get_id(broadcast_source,
|
||||
&broadcast_id);
|
||||
err = bt_bap_broadcast_source_get_id(broadcast_source, &broadcast_id);
|
||||
if (err != 0) {
|
||||
printk("Unable to get broadcast ID: %d\n", err);
|
||||
return;
|
||||
|
@ -199,8 +199,7 @@ void main(void)
|
|||
}
|
||||
|
||||
/* Setup periodic advertising data */
|
||||
err = bt_audio_broadcast_source_get_base(broadcast_source,
|
||||
&base_buf);
|
||||
err = bt_bap_broadcast_source_get_base(broadcast_source, &base_buf);
|
||||
if (err != 0) {
|
||||
printk("Failed to get encoded BASE: %d\n", err);
|
||||
return;
|
||||
|
@ -234,7 +233,7 @@ void main(void)
|
|||
|
||||
printk("Starting broadcast source\n");
|
||||
stopping = false;
|
||||
err = bt_audio_broadcast_source_start(broadcast_source, adv);
|
||||
err = bt_bap_broadcast_source_start(broadcast_source, adv);
|
||||
if (err != 0) {
|
||||
printk("Unable to start broadcast source: %d\n", err);
|
||||
return;
|
||||
|
@ -259,7 +258,7 @@ void main(void)
|
|||
|
||||
printk("Stopping broadcast source\n");
|
||||
stopping = true;
|
||||
err = bt_audio_broadcast_source_stop(broadcast_source);
|
||||
err = bt_bap_broadcast_source_stop(broadcast_source);
|
||||
if (err != 0) {
|
||||
printk("Unable to stop broadcast source: %d\n", err);
|
||||
return;
|
||||
|
@ -272,7 +271,7 @@ void main(void)
|
|||
printk("Broadcast source stopped\n");
|
||||
|
||||
printk("Deleting broadcast source\n");
|
||||
err = bt_audio_broadcast_source_delete(broadcast_source);
|
||||
err = bt_bap_broadcast_source_delete(broadcast_source);
|
||||
if (err != 0) {
|
||||
printk("Unable to delete broadcast source: %d\n", err);
|
||||
return;
|
||||
|
|
|
@ -50,7 +50,7 @@ zephyr_library_sources_ifdef(CONFIG_BT_PACS pacs.c)
|
|||
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_STREAM bap_stream.c codec.c bap_iso.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_BAP_UNICAST_SERVER bap_unicast_server.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_UNICAST_CLIENT bap_unicast_client.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_BROADCAST_SOURCE bap_broadcast_source.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_BAP_BROADCAST_SOURCE bap_broadcast_source.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_BAP_BROADCAST_SINK bap_broadcast_sink.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_BAP_SCAN_DELEGATOR bap_scan_delegator.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_BAP_BROADCAST_ASSISTANT bap_broadcast_assistant.c)
|
||||
|
|
|
@ -324,7 +324,7 @@ legacy-debug-sym = BT_AUDIO_DEBUG_UNICAST_CLIENT
|
|||
module-str = "Basic Audio Profile"
|
||||
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
||||
|
||||
config BT_AUDIO_DEBUG_BROADCAST_SOURCE
|
||||
config BT_DEBUG_BAP_BROADCAST_SOURCE
|
||||
bool "Bluetooth Audio Broadcast Source debug"
|
||||
select DEPRECATED
|
||||
depends on BT_BAP_BROADCAST_SOURCE
|
||||
|
@ -333,7 +333,7 @@ config BT_AUDIO_DEBUG_BROADCAST_SOURCE
|
|||
for the Bluetooth Audio functionality.
|
||||
|
||||
module = BT_BAP_BROADCAST_SOURCE
|
||||
legacy-debug-sym = BT_AUDIO_DEBUG_BROADCAST_SOURCE
|
||||
legacy-debug-sym = BT_DEBUG_BAP_BROADCAST_SOURCE
|
||||
module-str = "Bluetooth Audio Broadcast Source"
|
||||
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
||||
|
||||
|
|
|
@ -108,16 +108,16 @@ config BT_AUDIO_UNICAST_CLIENT_ASE_SRC_COUNT
|
|||
|
||||
endif # BT_AUDIO_UNICAST_CLIENT
|
||||
|
||||
config BT_AUDIO_BROADCAST_SOURCE
|
||||
config BT_BAP_BROADCAST_SOURCE
|
||||
bool "Bluetooth Broadcast Source Audio Support [EXPERIMENTAL]"
|
||||
select EXPERIMENTAL
|
||||
select BT_ISO_BROADCASTER
|
||||
help
|
||||
This option enables support for Bluetooth Broadcast Source Audio using
|
||||
Isochronous channels.
|
||||
if BT_AUDIO_BROADCAST_SOURCE
|
||||
if BT_BAP_BROADCAST_SOURCE
|
||||
|
||||
config BT_AUDIO_BROADCAST_SRC_SUBGROUP_COUNT
|
||||
config BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT
|
||||
int "Basic Audio Broadcast Source subgroup count"
|
||||
default 1
|
||||
range 1 BT_ISO_MAX_CHAN if BT_ISO_MAX_CHAN < 31
|
||||
|
@ -126,17 +126,17 @@ config BT_AUDIO_BROADCAST_SRC_SUBGROUP_COUNT
|
|||
This option sets the maximum number of subgroups per broadcast source
|
||||
to support.
|
||||
|
||||
config BT_AUDIO_BROADCAST_SRC_COUNT
|
||||
config BT_BAP_BROADCAST_SRC_COUNT
|
||||
int "Basic Audio Broadcaster source count"
|
||||
default 1
|
||||
range 1 BT_ISO_MAX_BIG
|
||||
help
|
||||
This option sets the number of broadcast sources to support.
|
||||
One broadcast source can send multiple streams
|
||||
(up to BT_AUDIO_BROADCAST_SRC_STREAM_COUNT per broadcast source).
|
||||
(up to BT_BAP_BROADCAST_SRC_STREAM_COUNT per broadcast source).
|
||||
|
||||
|
||||
config BT_AUDIO_BROADCAST_SRC_STREAM_COUNT
|
||||
config BT_BAP_BROADCAST_SRC_STREAM_COUNT
|
||||
int "Basic Audio Broadcast Source Stream count"
|
||||
default 1
|
||||
range 1 BT_ISO_MAX_CHAN if BT_ISO_MAX_CHAN < 31
|
||||
|
@ -145,7 +145,7 @@ config BT_AUDIO_BROADCAST_SRC_STREAM_COUNT
|
|||
This option sets the maximum number of streams per broadcast source
|
||||
to support.
|
||||
|
||||
endif # BT_AUDIO_BROADCAST_SOURCE
|
||||
endif # BT_BAP_BROADCAST_SOURCE
|
||||
|
||||
config BT_BAP_BROADCAST_SINK
|
||||
bool "Bluetooth Broadcast Sink Audio Support [EXPERIMENTAL]"
|
||||
|
@ -317,16 +317,16 @@ legacy-debug-sym = BT_AUDIO_DEBUG_UNICAST_CLIENT
|
|||
module-str = "Basic Audio Profile"
|
||||
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
||||
|
||||
config BT_AUDIO_DEBUG_BROADCAST_SOURCE
|
||||
config BT_DEBUG_BAP_BROADCAST_SOURCE
|
||||
bool "Bluetooth Audio Broadcast Source debug"
|
||||
select DEPRECATED
|
||||
depends on BT_AUDIO_BROADCAST_SOURCE
|
||||
depends on BT_BAP_BROADCAST_SOURCE
|
||||
help
|
||||
Use this option to enable Bluetooth Audio Broadcast Source debug logs
|
||||
for the Bluetooth Audio functionality.
|
||||
|
||||
module = BT_AUDIO_BROADCAST_SOURCE
|
||||
legacy-debug-sym = BT_AUDIO_DEBUG_BROADCAST_SOURCE
|
||||
module = BT_BAP_BROADCAST_SOURCE
|
||||
legacy-debug-sym = BT_DEBUG_BAP_BROADCAST_SOURCE
|
||||
module-str = "Bluetooth Audio Broadcast Source"
|
||||
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
||||
|
||||
|
@ -373,7 +373,7 @@ config BT_AUDIO_STREAM
|
|||
# Virtual/hidden option
|
||||
bool
|
||||
default y if BT_ASCS || BT_AUDIO_UNICAST_CLIENT || \
|
||||
BT_AUDIO_BROADCAST_SOURCE || BT_BAP_BROADCAST_SINK
|
||||
BT_BAP_BROADCAST_SOURCE || BT_BAP_BROADCAST_SINK
|
||||
|
||||
parent-module = BT
|
||||
module = BT_AUDIO_ISO
|
||||
|
|
|
@ -41,7 +41,7 @@ source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
|||
|
||||
config BT_CAP_INITIATOR
|
||||
bool "Common Audio Profile Initiator Role Support [EXPERIMENTAL]"
|
||||
depends on (BT_AUDIO_UNICAST_CLIENT && BT_CSIP_SET_COORDINATOR) || BT_AUDIO_BROADCAST_SOURCE
|
||||
depends on (BT_AUDIO_UNICAST_CLIENT && BT_CSIP_SET_COORDINATOR) || BT_BAP_BROADCAST_SOURCE
|
||||
select EXPERIMENTAL
|
||||
help
|
||||
Enabling this will enable the CAP Initiator role.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <zephyr/bluetooth/audio/audio.h>
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(bt_audio_broadcast_source, CONFIG_BT_AUDIO_BROADCAST_SOURCE_LOG_LEVEL);
|
||||
LOG_MODULE_REGISTER(bt_bap_broadcast_source, CONFIG_BT_BAP_BROADCAST_SOURCE_LOG_LEVEL);
|
||||
|
||||
#include "bap_iso.h"
|
||||
#include "bap_endpoint.h"
|
||||
|
@ -32,11 +32,12 @@ struct bt_audio_broadcast_subgroup {
|
|||
sys_snode_t _node;
|
||||
};
|
||||
|
||||
static struct bt_audio_ep broadcast_source_eps
|
||||
[CONFIG_BT_AUDIO_BROADCAST_SRC_COUNT][BROADCAST_STREAM_CNT];
|
||||
static struct bt_audio_broadcast_subgroup broadcast_source_subgroups
|
||||
[CONFIG_BT_AUDIO_BROADCAST_SRC_COUNT][CONFIG_BT_AUDIO_BROADCAST_SRC_SUBGROUP_COUNT];
|
||||
static struct bt_audio_broadcast_source broadcast_sources[CONFIG_BT_AUDIO_BROADCAST_SRC_COUNT];
|
||||
static struct bt_audio_ep broadcast_source_eps[CONFIG_BT_BAP_BROADCAST_SRC_COUNT]
|
||||
[BROADCAST_STREAM_CNT];
|
||||
static struct bt_audio_broadcast_subgroup
|
||||
broadcast_source_subgroups[CONFIG_BT_BAP_BROADCAST_SRC_COUNT]
|
||||
[CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT];
|
||||
static struct bt_bap_broadcast_source broadcast_sources[CONFIG_BT_BAP_BROADCAST_SRC_COUNT];
|
||||
|
||||
/**
|
||||
* 2 octets UUID
|
||||
|
@ -261,11 +262,9 @@ static struct bt_audio_broadcast_subgroup *broadcast_source_new_subgroup(uint8_t
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int broadcast_source_setup_stream(uint8_t index,
|
||||
struct bt_audio_stream *stream,
|
||||
struct bt_codec *codec,
|
||||
struct bt_codec_qos *qos,
|
||||
struct bt_audio_broadcast_source *source)
|
||||
static int broadcast_source_setup_stream(uint8_t index, struct bt_audio_stream *stream,
|
||||
struct bt_codec *codec, struct bt_codec_qos *qos,
|
||||
struct bt_bap_broadcast_source *source)
|
||||
{
|
||||
struct bt_audio_iso *iso;
|
||||
struct bt_audio_ep *ep;
|
||||
|
@ -425,8 +424,7 @@ static bool encode_base_subgroup(struct bt_audio_broadcast_subgroup *subgroup,
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool encode_base(struct bt_audio_broadcast_source *source,
|
||||
struct net_buf_simple *buf)
|
||||
static bool encode_base(struct bt_bap_broadcast_source *source, struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_audio_broadcast_subgroup *subgroup;
|
||||
uint8_t streams_encoded;
|
||||
|
@ -462,7 +460,7 @@ static bool encode_base(struct bt_audio_broadcast_source *source,
|
|||
return true;
|
||||
}
|
||||
|
||||
static int generate_broadcast_id(struct bt_audio_broadcast_source *source)
|
||||
static int generate_broadcast_id(struct bt_bap_broadcast_source *source)
|
||||
{
|
||||
bool unique;
|
||||
|
||||
|
@ -492,7 +490,7 @@ static int generate_broadcast_id(struct bt_audio_broadcast_source *source)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void broadcast_source_cleanup(struct bt_audio_broadcast_source *source)
|
||||
static void broadcast_source_cleanup(struct bt_bap_broadcast_source *source)
|
||||
{
|
||||
struct bt_audio_broadcast_subgroup *subgroup, *next_subgroup;
|
||||
|
||||
|
@ -518,7 +516,7 @@ static void broadcast_source_cleanup(struct bt_audio_broadcast_source *source)
|
|||
(void)memset(source, 0, sizeof(*source));
|
||||
}
|
||||
|
||||
static bool valid_create_param(const struct bt_audio_broadcast_source_create_param *param)
|
||||
static bool valid_create_param(const struct bt_bap_broadcast_source_create_param *param)
|
||||
{
|
||||
const struct bt_codec_qos *qos;
|
||||
|
||||
|
@ -550,7 +548,7 @@ static bool valid_create_param(const struct bt_audio_broadcast_source_create_par
|
|||
}
|
||||
|
||||
for (size_t i = 0U; i < param->params_count; i++) {
|
||||
const struct bt_audio_broadcast_source_subgroup_param *subgroup_param;
|
||||
const struct bt_bap_broadcast_source_subgroup_param *subgroup_param;
|
||||
|
||||
subgroup_param = ¶m->params[i];
|
||||
|
||||
|
@ -565,7 +563,7 @@ static bool valid_create_param(const struct bt_audio_broadcast_source_create_par
|
|||
}
|
||||
|
||||
for (size_t j = 0U; j < subgroup_param->params_count; j++) {
|
||||
const struct bt_audio_broadcast_source_stream_param *stream_param;
|
||||
const struct bt_bap_broadcast_source_stream_param *stream_param;
|
||||
|
||||
stream_param = &subgroup_param->params[j];
|
||||
|
||||
|
@ -587,7 +585,7 @@ static bool valid_create_param(const struct bt_audio_broadcast_source_create_par
|
|||
return true;
|
||||
}
|
||||
|
||||
static enum bt_audio_state broadcast_source_get_state(struct bt_audio_broadcast_source *source)
|
||||
static enum bt_audio_state broadcast_source_get_state(struct bt_bap_broadcast_source *source)
|
||||
{
|
||||
struct bt_audio_broadcast_subgroup *subgroup;
|
||||
struct bt_audio_stream *stream;
|
||||
|
@ -621,11 +619,11 @@ static enum bt_audio_state broadcast_source_get_state(struct bt_audio_broadcast_
|
|||
return stream->ep->status.state;
|
||||
}
|
||||
|
||||
int bt_audio_broadcast_source_create(struct bt_audio_broadcast_source_create_param *param,
|
||||
struct bt_audio_broadcast_source **out_source)
|
||||
int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_create_param *param,
|
||||
struct bt_bap_broadcast_source **out_source)
|
||||
{
|
||||
struct bt_audio_broadcast_subgroup *subgroup;
|
||||
struct bt_audio_broadcast_source *source;
|
||||
struct bt_bap_broadcast_source *source;
|
||||
struct bt_codec_qos *qos;
|
||||
size_t stream_count;
|
||||
uint8_t index;
|
||||
|
@ -663,7 +661,7 @@ int bt_audio_broadcast_source_create(struct bt_audio_broadcast_source_create_par
|
|||
* endpoint
|
||||
*/
|
||||
for (size_t i = 0U; i < param->params_count; i++) {
|
||||
const struct bt_audio_broadcast_source_subgroup_param *subgroup_param;
|
||||
const struct bt_bap_broadcast_source_subgroup_param *subgroup_param;
|
||||
|
||||
subgroup_param = ¶m->params[i];
|
||||
|
||||
|
@ -686,7 +684,7 @@ int bt_audio_broadcast_source_create(struct bt_audio_broadcast_source_create_par
|
|||
}
|
||||
|
||||
for (size_t j = 0U; j < subgroup_param->params_count; j++) {
|
||||
const struct bt_audio_broadcast_source_stream_param *stream_param;
|
||||
const struct bt_bap_broadcast_source_stream_param *stream_param;
|
||||
struct bt_audio_stream *stream;
|
||||
|
||||
stream_param = &subgroup_param->params[j];
|
||||
|
@ -748,8 +746,7 @@ int bt_audio_broadcast_source_create(struct bt_audio_broadcast_source_create_par
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_broadcast_source_reconfig(struct bt_audio_broadcast_source *source,
|
||||
struct bt_codec *codec,
|
||||
int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, struct bt_codec *codec,
|
||||
struct bt_codec_qos *qos)
|
||||
{
|
||||
struct bt_audio_broadcast_subgroup *subgroup;
|
||||
|
@ -808,9 +805,8 @@ static void broadcast_source_store_metadata(struct bt_codec *codec,
|
|||
}
|
||||
}
|
||||
|
||||
int bt_audio_broadcast_source_update_metadata(struct bt_audio_broadcast_source *source,
|
||||
const struct bt_codec_data meta[],
|
||||
size_t meta_count)
|
||||
int bt_bap_broadcast_source_update_metadata(struct bt_bap_broadcast_source *source,
|
||||
const struct bt_codec_data meta[], size_t meta_count)
|
||||
{
|
||||
struct bt_audio_broadcast_subgroup *subgroup;
|
||||
enum bt_audio_state broadcast_state;
|
||||
|
@ -861,8 +857,7 @@ int bt_audio_broadcast_source_update_metadata(struct bt_audio_broadcast_source *
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_broadcast_source_start(struct bt_audio_broadcast_source *source,
|
||||
struct bt_le_ext_adv *adv)
|
||||
int bt_bap_broadcast_source_start(struct bt_bap_broadcast_source *source, struct bt_le_ext_adv *adv)
|
||||
{
|
||||
struct bt_iso_chan *bis[BROADCAST_STREAM_CNT];
|
||||
struct bt_iso_big_create_param param = { 0 };
|
||||
|
@ -920,7 +915,7 @@ int bt_audio_broadcast_source_start(struct bt_audio_broadcast_source *source,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_broadcast_source_stop(struct bt_audio_broadcast_source *source)
|
||||
int bt_bap_broadcast_source_stop(struct bt_bap_broadcast_source *source)
|
||||
{
|
||||
enum bt_audio_state broadcast_state;
|
||||
int err;
|
||||
|
@ -953,7 +948,7 @@ int bt_audio_broadcast_source_stop(struct bt_audio_broadcast_source *source)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_broadcast_source_delete(struct bt_audio_broadcast_source *source)
|
||||
int bt_bap_broadcast_source_delete(struct bt_bap_broadcast_source *source)
|
||||
{
|
||||
enum bt_audio_state broadcast_state;
|
||||
|
||||
|
@ -974,7 +969,7 @@ int bt_audio_broadcast_source_delete(struct bt_audio_broadcast_source *source)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_broadcast_source_get_id(const struct bt_audio_broadcast_source *source,
|
||||
int bt_bap_broadcast_source_get_id(const struct bt_bap_broadcast_source *source,
|
||||
uint32_t *const broadcast_id)
|
||||
{
|
||||
CHECKIF(source == NULL) {
|
||||
|
@ -992,7 +987,7 @@ int bt_audio_broadcast_source_get_id(const struct bt_audio_broadcast_source *sou
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_broadcast_source_get_base(struct bt_audio_broadcast_source *source,
|
||||
int bt_bap_broadcast_source_get_base(struct bt_bap_broadcast_source *source,
|
||||
struct net_buf_simple *base_buf)
|
||||
{
|
||||
if (!encode_base(source, base_buf)) {
|
||||
|
|
|
@ -21,15 +21,15 @@
|
|||
#define UNICAST_GROUP_CNT 0
|
||||
#define UNICAST_GROUP_STREAM_CNT 0
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST_CLIENT && CONFIG_BT_AUDIO_UNICAST */
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#define BROADCAST_STREAM_CNT CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT
|
||||
#else /* !CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
#define BROADCAST_STREAM_CNT CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT
|
||||
#else /* !CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
#define BROADCAST_STREAM_CNT 0
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
/* Temp struct declarations to handle circular dependencies */
|
||||
struct bt_audio_unicast_group;
|
||||
struct bt_audio_broadcast_source;
|
||||
struct bt_bap_broadcast_source;
|
||||
struct bt_bap_broadcast_sink;
|
||||
struct bt_audio_ep;
|
||||
|
||||
|
@ -49,7 +49,7 @@ struct bt_audio_ep {
|
|||
|
||||
/* TODO: Create a union to reduce memory usage */
|
||||
struct bt_audio_unicast_group *unicast_group;
|
||||
struct bt_audio_broadcast_source *broadcast_source;
|
||||
struct bt_bap_broadcast_source *broadcast_source;
|
||||
struct bt_bap_broadcast_sink *broadcast_sink;
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ struct bt_audio_broadcast_stream_data {
|
|||
#endif /* CONFIG_BT_CODEC_MAX_DATA_COUNT */
|
||||
};
|
||||
|
||||
struct bt_audio_broadcast_source {
|
||||
struct bt_bap_broadcast_source {
|
||||
uint8_t stream_count;
|
||||
uint8_t packing;
|
||||
bool encryption;
|
||||
|
|
|
@ -64,7 +64,7 @@ void bt_audio_codec_to_iso_path(struct bt_iso_chan_path *path,
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST_CLIENT) || \
|
||||
defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE) || \
|
||||
defined(CONFIG_BT_BAP_BROADCAST_SOURCE) || \
|
||||
defined(CONFIG_BT_BAP_BROADCAST_SINK)
|
||||
void bt_audio_codec_qos_to_iso_qos(struct bt_iso_chan_io_qos *io,
|
||||
const struct bt_codec_qos *codec_qos)
|
||||
|
@ -74,7 +74,7 @@ void bt_audio_codec_qos_to_iso_qos(struct bt_iso_chan_io_qos *io,
|
|||
io->rtn = codec_qos->rtn;
|
||||
}
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST_CLIENT || \
|
||||
* CONFIG_BT_AUDIO_BROADCAST_SOURCE || \
|
||||
* CONFIG_BT_BAP_BROADCAST_SOURCE || \
|
||||
* CONFIG_BT_BAP_BROADCAST_SINK \
|
||||
*/
|
||||
|
||||
|
@ -121,7 +121,7 @@ int bt_audio_ep_get_info(const struct bt_audio_ep *ep, struct bt_audio_ep_info *
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
bool bt_audio_valid_qos(const struct bt_codec_qos *qos)
|
||||
{
|
||||
if (qos->interval < BT_ISO_SDU_INTERVAL_MIN ||
|
||||
|
@ -179,12 +179,12 @@ int bt_audio_stream_send(struct bt_audio_stream *stream, struct net_buf *buf,
|
|||
return bt_iso_chan_send(bt_audio_stream_iso_chan_get(stream),
|
||||
buf, seq_num, ts);
|
||||
}
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST)
|
||||
static bool bt_audio_stream_is_broadcast(const struct bt_audio_stream *stream)
|
||||
{
|
||||
return (IS_ENABLED(CONFIG_BT_AUDIO_BROADCAST_SOURCE) &&
|
||||
return (IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SOURCE) &&
|
||||
bt_audio_ep_is_broadcast_src(stream->ep)) ||
|
||||
(IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SINK) &&
|
||||
bt_audio_ep_is_broadcast_snk(stream->ep));
|
||||
|
|
|
@ -1931,7 +1931,7 @@ static void unicast_group_add_stream(struct bt_audio_unicast_group *group,
|
|||
|
||||
stream->qos = qos;
|
||||
stream->dir = dir;
|
||||
stream->unicast_group = group;
|
||||
stream->group = group;
|
||||
|
||||
/* iso initialized already */
|
||||
bt_audio_iso_bind_stream(iso, stream);
|
||||
|
@ -1998,7 +1998,7 @@ static void unicast_group_del_stream(struct bt_audio_unicast_group *group,
|
|||
bt_audio_iso_unbind_ep(ep->iso, ep);
|
||||
}
|
||||
|
||||
stream->unicast_group = NULL;
|
||||
stream->group = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2049,7 +2049,7 @@ static void unicast_group_free(struct bt_audio_unicast_group *group)
|
|||
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&group->streams, stream, next, _node) {
|
||||
struct bt_audio_ep *ep = stream->ep;
|
||||
|
||||
stream->unicast_group = NULL;
|
||||
stream->group = NULL;
|
||||
if (stream->audio_iso != NULL) {
|
||||
bt_audio_iso_unbind_stream(stream->audio_iso, stream);
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
#include <zephyr/logging/log.h>
|
||||
|
||||
BUILD_ASSERT(sizeof(struct bt_audio_broadcast_source_create_param) ==
|
||||
BUILD_ASSERT(sizeof(struct bt_bap_broadcast_source_create_param) ==
|
||||
sizeof(struct bt_cap_initiator_broadcast_create_param),
|
||||
"Size of struct bt_audio_broadcast_source_create_param must equal "
|
||||
"Size of struct bt_bap_broadcast_source_create_param must equal "
|
||||
"to struct bt_cap_initiator_broadcast_create_param");
|
||||
|
||||
LOG_MODULE_REGISTER(bt_cap_initiator, CONFIG_BT_CAP_INITIATOR_LOG_LEVEL);
|
||||
|
@ -40,7 +40,7 @@ int bt_cap_initiator_register_cb(const struct bt_cap_initiator_cb *cb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
|
||||
static bool cap_initiator_valid_metadata(const struct bt_codec_data meta[],
|
||||
size_t meta_count)
|
||||
|
@ -109,10 +109,10 @@ int bt_cap_initiator_broadcast_audio_start(struct bt_cap_initiator_broadcast_cre
|
|||
* identical, so we can just cast them. This need to be updated and
|
||||
* made resistant to changes in either the CAP or BAP APIs at some point
|
||||
*/
|
||||
struct bt_audio_broadcast_source_create_param *bap_create_param =
|
||||
(struct bt_audio_broadcast_source_create_param *)param;
|
||||
struct bt_audio_broadcast_source **bap_broadcast_source =
|
||||
(struct bt_audio_broadcast_source **)broadcast_source;
|
||||
struct bt_bap_broadcast_source_create_param *bap_create_param =
|
||||
(struct bt_bap_broadcast_source_create_param *)param;
|
||||
struct bt_bap_broadcast_source **bap_broadcast_source =
|
||||
(struct bt_bap_broadcast_source **)broadcast_source;
|
||||
int err;
|
||||
|
||||
if (!cap_initiator_broadcast_audio_start_valid_param(param)) {
|
||||
|
@ -124,20 +124,19 @@ int bt_cap_initiator_broadcast_audio_start(struct bt_cap_initiator_broadcast_cre
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = bt_audio_broadcast_source_create(bap_create_param,
|
||||
bap_broadcast_source);
|
||||
err = bt_bap_broadcast_source_create(bap_create_param, bap_broadcast_source);
|
||||
if (err != 0) {
|
||||
LOG_DBG("Failed to create broadcast source: %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = bt_audio_broadcast_source_start(*bap_broadcast_source, adv);
|
||||
err = bt_bap_broadcast_source_start(*bap_broadcast_source, adv);
|
||||
if (err != 0) {
|
||||
int del_err;
|
||||
|
||||
LOG_DBG("Failed to start broadcast source: %d\n", err);
|
||||
|
||||
del_err = bt_audio_broadcast_source_delete(*bap_broadcast_source);
|
||||
del_err = bt_bap_broadcast_source_delete(*bap_broadcast_source);
|
||||
if (del_err) {
|
||||
LOG_ERR("Failed to delete BAP broadcast source: %d",
|
||||
del_err);
|
||||
|
@ -161,39 +160,34 @@ int bt_cap_initiator_broadcast_audio_update(struct bt_cap_broadcast_source *broa
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return bt_audio_broadcast_source_update_metadata(
|
||||
(struct bt_audio_broadcast_source *)broadcast_source,
|
||||
meta, meta_count);
|
||||
return bt_bap_broadcast_source_update_metadata(
|
||||
(struct bt_bap_broadcast_source *)broadcast_source, meta, meta_count);
|
||||
}
|
||||
|
||||
int bt_cap_initiator_broadcast_audio_stop(struct bt_cap_broadcast_source *broadcast_source)
|
||||
{
|
||||
return bt_audio_broadcast_source_stop((struct bt_audio_broadcast_source *)broadcast_source);
|
||||
return bt_bap_broadcast_source_stop((struct bt_bap_broadcast_source *)broadcast_source);
|
||||
}
|
||||
|
||||
int bt_cap_initiator_broadcast_audio_delete(struct bt_cap_broadcast_source *broadcast_source)
|
||||
{
|
||||
return bt_audio_broadcast_source_delete(
|
||||
(struct bt_audio_broadcast_source *)broadcast_source);
|
||||
return bt_bap_broadcast_source_delete((struct bt_bap_broadcast_source *)broadcast_source);
|
||||
}
|
||||
|
||||
int bt_cap_initiator_broadcast_get_id(const struct bt_cap_broadcast_source *source,
|
||||
uint32_t *const broadcast_id)
|
||||
{
|
||||
return bt_audio_broadcast_source_get_id(
|
||||
(struct bt_audio_broadcast_source *)source,
|
||||
return bt_bap_broadcast_source_get_id((struct bt_bap_broadcast_source *)source,
|
||||
broadcast_id);
|
||||
}
|
||||
|
||||
int bt_cap_initiator_broadcast_get_base(struct bt_cap_broadcast_source *source,
|
||||
struct net_buf_simple *base_buf)
|
||||
{
|
||||
return bt_audio_broadcast_source_get_base(
|
||||
(struct bt_audio_broadcast_source *)source,
|
||||
base_buf);
|
||||
return bt_bap_broadcast_source_get_base((struct bt_bap_broadcast_source *)source, base_buf);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST_CLIENT)
|
||||
static const struct bt_uuid *cas_uuid = BT_UUID_CAS;
|
||||
|
@ -398,7 +392,7 @@ int bt_cap_initiator_unicast_audio_stop(struct bt_audio_unicast_group *unicast_g
|
|||
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST_CLIENT */
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE) && defined(CONFIG_BT_AUDIO_UNICAST_CLIENT)
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE) && defined(CONFIG_BT_AUDIO_UNICAST_CLIENT)
|
||||
|
||||
int bt_cap_initiator_unicast_to_broadcast(
|
||||
const struct bt_cap_unicast_to_broadcast_param *param,
|
||||
|
@ -413,4 +407,4 @@ int bt_cap_initiator_broadcast_to_unicast(const struct bt_cap_broadcast_to_unica
|
|||
return -ENOSYS;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE && CONFIG_BT_AUDIO_UNICAST_CLIENT */
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE && CONFIG_BT_AUDIO_UNICAST_CLIENT */
|
||||
|
|
|
@ -122,7 +122,7 @@ static void cap_stream_recv_cb(struct bt_audio_stream *bap_stream,
|
|||
}
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
static void cap_stream_sent_cb(struct bt_audio_stream *bap_stream)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
|
@ -134,7 +134,7 @@ static void cap_stream_sent_cb(struct bt_audio_stream *bap_stream)
|
|||
ops->sent(bap_stream);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
static struct bt_audio_stream_ops bap_stream_ops = {
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST)
|
||||
|
@ -150,9 +150,9 @@ static struct bt_audio_stream_ops bap_stream_ops = {
|
|||
#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SINK)
|
||||
.recv = cap_stream_recv_cb,
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
.sent = cap_stream_sent_cb,
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
};
|
||||
|
||||
void bt_cap_stream_ops_register(struct bt_cap_stream *stream,
|
||||
|
|
|
@ -54,10 +54,10 @@ static struct bt_audio_ep *srcs[CONFIG_BT_AUDIO_UNICAST_CLIENT_ASE_SRC_COUNT];
|
|||
#endif /* CONFIG_BT_AUDIO_UNICAST_CLIENT */
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST */
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
static struct bt_audio_stream broadcast_source_streams[CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_audio_broadcast_source *default_source;
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
static struct bt_audio_stream broadcast_source_streams[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_bap_broadcast_source *default_source;
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SINK)
|
||||
static struct bt_audio_stream broadcast_sink_streams[BROADCAST_SNK_STREAM_CNT];
|
||||
static struct bt_bap_broadcast_sink *default_sink;
|
||||
|
@ -1697,7 +1697,7 @@ static struct bt_audio_stream_ops stream_ops = {
|
|||
.stopped = stream_stopped_cb,
|
||||
};
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
static int cmd_select_broadcast_source(const struct shell *sh, size_t argc,
|
||||
char *argv[])
|
||||
{
|
||||
|
@ -1728,10 +1728,10 @@ static int cmd_select_broadcast_source(const struct shell *sh, size_t argc,
|
|||
static int cmd_create_broadcast(const struct shell *sh, size_t argc,
|
||||
char *argv[])
|
||||
{
|
||||
struct bt_audio_broadcast_source_stream_param
|
||||
struct bt_bap_broadcast_source_stream_param
|
||||
stream_params[ARRAY_SIZE(broadcast_source_streams)];
|
||||
struct bt_audio_broadcast_source_subgroup_param subgroup_param;
|
||||
struct bt_audio_broadcast_source_create_param create_param = { 0 };
|
||||
struct bt_bap_broadcast_source_subgroup_param subgroup_param;
|
||||
struct bt_bap_broadcast_source_create_param create_param = {0};
|
||||
struct named_lc3_preset *named_preset;
|
||||
int err;
|
||||
|
||||
|
@ -1802,7 +1802,7 @@ static int cmd_create_broadcast(const struct shell *sh, size_t argc,
|
|||
create_param.params = &subgroup_param;
|
||||
create_param.qos = &named_preset->preset.qos;
|
||||
|
||||
err = bt_audio_broadcast_source_create(&create_param, &default_source);
|
||||
err = bt_bap_broadcast_source_create(&create_param, &default_source);
|
||||
if (err != 0) {
|
||||
shell_error(sh, "Unable to create broadcast source: %d", err);
|
||||
return err;
|
||||
|
@ -1834,8 +1834,7 @@ static int cmd_start_broadcast(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
err = bt_audio_broadcast_source_start(default_source,
|
||||
adv_sets[selected_adv]);
|
||||
err = bt_bap_broadcast_source_start(default_source, adv_sets[selected_adv]);
|
||||
if (err != 0) {
|
||||
shell_error(sh, "Unable to start broadcast source: %d", err);
|
||||
return err;
|
||||
|
@ -1853,7 +1852,7 @@ static int cmd_stop_broadcast(const struct shell *sh, size_t argc, char *argv[])
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
err = bt_audio_broadcast_source_stop(default_source);
|
||||
err = bt_bap_broadcast_source_stop(default_source);
|
||||
if (err != 0) {
|
||||
shell_error(sh, "Unable to stop broadcast source: %d", err);
|
||||
return err;
|
||||
|
@ -1872,7 +1871,7 @@ static int cmd_delete_broadcast(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
err = bt_audio_broadcast_source_delete(default_source);
|
||||
err = bt_bap_broadcast_source_delete(default_source);
|
||||
if (err != 0) {
|
||||
shell_error(sh, "Unable to delete broadcast source: %d", err);
|
||||
return err;
|
||||
|
@ -1881,7 +1880,7 @@ static int cmd_delete_broadcast(const struct shell *sh, size_t argc,
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SINK)
|
||||
static int cmd_broadcast_scan(const struct shell *sh, size_t argc, char *argv[])
|
||||
|
@ -2193,14 +2192,14 @@ static int cmd_init(const struct shell *sh, size_t argc, char *argv[])
|
|||
bt_audio_stream_cb_register(&broadcast_sink_streams[i],
|
||||
&stream_ops);
|
||||
}
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
for (i = 0; i < ARRAY_SIZE(broadcast_source_streams); i++) {
|
||||
bt_audio_stream_cb_register(&broadcast_source_streams[i],
|
||||
&stream_ops);
|
||||
}
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
initialized = true;
|
||||
|
||||
|
@ -2345,42 +2344,34 @@ static int cmd_print_ase_info(const struct shell *sh, size_t argc, char *argv[])
|
|||
}
|
||||
#endif /* CONFIG_BT_BAP_UNICAST_SERVER */
|
||||
|
||||
SHELL_STATIC_SUBCMD_SET_CREATE(audio_cmds,
|
||||
SHELL_CMD_ARG(init, NULL, NULL, cmd_init, 1, 0),
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
SHELL_CMD_ARG(select_broadcast, NULL, "<stream>",
|
||||
cmd_select_broadcast_source, 2, 0),
|
||||
SHELL_CMD_ARG(create_broadcast, NULL,
|
||||
"[preset <preset_name>] [enc <broadcast_code>]",
|
||||
SHELL_STATIC_SUBCMD_SET_CREATE(
|
||||
audio_cmds, SHELL_CMD_ARG(init, NULL, NULL, cmd_init, 1, 0),
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
SHELL_CMD_ARG(select_broadcast, NULL, "<stream>", cmd_select_broadcast_source, 2, 0),
|
||||
SHELL_CMD_ARG(create_broadcast, NULL, "[preset <preset_name>] [enc <broadcast_code>]",
|
||||
cmd_create_broadcast, 1, 2),
|
||||
SHELL_CMD_ARG(start_broadcast, NULL, "", cmd_start_broadcast, 1, 0),
|
||||
SHELL_CMD_ARG(stop_broadcast, NULL, "", cmd_stop_broadcast, 1, 0),
|
||||
SHELL_CMD_ARG(delete_broadcast, NULL, "", cmd_delete_broadcast, 1, 0),
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SINK)
|
||||
SHELL_CMD_ARG(broadcast_scan, NULL, "<on, off>",
|
||||
cmd_broadcast_scan, 2, 0),
|
||||
SHELL_CMD_ARG(accept_broadcast, NULL, "0x<broadcast_id>",
|
||||
cmd_accept_broadcast, 2, 0),
|
||||
SHELL_CMD_ARG(sync_broadcast, NULL,
|
||||
"0x<bis_index> [[[0x<bis_index>] 0x<bis_index>] ...]",
|
||||
cmd_sync_broadcast, 2,
|
||||
ARRAY_SIZE(broadcast_sink_streams) - 1),
|
||||
SHELL_CMD_ARG(stop_broadcast_sink, NULL, "Stops broadcast sink",
|
||||
cmd_stop_broadcast_sink, 1, 0),
|
||||
SHELL_CMD_ARG(term_broadcast_sink, NULL, "",
|
||||
cmd_term_broadcast_sink, 1, 0),
|
||||
SHELL_CMD_ARG(broadcast_scan, NULL, "<on, off>", cmd_broadcast_scan, 2, 0),
|
||||
SHELL_CMD_ARG(accept_broadcast, NULL, "0x<broadcast_id>", cmd_accept_broadcast, 2, 0),
|
||||
SHELL_CMD_ARG(sync_broadcast, NULL, "0x<bis_index> [[[0x<bis_index>] 0x<bis_index>] ...]",
|
||||
cmd_sync_broadcast, 2, ARRAY_SIZE(broadcast_sink_streams) - 1),
|
||||
SHELL_CMD_ARG(stop_broadcast_sink, NULL, "Stops broadcast sink", cmd_stop_broadcast_sink, 1,
|
||||
0),
|
||||
SHELL_CMD_ARG(term_broadcast_sink, NULL, "", cmd_term_broadcast_sink, 1, 0),
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST)
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST_CLIENT)
|
||||
SHELL_CMD_ARG(discover, NULL, "[dir: sink, source]",
|
||||
cmd_discover, 1, 1),
|
||||
SHELL_CMD_ARG(config, NULL,
|
||||
"<direction: sink, source> <index> [codec] [preset]",
|
||||
SHELL_CMD_ARG(discover, NULL, "[dir: sink, source]", cmd_discover, 1, 1),
|
||||
SHELL_CMD_ARG(config, NULL, "<direction: sink, source> <index> [codec] [preset]",
|
||||
cmd_config, 3, 2),
|
||||
SHELL_CMD_ARG(qos, NULL,
|
||||
"[preset] [interval] [framing] [latency] [pd] [sdu] [phy]"
|
||||
" [rtn]", cmd_qos, 1, 8),
|
||||
" [rtn]",
|
||||
cmd_qos, 1, 8),
|
||||
SHELL_CMD_ARG(enable, NULL, NULL, cmd_enable, 1, 1),
|
||||
SHELL_CMD_ARG(stop, NULL, NULL, cmd_stop, 1, 0),
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST_CLIENT */
|
||||
|
@ -2394,26 +2385,21 @@ SHELL_STATIC_SUBCMD_SET_CREATE(audio_cmds,
|
|||
SHELL_CMD_ARG(disable, NULL, NULL, cmd_disable, 1, 0),
|
||||
SHELL_CMD_ARG(release, NULL, NULL, cmd_release, 1, 0),
|
||||
SHELL_CMD_ARG(list, NULL, NULL, cmd_list, 1, 0),
|
||||
SHELL_CMD_ARG(select_unicast, NULL, "<stream>",
|
||||
cmd_select_unicast, 2, 0),
|
||||
SHELL_CMD_ARG(select_unicast, NULL, "<stream>", cmd_select_unicast, 2, 0),
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST */
|
||||
SHELL_CMD_ARG(send, NULL, "Send to Audio Stream [data]",
|
||||
cmd_send, 1, 1),
|
||||
SHELL_CMD_ARG(send, NULL, "Send to Audio Stream [data]", cmd_send, 1, 1),
|
||||
#if defined(CONFIG_LIBLC3)
|
||||
SHELL_CMD_ARG(start_sine, NULL, "Start sending a LC3 encoded sine wave",
|
||||
cmd_start_sine, 1, 0),
|
||||
SHELL_CMD_ARG(stop_sine, NULL, "Stop sending a LC3 encoded sine wave",
|
||||
cmd_stop_sine, 1, 0),
|
||||
SHELL_CMD_ARG(start_sine, NULL, "Start sending a LC3 encoded sine wave", cmd_start_sine, 1,
|
||||
0),
|
||||
SHELL_CMD_ARG(stop_sine, NULL, "Stop sending a LC3 encoded sine wave", cmd_stop_sine, 1, 0),
|
||||
#endif /* CONFIG_LIBLC3 */
|
||||
SHELL_COND_CMD_ARG(CONFIG_BT_PACS, set_location, NULL,
|
||||
"<direction: sink, source> <location bitmask>",
|
||||
cmd_set_loc, 3, 0),
|
||||
"<direction: sink, source> <location bitmask>", cmd_set_loc, 3, 0),
|
||||
SHELL_COND_CMD_ARG(CONFIG_BT_PACS, set_context, NULL,
|
||||
"<direction: sink, source>"
|
||||
"<context bitmask> <type: supported, available>",
|
||||
cmd_context, 4, 0),
|
||||
SHELL_SUBCMD_SET_END
|
||||
);
|
||||
SHELL_SUBCMD_SET_END);
|
||||
|
||||
static int cmd_audio(const struct shell *sh, size_t argc, char **argv)
|
||||
{
|
||||
|
@ -2529,7 +2515,7 @@ static ssize_t nonconnectable_ad_data_add(struct bt_data *data_array,
|
|||
ad_len++;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
if (default_source) {
|
||||
static uint8_t ad_bap_broadcast_announcement[5] = {
|
||||
BT_UUID_16_ENCODE(BT_UUID_BROADCAST_AUDIO_VAL),
|
||||
|
@ -2537,8 +2523,7 @@ static ssize_t nonconnectable_ad_data_add(struct bt_data *data_array,
|
|||
uint32_t broadcast_id;
|
||||
int err;
|
||||
|
||||
err = bt_audio_broadcast_source_get_id(default_source,
|
||||
&broadcast_id);
|
||||
err = bt_bap_broadcast_source_get_id(default_source, &broadcast_id);
|
||||
if (err != 0) {
|
||||
printk("Unable to get broadcast ID: %d\n", err);
|
||||
|
||||
|
@ -2553,7 +2538,7 @@ static ssize_t nonconnectable_ad_data_add(struct bt_data *data_array,
|
|||
data_array[ad_len].data = ad_bap_broadcast_announcement;
|
||||
ad_len++;
|
||||
}
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
if (ARRAY_SIZE(ad_ext_uuid16) > 0) {
|
||||
if (data_array_size <= ad_len) {
|
||||
|
@ -2589,7 +2574,7 @@ ssize_t audio_pa_data_add(struct bt_data *data_array,
|
|||
{
|
||||
size_t ad_len = 0;
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
if (default_source) {
|
||||
/* Required size of the buffer depends on what has been
|
||||
* configured. We just use the maximum size possible.
|
||||
|
@ -2597,8 +2582,7 @@ ssize_t audio_pa_data_add(struct bt_data *data_array,
|
|||
NET_BUF_SIMPLE_DEFINE_STATIC(base_buf, UINT8_MAX);
|
||||
int err;
|
||||
|
||||
err = bt_audio_broadcast_source_get_base(default_source,
|
||||
&base_buf);
|
||||
err = bt_bap_broadcast_source_get_base(default_source, &base_buf);
|
||||
if (err != 0) {
|
||||
printk("Unable to get BASE: %d\n", err);
|
||||
|
||||
|
@ -2610,7 +2594,7 @@ ssize_t audio_pa_data_add(struct bt_data *data_array,
|
|||
data_array[ad_len].data = base_buf.data;
|
||||
ad_len++;
|
||||
}
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
return ad_len;
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ CONFIG_BT_AUDIO=y
|
|||
CONFIG_BT_BAP_UNICAST_SERVER=y
|
||||
CONFIG_BT_AUDIO_UNICAST_CLIENT=y
|
||||
CONFIG_BT_AUDIO_UNICAST_CLIENT_GROUP_STREAM_COUNT=2
|
||||
CONFIG_BT_AUDIO_BROADCAST_SOURCE=y
|
||||
CONFIG_BT_BAP_BROADCAST_SOURCE=y
|
||||
CONFIG_BT_BAP_BROADCAST_SINK=y
|
||||
# Only 1 stream support by controller at this point
|
||||
CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT=1
|
||||
CONFIG_BT_AUDIO_BROADCAST_SRC_SUBGROUP_COUNT=1
|
||||
CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=1
|
||||
CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=1
|
||||
# Only 1 stream support by controller at this point
|
||||
CONFIG_BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT=1
|
||||
CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=1
|
||||
|
@ -135,7 +135,7 @@ CONFIG_BT_CSIP_SET_MEMBER_CRYPTO_LOG_LEVEL_DBG=y
|
|||
CONFIG_BT_AUDIO_UNICAST_CLIENT_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_BAP_UNICAST_SERVER_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_BAP_BROADCAST_SINK_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_AUDIO_BROADCAST_SOURCE_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_BAP_BROADCAST_SOURCE_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_ASCS_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_PACS_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_AUDIO_STREAM_LOG_LEVEL_DBG=y
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2022 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2021-2023 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
|
||||
#include <zephyr/bluetooth/bluetooth.h>
|
||||
#include <zephyr/bluetooth/audio/audio.h>
|
||||
#include <zephyr/bluetooth/audio/bap.h>
|
||||
#include "common.h"
|
||||
|
||||
/* When BROADCAST_ENQUEUE_COUNT > 1 we can enqueue enough buffers to ensure that
|
||||
* the controller is never idle
|
||||
*/
|
||||
#define BROADCAST_ENQUEUE_COUNT 2U
|
||||
#define TOTAL_BUF_NEEDED (BROADCAST_ENQUEUE_COUNT * CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT)
|
||||
#define TOTAL_BUF_NEEDED (BROADCAST_ENQUEUE_COUNT * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT)
|
||||
|
||||
BUILD_ASSERT(CONFIG_BT_ISO_TX_BUF_COUNT >= TOTAL_BUF_NEEDED,
|
||||
"CONFIG_BT_ISO_TX_BUF_COUNT should be at least "
|
||||
"BROADCAST_ENQUEUE_COUNT * CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT");
|
||||
"BROADCAST_ENQUEUE_COUNT * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT");
|
||||
|
||||
NET_BUF_POOL_FIXED_DEFINE(tx_pool,
|
||||
TOTAL_BUF_NEEDED,
|
||||
BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL);
|
||||
|
||||
extern enum bst_result_t bst_result;
|
||||
static struct bt_audio_stream broadcast_source_streams[CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_audio_stream broadcast_source_streams[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_audio_stream *streams[ARRAY_SIZE(broadcast_source_streams)];
|
||||
static struct bt_audio_lc3_preset preset_16_2_1 =
|
||||
BT_AUDIO_LC3_BROADCAST_PRESET_16_2_1(BT_AUDIO_LOCATION_FRONT_LEFT,
|
||||
|
@ -96,15 +97,15 @@ static struct bt_audio_stream_ops stream_ops = {
|
|||
.sent = sent_cb
|
||||
};
|
||||
|
||||
static int setup_broadcast_source(struct bt_audio_broadcast_source **source)
|
||||
static int setup_broadcast_source(struct bt_bap_broadcast_source **source)
|
||||
{
|
||||
struct bt_codec_data bis_codec_data = BT_CODEC_DATA(BT_CODEC_CONFIG_LC3_FREQ,
|
||||
BT_CODEC_CONFIG_LC3_FREQ_16KHZ);
|
||||
struct bt_audio_broadcast_source_stream_param
|
||||
struct bt_bap_broadcast_source_stream_param
|
||||
stream_params[ARRAY_SIZE(broadcast_source_streams)];
|
||||
struct bt_audio_broadcast_source_subgroup_param
|
||||
subgroup_params[CONFIG_BT_AUDIO_BROADCAST_SRC_SUBGROUP_COUNT];
|
||||
struct bt_audio_broadcast_source_create_param create_param;
|
||||
struct bt_bap_broadcast_source_subgroup_param
|
||||
subgroup_params[CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT];
|
||||
struct bt_bap_broadcast_source_create_param create_param;
|
||||
int err;
|
||||
|
||||
(void)memset(broadcast_source_streams, 0,
|
||||
|
@ -132,7 +133,7 @@ static int setup_broadcast_source(struct bt_audio_broadcast_source **source)
|
|||
|
||||
printk("Creating broadcast source with %zu subgroups and %zu streams\n",
|
||||
ARRAY_SIZE(subgroup_params), ARRAY_SIZE(stream_params));
|
||||
err = bt_audio_broadcast_source_create(&create_param, source);
|
||||
err = bt_bap_broadcast_source_create(&create_param, source);
|
||||
if (err != 0) {
|
||||
printk("Unable to create broadcast source: %d\n", err);
|
||||
return err;
|
||||
|
@ -141,8 +142,7 @@ static int setup_broadcast_source(struct bt_audio_broadcast_source **source)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int setup_extended_adv(struct bt_audio_broadcast_source *source,
|
||||
struct bt_le_ext_adv **adv)
|
||||
static int setup_extended_adv(struct bt_bap_broadcast_source *source, struct bt_le_ext_adv **adv)
|
||||
{
|
||||
/* Broadcast Audio Streaming Endpoint advertising data */
|
||||
NET_BUF_SIMPLE_DEFINE(ad_buf,
|
||||
|
@ -168,7 +168,7 @@ static int setup_extended_adv(struct bt_audio_broadcast_source *source,
|
|||
return err;
|
||||
}
|
||||
|
||||
err = bt_audio_broadcast_source_get_id(source, &broadcast_id);
|
||||
err = bt_bap_broadcast_source_get_id(source, &broadcast_id);
|
||||
if (err != 0) {
|
||||
printk("Unable to get broadcast ID: %d\n", err);
|
||||
return err;
|
||||
|
@ -187,7 +187,7 @@ static int setup_extended_adv(struct bt_audio_broadcast_source *source,
|
|||
}
|
||||
|
||||
/* Setup periodic advertising data */
|
||||
err = bt_audio_broadcast_source_get_base(source, &base_buf);
|
||||
err = bt_bap_broadcast_source_get_base(source, &base_buf);
|
||||
if (err != 0) {
|
||||
printk("Failed to get encoded BASE: %d\n", err);
|
||||
return err;
|
||||
|
@ -248,7 +248,7 @@ static void test_main(void)
|
|||
{
|
||||
struct bt_codec_data new_metadata[1] =
|
||||
BT_CODEC_LC3_CONFIG_META(BT_AUDIO_CONTEXT_TYPE_ALERTS);
|
||||
struct bt_audio_broadcast_source *source;
|
||||
struct bt_bap_broadcast_source *source;
|
||||
struct bt_le_ext_adv *adv;
|
||||
int err;
|
||||
|
||||
|
@ -273,15 +273,14 @@ static void test_main(void)
|
|||
}
|
||||
|
||||
printk("Reconfiguring broadcast source\n");
|
||||
err = bt_audio_broadcast_source_reconfig(source, &preset_16_2_1.codec,
|
||||
&preset_16_2_1.qos);
|
||||
err = bt_bap_broadcast_source_reconfig(source, &preset_16_2_1.codec, &preset_16_2_1.qos);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to reconfigure broadcast source: %d\n", err);
|
||||
return;
|
||||
}
|
||||
|
||||
printk("Starting broadcast source\n");
|
||||
err = bt_audio_broadcast_source_start(source, adv);
|
||||
err = bt_bap_broadcast_source_start(source, adv);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to start broadcast source: %d\n", err);
|
||||
return;
|
||||
|
@ -305,7 +304,7 @@ static void test_main(void)
|
|||
|
||||
/* Update metadata while streaming */
|
||||
printk("Updating metadata\n");
|
||||
err = bt_audio_broadcast_source_update_metadata(source, new_metadata,
|
||||
err = bt_bap_broadcast_source_update_metadata(source, new_metadata,
|
||||
ARRAY_SIZE(new_metadata));
|
||||
if (err != 0) {
|
||||
FAIL("Failed to update metadata broadcast source: %d", err);
|
||||
|
@ -317,7 +316,7 @@ static void test_main(void)
|
|||
|
||||
printk("Stopping broadcast source\n");
|
||||
SET_FLAG(flag_stopping);
|
||||
err = bt_audio_broadcast_source_stop(source);
|
||||
err = bt_bap_broadcast_source_stop(source);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to stop broadcast source: %d\n", err);
|
||||
return;
|
||||
|
@ -330,7 +329,7 @@ static void test_main(void)
|
|||
}
|
||||
|
||||
printk("Deleting broadcast source\n");
|
||||
err = bt_audio_broadcast_source_delete(source);
|
||||
err = bt_bap_broadcast_source_delete(source);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to delete broadcast source: %d\n", err);
|
||||
return;
|
||||
|
@ -354,7 +353,7 @@ static void test_main(void)
|
|||
}
|
||||
|
||||
printk("Deleting broadcast source\n");
|
||||
err = bt_audio_broadcast_source_delete(source);
|
||||
err = bt_bap_broadcast_source_delete(source);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to delete broadcast source: %d\n", err);
|
||||
return;
|
||||
|
@ -379,11 +378,11 @@ struct bst_test_list *test_broadcast_source_install(struct bst_test_list *tests)
|
|||
return bst_add_tests(tests, test_broadcast_source);
|
||||
}
|
||||
|
||||
#else /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#else /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
struct bst_test_list *test_broadcast_source_install(struct bst_test_list *tests)
|
||||
{
|
||||
return tests;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
|
|
@ -16,18 +16,18 @@
|
|||
* the controller is never idle
|
||||
*/
|
||||
#define BROADCAST_ENQUEUE_COUNT 2U
|
||||
#define TOTAL_BUF_NEEDED (BROADCAST_ENQUEUE_COUNT * CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT)
|
||||
#define TOTAL_BUF_NEEDED (BROADCAST_ENQUEUE_COUNT * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT)
|
||||
|
||||
BUILD_ASSERT(CONFIG_BT_ISO_TX_BUF_COUNT >= TOTAL_BUF_NEEDED,
|
||||
"CONFIG_BT_ISO_TX_BUF_COUNT should be at least "
|
||||
"BROADCAST_ENQUEUE_COUNT * CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT");
|
||||
"BROADCAST_ENQUEUE_COUNT * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT");
|
||||
|
||||
NET_BUF_POOL_FIXED_DEFINE(tx_pool,
|
||||
TOTAL_BUF_NEEDED,
|
||||
BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL);
|
||||
|
||||
extern enum bst_result_t bst_result;
|
||||
static struct bt_cap_stream broadcast_source_streams[CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_cap_stream broadcast_source_streams[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_cap_stream *broadcast_streams[ARRAY_SIZE(broadcast_source_streams)];
|
||||
static struct bt_audio_lc3_preset broadcast_preset_16_2_1 =
|
||||
BT_AUDIO_LC3_BROADCAST_PRESET_16_2_1(BT_AUDIO_LOCATION_FRONT_LEFT,
|
||||
|
@ -485,23 +485,18 @@ static void test_cap_initiator_broadcast(void)
|
|||
|
||||
static const struct bst_test_instance test_cap_initiator[] = {
|
||||
#if defined(CONFIG_BT_AUDIO_UNICAST_CLIENT)
|
||||
{
|
||||
.test_id = "cap_initiator_unicast",
|
||||
{.test_id = "cap_initiator_unicast",
|
||||
.test_post_init_f = test_init,
|
||||
.test_tick_f = test_tick,
|
||||
.test_main_f = test_cap_initiator_unicast
|
||||
},
|
||||
.test_main_f = test_cap_initiator_unicast},
|
||||
#endif /* CONFIG_BT_AUDIO_UNICAST_CLIENT */
|
||||
#if defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
|
||||
{
|
||||
.test_id = "cap_initiator_broadcast",
|
||||
#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
{.test_id = "cap_initiator_broadcast",
|
||||
.test_post_init_f = test_init,
|
||||
.test_tick_f = test_tick,
|
||||
.test_main_f = test_cap_initiator_broadcast
|
||||
},
|
||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SOURCE */
|
||||
BSTEST_END_MARKER
|
||||
};
|
||||
.test_main_f = test_cap_initiator_broadcast},
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
BSTEST_END_MARKER};
|
||||
|
||||
struct bst_test_list *test_cap_initiator_install(struct bst_test_list *tests)
|
||||
{
|
||||
|
|
|
@ -63,8 +63,8 @@ CONFIG_BT_CODEC_MAX_DATA_LEN=40
|
|||
CONFIG_BT_CODEC_MAX_DATA_COUNT=10
|
||||
CONFIG_BT_CODEC_MAX_DATA_LEN=40
|
||||
CONFIG_BT_AUDIO_UNICAST_CLIENT=y
|
||||
CONFIG_BT_AUDIO_BROADCAST_SOURCE=y
|
||||
CONFIG_BT_AUDIO_BROADCAST_SRC_STREAM_COUNT=4
|
||||
CONFIG_BT_BAP_BROADCAST_SOURCE=y
|
||||
CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=4
|
||||
CONFIG_BT_BAP_BROADCAST_SINK=y
|
||||
CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=4
|
||||
CONFIG_BT_ISO_TX_BUF_COUNT=5
|
||||
|
@ -152,7 +152,7 @@ CONFIG_BT_ASCS_LOG_LEVEL_DBG=y
|
|||
CONFIG_BT_PACS_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_BAP_UNICAST_SERVER_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_AUDIO_UNICAST_CLIENT_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_AUDIO_BROADCAST_SOURCE_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_BAP_BROADCAST_SOURCE_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_BAP_BROADCAST_SINK_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_HAS_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_HAS_CLIENT_LOG_LEVEL_DBG=y
|
||||
|
|
|
@ -230,7 +230,7 @@ tests:
|
|||
build_only: true
|
||||
platform_allow: native_posix
|
||||
extra_configs:
|
||||
- CONFIG_BT_AUDIO_BROADCAST_SOURCE=n
|
||||
- CONFIG_BT_BAP_BROADCAST_SOURCE=n
|
||||
bluetooth.audio_shell.no_broadcast_sink:
|
||||
extra_args: CONF_FILE="audio.conf"
|
||||
build_only: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue