Bluetooth: Audio: Rename bt_audio_stream to bt_bap_stream
Rename the bt_audio_stream API to bt_bap_stream and move the API to bap.h Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
e0fc612c93
commit
77853f43f2
35 changed files with 781 additions and 789 deletions
|
|
@ -224,7 +224,7 @@ struct bt_codec_data {
|
|||
*
|
||||
* This macro is mainly for creating an array of struct bt_codec_data
|
||||
* elements inside bt_codec which is then passed to the likes of
|
||||
* bt_audio_stream_config or bt_audio_stream_reconfig.
|
||||
* bt_bap_stream_config or bt_bap_stream_reconfig.
|
||||
*
|
||||
* @param _type Type of advertising data field
|
||||
* @param _bytes Variable number of single-byte parameters
|
||||
|
|
@ -1369,167 +1369,8 @@ struct bt_audio_lc3_preset {
|
|||
BT_CODEC_LC3_QOS_10_UNFRAMED(155u, 4u, 65u, 40000u) \
|
||||
)
|
||||
|
||||
/** @brief Audio stream structure.
|
||||
*
|
||||
* Audio Streams represents a stream configuration of a Remote Endpoint and
|
||||
* a Local Capability.
|
||||
*/
|
||||
struct bt_audio_stream {
|
||||
/** Stream direction */
|
||||
enum bt_audio_dir dir;
|
||||
|
||||
/** Connection reference */
|
||||
struct bt_conn *conn;
|
||||
|
||||
/** Endpoint reference */
|
||||
struct bt_audio_ep *ep;
|
||||
|
||||
/** Codec Configuration */
|
||||
struct bt_codec *codec;
|
||||
|
||||
/** QoS Configuration */
|
||||
struct bt_codec_qos *qos;
|
||||
|
||||
/** Audio stream operations */
|
||||
struct bt_audio_stream_ops *ops;
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST_CLIENT)
|
||||
/** @brief Audio ISO reference
|
||||
*
|
||||
* This is only used for Unicast Client streams,
|
||||
* and is handled internally.
|
||||
*/
|
||||
struct bt_audio_iso *audio_iso;
|
||||
#endif /* CONFIG_BT_BAP_UNICAST_CLIENT */
|
||||
|
||||
/** Unicast or Broadcast group - Used internally */
|
||||
void *group;
|
||||
|
||||
/** Stream user data */
|
||||
void *user_data;
|
||||
|
||||
/* Internally used list node */
|
||||
sys_snode_t _node;
|
||||
};
|
||||
|
||||
/** @brief Stream operation. */
|
||||
struct bt_audio_stream_ops {
|
||||
#if defined(CONFIG_BT_BAP_UNICAST)
|
||||
/** @brief Stream configured callback
|
||||
*
|
||||
* Configured callback is called whenever an Audio Stream has been
|
||||
* configured.
|
||||
*
|
||||
* @param stream Stream object that has been configured.
|
||||
* @param pref Remote QoS preferences.
|
||||
*/
|
||||
void (*configured)(struct bt_audio_stream *stream,
|
||||
const struct bt_codec_qos_pref *pref);
|
||||
|
||||
/** @brief Stream QoS set callback
|
||||
*
|
||||
* QoS set callback is called whenever an Audio Stream Quality of
|
||||
* Service has been set or updated.
|
||||
*
|
||||
* @param stream Stream object that had its QoS updated.
|
||||
*/
|
||||
void (*qos_set)(struct bt_audio_stream *stream);
|
||||
|
||||
/** @brief Stream enabled callback
|
||||
*
|
||||
* Enabled callback is called whenever an Audio Stream has been
|
||||
* enabled.
|
||||
*
|
||||
* @param stream Stream object that has been enabled.
|
||||
*/
|
||||
void (*enabled)(struct bt_audio_stream *stream);
|
||||
|
||||
/** @brief Stream metadata updated callback
|
||||
*
|
||||
* Metadata Updated callback is called whenever an Audio Stream's
|
||||
* metadata has been updated.
|
||||
*
|
||||
* @param stream Stream object that had its metadata updated.
|
||||
*/
|
||||
void (*metadata_updated)(struct bt_audio_stream *stream);
|
||||
|
||||
/** @brief Stream disabled callback
|
||||
*
|
||||
* Disabled callback is called whenever an Audio Stream has been
|
||||
* disabled.
|
||||
*
|
||||
* @param stream Stream object that has been disabled.
|
||||
*/
|
||||
void (*disabled)(struct bt_audio_stream *stream);
|
||||
|
||||
/** @brief Stream released callback
|
||||
*
|
||||
* Released callback is called whenever a Audio Stream has been
|
||||
* released and can be deallocated.
|
||||
*
|
||||
* @param stream Stream object that has been released.
|
||||
*/
|
||||
void (*released)(struct bt_audio_stream *stream);
|
||||
#endif /* CONFIG_BT_BAP_UNICAST */
|
||||
|
||||
/** @brief Stream started callback
|
||||
*
|
||||
* Started callback is called whenever an Audio Stream has been started
|
||||
* and will be usable for streaming.
|
||||
*
|
||||
* @param stream Stream object that has been started.
|
||||
*/
|
||||
void (*started)(struct bt_audio_stream *stream);
|
||||
|
||||
/** @brief Stream stopped callback
|
||||
*
|
||||
* Stopped callback is called whenever an Audio Stream has been
|
||||
* stopped.
|
||||
*
|
||||
* @param stream Stream object that has been stopped.
|
||||
* @param reason BT_HCI_ERR_* reason for the disconnection.
|
||||
*/
|
||||
void (*stopped)(struct bt_audio_stream *stream, uint8_t reason);
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SINK)
|
||||
/** @brief Stream audio HCI receive callback.
|
||||
*
|
||||
* This callback is only used if the ISO data path is HCI.
|
||||
*
|
||||
* @param stream Stream object.
|
||||
* @param info Pointer to the metadata for the buffer. The lifetime
|
||||
* of the pointer is linked to the lifetime of the
|
||||
* net_buf. Metadata such as sequence number and
|
||||
* timestamp can be provided by the bluetooth controller.
|
||||
* @param buf Buffer containing incoming audio data.
|
||||
*/
|
||||
void (*recv)(struct bt_audio_stream *stream,
|
||||
const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf);
|
||||
#endif /* CONFIG_BT_BAP_UNICAST || CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
|
||||
#if defined(CONFIG_BT_BAP_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
|
||||
* been completely sent, or otherwise flushed due to transmission
|
||||
* issues.
|
||||
* This callback is only used if the ISO data path is HCI.
|
||||
*
|
||||
* @param chan The channel which has sent data.
|
||||
*/
|
||||
void (*sent)(struct bt_audio_stream *stream);
|
||||
#endif /* CONFIG_BT_BAP_UNICAST || CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
};
|
||||
|
||||
/** @brief Register Audio callbacks for a stream.
|
||||
*
|
||||
* Register Audio callbacks for a stream.
|
||||
*
|
||||
* @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);
|
||||
/** @brief Abstract Audio Endpoint structure. */
|
||||
struct bt_audio_ep;
|
||||
|
||||
/** Structure holding information of audio stream endpoint */
|
||||
struct bt_audio_ep_info {
|
||||
|
|
@ -1543,184 +1384,19 @@ struct bt_audio_ep_info {
|
|||
enum bt_audio_dir dir;
|
||||
};
|
||||
|
||||
/** @brief Return structure holding information of audio stream endpoint
|
||||
/**
|
||||
* @brief Return structure holding information of audio stream endpoint
|
||||
*
|
||||
* @param ep The audio stream endpoint object.
|
||||
* @param info The structure object to be filled with the info.
|
||||
* @param ep The audio stream endpoint object.
|
||||
* @param info The structure object to be filled with the info.
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
* @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);
|
||||
|
||||
/** @brief Configure Audio Stream
|
||||
*
|
||||
* This procedure is used by a client to configure a new stream using the
|
||||
* remote endpoint, local capability and codec configuration.
|
||||
*
|
||||
* @param conn Connection object
|
||||
* @param stream Stream object being configured
|
||||
* @param ep Remote Audio Endpoint being configured
|
||||
* @param codec Codec configuration
|
||||
*
|
||||
* @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);
|
||||
|
||||
/** @brief Reconfigure Audio Stream
|
||||
*
|
||||
* This procedure is used by a unicast client or unicast server to reconfigure
|
||||
* a stream to use a different local codec configuration.
|
||||
*
|
||||
* This can only be done for unicast streams.
|
||||
*
|
||||
* @param stream Stream object being reconfigured
|
||||
* @param codec Codec configuration
|
||||
*
|
||||
* @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);
|
||||
|
||||
/** @brief Configure Audio Stream QoS
|
||||
*
|
||||
* This procedure is used by a client to configure the Quality of Service of
|
||||
* streams in a unicast group. All streams in the group for the specified
|
||||
* @p conn will have the Quality of Service configured.
|
||||
* This shall only be used to configure unicast streams.
|
||||
*
|
||||
* @param conn Connection object
|
||||
* @param group Unicast group object
|
||||
*
|
||||
* @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);
|
||||
|
||||
/** @brief Enable Audio Stream
|
||||
*
|
||||
* This procedure is used by a client to enable a stream.
|
||||
*
|
||||
* This shall only be called for unicast streams, as broadcast streams will
|
||||
* always be enabled once created.
|
||||
*
|
||||
* @param stream Stream object
|
||||
* @param meta_count Number of metadata entries
|
||||
* @param meta Metadata entries
|
||||
*
|
||||
* @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,
|
||||
size_t meta_count);
|
||||
|
||||
/** @brief Change Audio Stream Metadata
|
||||
*
|
||||
* This procedure is used by a unicast client or unicast server to change the
|
||||
* metadata of a stream.
|
||||
*
|
||||
* @param stream Stream object
|
||||
* @param meta_count Number of metadata entries
|
||||
* @param meta Metadata entries
|
||||
*
|
||||
* @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,
|
||||
size_t meta_count);
|
||||
|
||||
/** @brief Disable Audio Stream
|
||||
*
|
||||
* This procedure is used by a unicast client or unicast server to disable a
|
||||
* stream.
|
||||
*
|
||||
* This shall only be called for unicast streams, as broadcast streams will
|
||||
* always be enabled once created.
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_audio_stream_disable(struct bt_audio_stream *stream);
|
||||
|
||||
/** @brief Start Audio Stream
|
||||
*
|
||||
* This procedure is used by a unicast client or unicast server to make a
|
||||
* stream start streaming.
|
||||
*
|
||||
* For the unicast client, this will connect the CIS for the stream before
|
||||
* sending the start command.
|
||||
*
|
||||
* For the unicast server, this will put a @ref BT_AUDIO_DIR_SINK stream into
|
||||
* the streaming state if the CIS is connected (initialized by the unicast
|
||||
* client). If the CIS is not connected yet, the stream will go into the
|
||||
* streaming state as soon as the CIS is connected.
|
||||
* @ref BT_AUDIO_DIR_SOURCE streams will go into the streaming state when the
|
||||
* unicast client sends the Receiver Start Ready operation, which will trigger
|
||||
* the @ref bt_bap_unicast_server_cb.start() callback.
|
||||
*
|
||||
* 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_bap_broadcast_source_start().
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_audio_stream_start(struct bt_audio_stream *stream);
|
||||
|
||||
/** @brief Stop Audio Stream
|
||||
*
|
||||
* This procedure is used by a client to make a stream stop streaming.
|
||||
*
|
||||
* This shall only be called for unicast streams.
|
||||
* Broadcast sinks cannot be stopped.
|
||||
* Broadcast sources shall be stopped with bt_bap_broadcast_source_stop().
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_audio_stream_stop(struct bt_audio_stream *stream);
|
||||
|
||||
/** @brief Release Audio Stream
|
||||
*
|
||||
* This procedure is used by a unicast client or unicast server to release a
|
||||
* unicast 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_bap_broadcast_source_delete().
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_audio_stream_release(struct bt_audio_stream *stream);
|
||||
|
||||
/** @brief Send data to Audio stream
|
||||
*
|
||||
* Send data from buffer to the stream.
|
||||
*
|
||||
* @note Data will not be sent to linked streams since linking is only
|
||||
* consider for procedures affecting the state machine.
|
||||
*
|
||||
* @param stream Stream object.
|
||||
* @param buf Buffer containing data to be sent.
|
||||
* @param seq_num Packet Sequence number. This value shall be incremented for
|
||||
* each call to this function and at least once per SDU
|
||||
* interval for a specific channel.
|
||||
* @param ts Timestamp of the SDU in microseconds (us).
|
||||
* This value can be used to transmit multiple
|
||||
* SDUs in the same SDU interval in a CIG or BIG. Can be
|
||||
* omitted by using @ref BT_ISO_TIMESTAMP_NONE which will
|
||||
* simply enqueue the ISO SDU in a FIFO manner.
|
||||
*
|
||||
* @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);
|
||||
|
||||
struct bt_audio_unicast_group_stream_param {
|
||||
/** Pointer to a stream object. */
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
/** The QoS settings for the stream object. */
|
||||
struct bt_codec_qos *qos;
|
||||
|
|
@ -1776,9 +1452,9 @@ int bt_audio_unicast_group_create(struct bt_audio_unicast_group_param *param,
|
|||
* bt_audio_unicast_group.
|
||||
*
|
||||
* This can be called at any time before any of the streams in the
|
||||
* group has been started (see bt_audio_stream_ops.started()).
|
||||
* group has been started (see bt_bap_stream_ops.started()).
|
||||
* This can also be called after the streams have been stopped
|
||||
* (see bt_audio_stream_ops.stopped()).
|
||||
* (see bt_bap_stream_ops.stopped()).
|
||||
*
|
||||
* Once a stream has been added to a unicast group, it cannot be removed.
|
||||
* To remove a stream from a group, the group must be deleted with
|
||||
|
|
|
|||
|
|
@ -88,6 +88,343 @@ struct bt_bap_scan_delegator_cb {
|
|||
const struct bt_iso_biginfo *biginfo);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Basic Audio Profile stream structure.
|
||||
*
|
||||
* Streams represents a stream configuration of a Remote Endpoint and a Local Capability.
|
||||
*
|
||||
* @note Streams are unidirectional but can be paired with other streams to use a bidirectional
|
||||
* connected isochronous stream.
|
||||
*/
|
||||
struct bt_bap_stream {
|
||||
/** Stream direction */
|
||||
enum bt_audio_dir dir;
|
||||
|
||||
/** Connection reference */
|
||||
struct bt_conn *conn;
|
||||
|
||||
/** Endpoint reference */
|
||||
struct bt_audio_ep *ep;
|
||||
|
||||
/** Codec Configuration */
|
||||
struct bt_codec *codec;
|
||||
|
||||
/** QoS Configuration */
|
||||
struct bt_codec_qos *qos;
|
||||
|
||||
/** Audio stream operations */
|
||||
struct bt_bap_stream_ops *ops;
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST_CLIENT)
|
||||
/**
|
||||
* @brief Audio ISO reference
|
||||
*
|
||||
* This is only used for Unicast Client streams, and is handled internally.
|
||||
*/
|
||||
struct bt_audio_iso *audio_iso;
|
||||
#endif /* CONFIG_BT_BAP_UNICAST_CLIENT */
|
||||
|
||||
/** Unicast or Broadcast group - Used internally */
|
||||
void *group;
|
||||
|
||||
/** Stream user data */
|
||||
void *user_data;
|
||||
|
||||
/* Internally used list node */
|
||||
sys_snode_t _node;
|
||||
};
|
||||
|
||||
/** @brief Stream operation. */
|
||||
struct bt_bap_stream_ops {
|
||||
#if defined(CONFIG_BT_BAP_UNICAST)
|
||||
/**
|
||||
* @brief Stream configured callback
|
||||
*
|
||||
* Configured callback is called whenever an Audio Stream has been configured.
|
||||
*
|
||||
* @param stream Stream object that has been configured.
|
||||
* @param pref Remote QoS preferences.
|
||||
*/
|
||||
void (*configured)(struct bt_bap_stream *stream, const struct bt_codec_qos_pref *pref);
|
||||
|
||||
/**
|
||||
* @brief Stream QoS set callback
|
||||
*
|
||||
* QoS set callback is called whenever an Audio Stream Quality of Service has been set or
|
||||
* updated.
|
||||
*
|
||||
* @param stream Stream object that had its QoS updated.
|
||||
*/
|
||||
void (*qos_set)(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Stream enabled callback
|
||||
*
|
||||
* Enabled callback is called whenever an Audio Stream has been enabled.
|
||||
*
|
||||
* @param stream Stream object that has been enabled.
|
||||
*/
|
||||
void (*enabled)(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Stream metadata updated callback
|
||||
*
|
||||
* Metadata Updated callback is called whenever an Audio Stream's metadata has been
|
||||
* updated.
|
||||
*
|
||||
* @param stream Stream object that had its metadata updated.
|
||||
*/
|
||||
void (*metadata_updated)(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Stream disabled callback
|
||||
*
|
||||
* Disabled callback is called whenever an Audio Stream has been disabled.
|
||||
*
|
||||
* @param stream Stream object that has been disabled.
|
||||
*/
|
||||
void (*disabled)(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Stream released callback
|
||||
*
|
||||
* Released callback is called whenever a Audio Stream has been released and can be
|
||||
* deallocated.
|
||||
*
|
||||
* @param stream Stream object that has been released.
|
||||
*/
|
||||
void (*released)(struct bt_bap_stream *stream);
|
||||
#endif /* CONFIG_BT_BAP_UNICAST */
|
||||
|
||||
/**
|
||||
* @brief Stream started callback
|
||||
*
|
||||
* Started callback is called whenever an Audio Stream has been started
|
||||
* and will be usable for streaming.
|
||||
*
|
||||
* @param stream Stream object that has been started.
|
||||
*/
|
||||
void (*started)(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Stream stopped callback
|
||||
*
|
||||
* Stopped callback is called whenever an Audio Stream has been stopped.
|
||||
*
|
||||
* @param stream Stream object that has been stopped.
|
||||
* @param reason BT_HCI_ERR_* reason for the disconnection.
|
||||
*/
|
||||
void (*stopped)(struct bt_bap_stream *stream, uint8_t reason);
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SINK)
|
||||
/**
|
||||
* @brief Stream audio HCI receive callback.
|
||||
*
|
||||
* This callback is only used if the ISO data path is HCI.
|
||||
*
|
||||
* @param stream Stream object.
|
||||
* @param info Pointer to the metadata for the buffer. The lifetime of the pointer is
|
||||
* linked to the lifetime of the net_buf. Metadata such as sequence number and
|
||||
* timestamp can be provided by the bluetooth controller.
|
||||
* @param buf Buffer containing incoming audio data.
|
||||
*/
|
||||
void (*recv)(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf);
|
||||
#endif /* CONFIG_BT_BAP_UNICAST || CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
|
||||
#if defined(CONFIG_BT_BAP_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 been completely sent,
|
||||
* or otherwise flushed due to transmission issues.
|
||||
*
|
||||
* This callback is only used if the ISO data path is HCI.
|
||||
*
|
||||
* @param chan The channel which has sent data.
|
||||
*/
|
||||
void (*sent)(struct bt_bap_stream *stream);
|
||||
#endif /* CONFIG_BT_BAP_UNICAST || CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Register Audio callbacks for a stream.
|
||||
*
|
||||
* Register Audio callbacks for a stream.
|
||||
*
|
||||
* @param stream Stream object.
|
||||
* @param ops Stream operations structure.
|
||||
*/
|
||||
void bt_bap_stream_cb_register(struct bt_bap_stream *stream, struct bt_bap_stream_ops *ops);
|
||||
|
||||
/**
|
||||
* @brief Configure Audio Stream
|
||||
*
|
||||
* This procedure is used by a client to configure a new stream using the
|
||||
* remote endpoint, local capability and codec configuration.
|
||||
*
|
||||
* @param conn Connection object
|
||||
* @param stream Stream object being configured
|
||||
* @param ep Remote Audio Endpoint being configured
|
||||
* @param codec Codec configuration
|
||||
*
|
||||
* @return Allocated Audio Stream object or NULL in case of error.
|
||||
*/
|
||||
int bt_bap_stream_config(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_audio_ep *ep,
|
||||
struct bt_codec *codec);
|
||||
|
||||
/**
|
||||
* @brief Reconfigure Audio Stream
|
||||
*
|
||||
* This procedure is used by a unicast client or unicast server to reconfigure
|
||||
* a stream to use a different local codec configuration.
|
||||
*
|
||||
* This can only be done for unicast streams.
|
||||
*
|
||||
* @param stream Stream object being reconfigured
|
||||
* @param codec Codec configuration
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_stream_reconfig(struct bt_bap_stream *stream, struct bt_codec *codec);
|
||||
|
||||
/**
|
||||
* @brief Configure Audio Stream QoS
|
||||
*
|
||||
* This procedure is used by a client to configure the Quality of Service of streams in a unicast
|
||||
* group. All streams in the group for the specified @p conn will have the Quality of Service
|
||||
* configured. This shall only be used to configure unicast streams.
|
||||
*
|
||||
* @param conn Connection object
|
||||
* @param group Unicast group object
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_stream_qos(struct bt_conn *conn, struct bt_audio_unicast_group *group);
|
||||
|
||||
/**
|
||||
* @brief Enable Audio Stream
|
||||
*
|
||||
* This procedure is used by a client to enable a stream.
|
||||
*
|
||||
* This shall only be called for unicast streams, as broadcast streams will always be enabled once
|
||||
* created.
|
||||
*
|
||||
* @param stream Stream object
|
||||
* @param meta_count Number of metadata entries
|
||||
* @param meta Metadata entries
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_stream_enable(struct bt_bap_stream *stream, struct bt_codec_data *meta,
|
||||
size_t meta_count);
|
||||
|
||||
/**
|
||||
* @brief Change Audio Stream Metadata
|
||||
*
|
||||
* This procedure is used by a unicast client or unicast server to change the metadata of a stream.
|
||||
*
|
||||
* @param stream Stream object
|
||||
* @param meta_count Number of metadata entries
|
||||
* @param meta Metadata entries
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_stream_metadata(struct bt_bap_stream *stream, struct bt_codec_data *meta,
|
||||
size_t meta_count);
|
||||
|
||||
/**
|
||||
* @brief Disable Audio Stream
|
||||
*
|
||||
* This procedure is used by a unicast client or unicast server to disable a stream.
|
||||
*
|
||||
* This shall only be called for unicast streams, as broadcast streams will
|
||||
* always be enabled once created.
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_stream_disable(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Start Audio Stream
|
||||
*
|
||||
* This procedure is used by a unicast client or unicast server to make a stream start streaming.
|
||||
*
|
||||
* For the unicast client, this will connect the CIS for the stream before
|
||||
* sending the start command.
|
||||
*
|
||||
* For the unicast server, this will put a @ref BT_AUDIO_DIR_SINK stream into the streaming state if
|
||||
* the CIS is connected (initialized by the unicast client). If the CIS is not connected yet, the
|
||||
* stream will go into the streaming state as soon as the CIS is connected.
|
||||
* @ref BT_AUDIO_DIR_SOURCE streams will go into the streaming state when the unicast client sends
|
||||
* the Receiver Start Ready operation, which will trigger the @ref bt_bap_unicast_server_cb.start()
|
||||
* callback.
|
||||
*
|
||||
* 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_bap_broadcast_source_start().
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_stream_start(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Stop Audio Stream
|
||||
*
|
||||
* This procedure is used by a client to make a stream stop streaming.
|
||||
*
|
||||
* This shall only be called for unicast streams.
|
||||
* Broadcast sinks cannot be stopped.
|
||||
* Broadcast sources shall be stopped with bt_bap_broadcast_source_stop().
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_stream_stop(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Release Audio Stream
|
||||
*
|
||||
* This procedure is used by a unicast client or unicast server to release a unicast 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_bap_broadcast_source_delete().
|
||||
*
|
||||
* @param stream Stream object
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_stream_release(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Send data to Audio stream
|
||||
*
|
||||
* Send data from buffer to the stream.
|
||||
*
|
||||
* @note Data will not be sent to linked streams since linking is only
|
||||
* consider for procedures affecting the state machine.
|
||||
*
|
||||
* @param stream Stream object.
|
||||
* @param buf Buffer containing data to be sent.
|
||||
* @param seq_num Packet Sequence number. This value shall be incremented for each call to this
|
||||
* function and at least once per SDU interval for a specific channel.
|
||||
* @param ts Timestamp of the SDU in microseconds (us). This value can be used to transmit
|
||||
* multiple SDUs in the same SDU interval in a CIG or BIG. Can be omitted by using
|
||||
* @ref BT_ISO_TIMESTAMP_NONE which will simply enqueue the ISO SDU in a FIFO
|
||||
* manner.
|
||||
*
|
||||
* @return Bytes sent in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_stream_send(struct bt_bap_stream *stream, struct net_buf *buf, uint16_t seq_num,
|
||||
uint32_t ts);
|
||||
|
||||
/**
|
||||
* @defgroup bt_bap_unicast_server BAP Unicast Server APIs
|
||||
* @ingroup bt_bap
|
||||
|
|
@ -113,7 +450,7 @@ struct bt_bap_unicast_server_cb {
|
|||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int (*config)(struct bt_conn *conn, const struct bt_audio_ep *ep, enum bt_audio_dir dir,
|
||||
const struct bt_codec *codec, struct bt_audio_stream **stream,
|
||||
const struct bt_codec *codec, struct bt_bap_stream **stream,
|
||||
struct bt_codec_qos_pref *const pref);
|
||||
|
||||
/**
|
||||
|
|
@ -130,7 +467,7 @@ struct bt_bap_unicast_server_cb {
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int (*reconfig)(struct bt_audio_stream *stream, enum bt_audio_dir dir,
|
||||
int (*reconfig)(struct bt_bap_stream *stream, enum bt_audio_dir dir,
|
||||
const struct bt_codec *codec, struct bt_codec_qos_pref *const pref);
|
||||
|
||||
/**
|
||||
|
|
@ -144,7 +481,7 @@ struct bt_bap_unicast_server_cb {
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int (*qos)(struct bt_audio_stream *stream, const struct bt_codec_qos *qos);
|
||||
int (*qos)(struct bt_bap_stream *stream, const struct bt_codec_qos *qos);
|
||||
|
||||
/**
|
||||
* @brief Stream Enable request callback
|
||||
|
|
@ -157,7 +494,7 @@ struct bt_bap_unicast_server_cb {
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int (*enable)(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
|
||||
int (*enable)(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
|
||||
size_t meta_count);
|
||||
|
||||
/**
|
||||
|
|
@ -169,7 +506,7 @@ struct bt_bap_unicast_server_cb {
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int (*start)(struct bt_audio_stream *stream);
|
||||
int (*start)(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Stream Metadata update request callback
|
||||
|
|
@ -182,7 +519,7 @@ struct bt_bap_unicast_server_cb {
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int (*metadata)(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
|
||||
int (*metadata)(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
|
||||
size_t meta_count);
|
||||
|
||||
/**
|
||||
|
|
@ -194,7 +531,7 @@ struct bt_bap_unicast_server_cb {
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int (*disable)(struct bt_audio_stream *stream);
|
||||
int (*disable)(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Stream Stop callback
|
||||
|
|
@ -205,7 +542,7 @@ struct bt_bap_unicast_server_cb {
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int (*stop)(struct bt_audio_stream *stream);
|
||||
int (*stop)(struct bt_bap_stream *stream);
|
||||
|
||||
/**
|
||||
* @brief Stream release callback
|
||||
|
|
@ -217,7 +554,7 @@ struct bt_bap_unicast_server_cb {
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int (*release)(struct bt_audio_stream *stream);
|
||||
int (*release)(struct bt_bap_stream *stream);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -272,7 +609,7 @@ void bt_bap_unicast_server_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t fun
|
|||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_audio_stream *stream,
|
||||
int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_bap_stream *stream,
|
||||
struct bt_codec *codec,
|
||||
const struct bt_codec_qos_pref *qos_pref);
|
||||
|
||||
|
|
@ -400,7 +737,7 @@ int bt_bap_unicast_client_discover(struct bt_conn *conn,
|
|||
/** Broadcast Source stream parameters */
|
||||
struct bt_bap_broadcast_source_stream_param {
|
||||
/** Audio stream */
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
/**
|
||||
* @brief The number of elements in the @p data array.
|
||||
|
|
@ -717,7 +1054,7 @@ int bt_bap_broadcast_sink_scan_stop(void);
|
|||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t indexes_bitfield,
|
||||
struct bt_audio_stream *streams[], const uint8_t broadcast_code[16]);
|
||||
struct bt_bap_stream *streams[], const uint8_t broadcast_code[16]);
|
||||
|
||||
/** @brief Stop audio broadcast sink.
|
||||
*
|
||||
|
|
@ -734,7 +1071,7 @@ int bt_bap_broadcast_sink_stop(struct bt_bap_broadcast_sink *sink);
|
|||
*
|
||||
* Once a broadcast sink has been allocated after the pa_synced callback, it can be deleted using
|
||||
* this function. If the sink has synchronized to any broadcast audio streams, these must first be
|
||||
* stopped using bt_audio_stream_stop.
|
||||
* stopped using bt_bap_stream_stop.
|
||||
*
|
||||
* @param sink Pointer to the sink object to delete.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ union bt_cap_set_member {
|
|||
};
|
||||
|
||||
struct bt_cap_stream {
|
||||
struct bt_audio_stream bap_stream;
|
||||
struct bt_audio_stream_ops *ops;
|
||||
struct bt_bap_stream bap_stream;
|
||||
struct bt_bap_stream_ops *ops;
|
||||
};
|
||||
|
||||
/** @brief Register Audio operations for a Common Audio Profile stream.
|
||||
|
|
@ -154,8 +154,7 @@ struct bt_cap_stream {
|
|||
* @param stream Stream object.
|
||||
* @param ops Stream operations structure.
|
||||
*/
|
||||
void bt_cap_stream_ops_register(struct bt_cap_stream *stream,
|
||||
struct bt_audio_stream_ops *ops);
|
||||
void bt_cap_stream_ops_register(struct bt_cap_stream *stream, struct bt_bap_stream_ops *ops);
|
||||
|
||||
struct bt_cap_unicast_audio_start_param {
|
||||
/** The type of the set. */
|
||||
|
|
@ -319,7 +318,7 @@ struct bt_cap_initiator_broadcast_create_param {
|
|||
* and the device will advertise audio announcements.
|
||||
*
|
||||
* This will allow the streams in the broadcast source to send audio by calling
|
||||
* bt_audio_stream_send().
|
||||
* bt_bap_stream_send().
|
||||
*
|
||||
* @note @kconfig{CONFIG_BT_CAP_INITIATOR} and
|
||||
* @kconfig{CONFIG_BT_BAP_BROADCAST_SOURCE} must be enabled for this function
|
||||
|
|
@ -372,7 +371,7 @@ int bt_cap_initiator_broadcast_audio_stop(struct bt_cap_broadcast_source *broadc
|
|||
*
|
||||
* This can only be done after the broadcast source has been stopped by calling
|
||||
* bt_cap_initiator_broadcast_audio_stop() and after the
|
||||
* bt_audio_stream_ops.stopped() callback has been called for all streams in the
|
||||
* bt_bap_stream_ops.stopped() callback has been called for all streams in the
|
||||
* broadcast source.
|
||||
*
|
||||
* @note @kconfig{CONFIG_BT_CAP_INITIATOR} and
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ static K_SEM_DEFINE(sem_syncable, 0U, 1U);
|
|||
static K_SEM_DEFINE(sem_pa_sync_lost, 0U, 1U);
|
||||
|
||||
static struct bt_bap_broadcast_sink *broadcast_sink;
|
||||
static struct bt_audio_stream streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT];
|
||||
static struct bt_bap_stream streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT];
|
||||
|
||||
static struct bt_codec codec = BT_CODEC_LC3_CONFIG_16_2(BT_AUDIO_LOCATION_FRONT_LEFT,
|
||||
BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED);
|
||||
|
|
@ -30,17 +30,17 @@ static struct bt_codec codec = BT_CODEC_LC3_CONFIG_16_2(BT_AUDIO_LOCATION_FRONT_
|
|||
static const uint32_t bis_index_mask = BIT_MASK(ARRAY_SIZE(streams) + 1U);
|
||||
static uint32_t bis_index_bitfield;
|
||||
|
||||
static void stream_started_cb(struct bt_audio_stream *stream)
|
||||
static void stream_started_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Stream %p started\n", stream);
|
||||
}
|
||||
|
||||
static void stream_stopped_cb(struct bt_audio_stream *stream, uint8_t reason)
|
||||
static void stream_stopped_cb(struct bt_bap_stream *stream, uint8_t reason)
|
||||
{
|
||||
printk("Stream %p stopped with reason 0x%02X\n", stream, reason);
|
||||
}
|
||||
|
||||
static void stream_recv_cb(struct bt_audio_stream *stream,
|
||||
static void stream_recv_cb(struct bt_bap_stream *stream,
|
||||
const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf)
|
||||
{
|
||||
|
|
@ -52,7 +52,7 @@ static void stream_recv_cb(struct bt_audio_stream *stream,
|
|||
}
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops stream_ops = {
|
||||
static struct bt_bap_stream_ops stream_ops = {
|
||||
.started = stream_started_cb,
|
||||
.stopped = stream_stopped_cb,
|
||||
.recv = stream_recv_cb
|
||||
|
|
@ -205,7 +205,7 @@ static void reset(void)
|
|||
|
||||
void main(void)
|
||||
{
|
||||
struct bt_audio_stream *streams_p[ARRAY_SIZE(streams)];
|
||||
struct bt_bap_stream *streams_p[ARRAY_SIZE(streams)];
|
||||
int err;
|
||||
|
||||
err = init();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ BUILD_ASSERT(CONFIG_BT_ISO_TX_BUF_COUNT >= TOTAL_BUF_NEEDED,
|
|||
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_BAP_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_bap_stream streams[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_bap_broadcast_source *broadcast_source;
|
||||
|
||||
NET_BUF_POOL_FIXED_DEFINE(tx_pool,
|
||||
|
|
@ -36,17 +36,17 @@ static K_SEM_DEFINE(sem_stopped, 0U, ARRAY_SIZE(streams));
|
|||
|
||||
#define BROADCAST_SOURCE_LIFETIME 120U /* seconds */
|
||||
|
||||
static void stream_started_cb(struct bt_audio_stream *stream)
|
||||
static void stream_started_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
k_sem_give(&sem_started);
|
||||
}
|
||||
|
||||
static void stream_stopped_cb(struct bt_audio_stream *stream, uint8_t reason)
|
||||
static void stream_stopped_cb(struct bt_bap_stream *stream, uint8_t reason)
|
||||
{
|
||||
k_sem_give(&sem_stopped);
|
||||
}
|
||||
|
||||
static void stream_sent_cb(struct bt_audio_stream *stream)
|
||||
static void stream_sent_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
static uint32_t sent_cnt;
|
||||
struct net_buf *buf;
|
||||
|
|
@ -65,7 +65,7 @@ static void stream_sent_cb(struct bt_audio_stream *stream)
|
|||
|
||||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
net_buf_add_mem(buf, mock_data, preset_16_2_1.qos.sdu);
|
||||
ret = bt_audio_stream_send(stream, buf, seq_num++,
|
||||
ret = bt_bap_stream_send(stream, buf, seq_num++,
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
if (ret < 0) {
|
||||
/* This will end broadcasting on this stream. */
|
||||
|
|
@ -80,7 +80,7 @@ static void stream_sent_cb(struct bt_audio_stream *stream)
|
|||
}
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops stream_ops = {
|
||||
static struct bt_bap_stream_ops stream_ops = {
|
||||
.started = stream_started_cb,
|
||||
.stopped = stream_stopped_cb,
|
||||
.sent = stream_sent_cb
|
||||
|
|
@ -108,7 +108,7 @@ static int setup_broadcast_source(struct bt_bap_broadcast_source **source)
|
|||
stream_params[j].stream = &streams[j];
|
||||
stream_params[j].data = NULL;
|
||||
stream_params[j].data_count = 0U;
|
||||
bt_audio_stream_cb_register(stream_params[j].stream, &stream_ops);
|
||||
bt_bap_stream_cb_register(stream_params[j].stream, &stream_ops);
|
||||
}
|
||||
|
||||
create_param.params_count = ARRAY_SIZE(subgroup_param);
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ static struct bt_codec lc3_codec =
|
|||
|
||||
static struct bt_conn *default_conn;
|
||||
static struct k_work_delayable audio_send_work;
|
||||
static struct bt_audio_stream streams[CONFIG_BT_ASCS_ASE_SNK_COUNT + CONFIG_BT_ASCS_ASE_SRC_COUNT];
|
||||
static struct bt_bap_stream streams[CONFIG_BT_ASCS_ASE_SNK_COUNT + CONFIG_BT_ASCS_ASE_SRC_COUNT];
|
||||
static struct bt_audio_source {
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
uint16_t seq_num;
|
||||
} source_streams[CONFIG_BT_ASCS_ASE_SRC_COUNT];
|
||||
static size_t configured_source_stream_count;
|
||||
|
|
@ -39,7 +39,7 @@ static size_t configured_source_stream_count;
|
|||
static const struct bt_codec_qos_pref qos_pref = BT_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02,
|
||||
10, 20000, 40000, 20000, 40000);
|
||||
|
||||
static uint16_t get_and_incr_seq_num(const struct bt_audio_stream *stream)
|
||||
static uint16_t get_and_incr_seq_num(const struct bt_bap_stream *stream)
|
||||
{
|
||||
for (size_t i = 0U; i < configured_source_stream_count; i++) {
|
||||
if (stream == source_streams[i].stream) {
|
||||
|
|
@ -146,14 +146,14 @@ static void audio_timer_timeout(struct k_work *work)
|
|||
* data going to the server)
|
||||
*/
|
||||
for (size_t i = 0; i < configured_source_stream_count; i++) {
|
||||
struct bt_audio_stream *stream = source_streams[i].stream;
|
||||
struct bt_bap_stream *stream = source_streams[i].stream;
|
||||
|
||||
buf = net_buf_alloc(&tx_pool, K_FOREVER);
|
||||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
|
||||
net_buf_add_mem(buf, buf_data, len_to_send);
|
||||
|
||||
ret = bt_audio_stream_send(stream, buf,
|
||||
ret = bt_bap_stream_send(stream, buf,
|
||||
get_and_incr_seq_num(stream),
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
if (ret < 0) {
|
||||
|
|
@ -174,10 +174,10 @@ static void audio_timer_timeout(struct k_work *work)
|
|||
}
|
||||
}
|
||||
|
||||
static struct bt_audio_stream *stream_alloc(void)
|
||||
static struct bt_bap_stream *stream_alloc(void)
|
||||
{
|
||||
for (size_t i = 0; i < ARRAY_SIZE(streams); i++) {
|
||||
struct bt_audio_stream *stream = &streams[i];
|
||||
struct bt_bap_stream *stream = &streams[i];
|
||||
|
||||
if (!stream->conn) {
|
||||
return stream;
|
||||
|
|
@ -188,7 +188,7 @@ static struct bt_audio_stream *stream_alloc(void)
|
|||
}
|
||||
|
||||
static int lc3_config(struct bt_conn *conn, const struct bt_audio_ep *ep, enum bt_audio_dir dir,
|
||||
const struct bt_codec *codec, struct bt_audio_stream **stream,
|
||||
const struct bt_codec *codec, struct bt_bap_stream **stream,
|
||||
struct bt_codec_qos_pref *const pref)
|
||||
{
|
||||
printk("ASE Codec Config: conn %p ep %p dir %u\n", conn, ep, dir);
|
||||
|
|
@ -213,7 +213,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_audio_ep *ep, enum b
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_reconfig(struct bt_audio_stream *stream, enum bt_audio_dir dir,
|
||||
static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir,
|
||||
const struct bt_codec *codec, struct bt_codec_qos_pref *const pref)
|
||||
{
|
||||
printk("ASE Codec Reconfig: stream %p\n", stream);
|
||||
|
|
@ -224,7 +224,7 @@ static int lc3_reconfig(struct bt_audio_stream *stream, enum bt_audio_dir dir,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
static int lc3_qos(struct bt_audio_stream *stream, const struct bt_codec_qos *qos)
|
||||
static int lc3_qos(struct bt_bap_stream *stream, const struct bt_codec_qos *qos)
|
||||
{
|
||||
printk("QoS: stream %p qos %p\n", stream, qos);
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ static int lc3_qos(struct bt_audio_stream *stream, const struct bt_codec_qos *qo
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_enable(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
|
||||
static int lc3_enable(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
printk("Enable: stream %p meta_count %u\n", stream, meta_count);
|
||||
|
|
@ -241,7 +241,7 @@ static int lc3_enable(struct bt_audio_stream *stream, const struct bt_codec_data
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_start(struct bt_audio_stream *stream)
|
||||
static int lc3_start(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Start: stream %p\n", stream);
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ static bool valid_metadata_type(uint8_t type, uint8_t len)
|
|||
}
|
||||
}
|
||||
|
||||
static int lc3_metadata(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
|
||||
static int lc3_metadata(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
printk("Metadata: stream %p meta_count %u\n", stream, meta_count);
|
||||
|
|
@ -324,21 +324,21 @@ static int lc3_metadata(struct bt_audio_stream *stream, const struct bt_codec_da
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_disable(struct bt_audio_stream *stream)
|
||||
static int lc3_disable(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Disable: stream %p\n", stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_stop(struct bt_audio_stream *stream)
|
||||
static int lc3_stop(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Stop: stream %p\n", stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_release(struct bt_audio_stream *stream)
|
||||
static int lc3_release(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Release: stream %p\n", stream);
|
||||
return 0;
|
||||
|
|
@ -356,13 +356,13 @@ static const struct bt_bap_unicast_server_cb unicast_server_cb = {
|
|||
.release = lc3_release,
|
||||
};
|
||||
|
||||
static void stream_recv(struct bt_audio_stream *stream, const struct bt_iso_recv_info *info,
|
||||
static void stream_recv(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf)
|
||||
{
|
||||
printk("Incoming audio on stream %p len %u\n", stream, buf->len);
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops stream_ops = {
|
||||
static struct bt_bap_stream_ops stream_ops = {
|
||||
.recv = stream_recv
|
||||
};
|
||||
|
||||
|
|
@ -450,7 +450,7 @@ int bap_unicast_sr_init(void)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(streams); i++) {
|
||||
bt_audio_stream_cb_register(&streams[i], &stream_ops);
|
||||
bt_bap_stream_cb_register(&streams[i], &stream_ops);
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_ASCS_ASE_SRC)) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <zephyr/bluetooth/bluetooth.h>
|
||||
#include <zephyr/bluetooth/conn.h>
|
||||
#include <zephyr/bluetooth/audio/audio.h>
|
||||
#include <zephyr/bluetooth/audio/bap.h>
|
||||
#include <zephyr/bluetooth/audio/pacs.h>
|
||||
#include <zephyr/bluetooth/audio/csip.h>
|
||||
#include <zephyr/bluetooth/services/ias.h>
|
||||
|
|
|
|||
|
|
@ -21,10 +21,6 @@ static void start_scan(void);
|
|||
static struct bt_conn *default_conn;
|
||||
static struct k_work_delayable audio_send_work;
|
||||
static struct bt_audio_unicast_group *unicast_group;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
static struct bt_codec *remote_codec_capabilities[CONFIG_BT_BAP_UNICAST_CLIENT_PAC_COUNT];
|
||||
>>>>>>> 7bad1f9a81 (Bluetooth: Audio: Rename bt_audio_unicast_client to bt_bap_...)
|
||||
static struct bt_audio_sink {
|
||||
struct bt_audio_ep *ep;
|
||||
uint16_t seq_num;
|
||||
|
|
@ -33,7 +29,7 @@ static struct bt_audio_ep *sources[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT];
|
|||
NET_BUF_POOL_FIXED_DEFINE(tx_pool, CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT,
|
||||
CONFIG_BT_ISO_TX_MTU + BT_ISO_CHAN_SEND_RESERVE, 8, NULL);
|
||||
|
||||
static struct bt_audio_stream streams[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT +
|
||||
static struct bt_bap_stream streams[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT +
|
||||
CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT];
|
||||
static size_t configured_sink_stream_count;
|
||||
static size_t configured_source_stream_count;
|
||||
|
|
@ -60,7 +56,7 @@ static K_SEM_DEFINE(sem_stream_qos, 0, ARRAY_SIZE(sinks) + ARRAY_SIZE(sources));
|
|||
static K_SEM_DEFINE(sem_stream_enabled, 0, 1);
|
||||
static K_SEM_DEFINE(sem_stream_started, 0, 1);
|
||||
|
||||
static uint16_t get_and_incr_seq_num(const struct bt_audio_stream *stream)
|
||||
static uint16_t get_and_incr_seq_num(const struct bt_bap_stream *stream)
|
||||
{
|
||||
for (size_t i = 0U; i < configured_sink_stream_count; i++) {
|
||||
if (stream->ep == sinks[i].ep) {
|
||||
|
|
@ -183,7 +179,7 @@ static void lc3_audio_timer_timeout(struct k_work *work)
|
|||
}
|
||||
|
||||
for (size_t i = 0U; i < configured_sink_stream_count; i++) {
|
||||
struct bt_audio_stream *stream = &streams[i];
|
||||
struct bt_bap_stream *stream = &streams[i];
|
||||
struct net_buf *buf_to_send;
|
||||
int ret;
|
||||
|
||||
|
|
@ -194,7 +190,7 @@ static void lc3_audio_timer_timeout(struct k_work *work)
|
|||
buf_to_send = net_buf_clone(buf, K_FOREVER);
|
||||
}
|
||||
|
||||
ret = bt_audio_stream_send(stream, buf_to_send,
|
||||
ret = bt_bap_stream_send(stream, buf_to_send,
|
||||
get_and_incr_seq_num(stream),
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
if (ret < 0) {
|
||||
|
|
@ -300,7 +296,7 @@ static void audio_timer_timeout(struct k_work *work)
|
|||
* data going to the server)
|
||||
*/
|
||||
for (size_t i = 0U; i < configured_sink_stream_count; i++) {
|
||||
struct bt_audio_stream *stream = &streams[i];
|
||||
struct bt_bap_stream *stream = &streams[i];
|
||||
struct net_buf *buf_to_send;
|
||||
int ret;
|
||||
|
||||
|
|
@ -311,7 +307,7 @@ static void audio_timer_timeout(struct k_work *work)
|
|||
buf_to_send = net_buf_clone(buf, K_FOREVER);
|
||||
}
|
||||
|
||||
ret = bt_audio_stream_send(stream, buf_to_send,
|
||||
ret = bt_bap_stream_send(stream, buf_to_send,
|
||||
get_and_incr_seq_num(stream),
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
if (ret < 0) {
|
||||
|
|
@ -459,7 +455,7 @@ static void start_scan(void)
|
|||
printk("Scanning successfully started\n");
|
||||
}
|
||||
|
||||
static void stream_configured(struct bt_audio_stream *stream,
|
||||
static void stream_configured(struct bt_bap_stream *stream,
|
||||
const struct bt_codec_qos_pref *pref)
|
||||
{
|
||||
printk("Audio Stream %p configured\n", stream);
|
||||
|
|
@ -467,21 +463,21 @@ static void stream_configured(struct bt_audio_stream *stream,
|
|||
k_sem_give(&sem_stream_configured);
|
||||
}
|
||||
|
||||
static void stream_qos_set(struct bt_audio_stream *stream)
|
||||
static void stream_qos_set(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Audio Stream %p QoS set\n", stream);
|
||||
|
||||
k_sem_give(&sem_stream_qos);
|
||||
}
|
||||
|
||||
static void stream_enabled(struct bt_audio_stream *stream)
|
||||
static void stream_enabled(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Audio Stream %p enabled\n", stream);
|
||||
|
||||
k_sem_give(&sem_stream_enabled);
|
||||
}
|
||||
|
||||
static void stream_started(struct bt_audio_stream *stream)
|
||||
static void stream_started(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Audio Stream %p started\n", stream);
|
||||
|
||||
|
|
@ -496,17 +492,17 @@ static void stream_started(struct bt_audio_stream *stream)
|
|||
k_sem_give(&sem_stream_started);
|
||||
}
|
||||
|
||||
static void stream_metadata_updated(struct bt_audio_stream *stream)
|
||||
static void stream_metadata_updated(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Audio Stream %p metadata updated\n", stream);
|
||||
}
|
||||
|
||||
static void stream_disabled(struct bt_audio_stream *stream)
|
||||
static void stream_disabled(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Audio Stream %p disabled\n", stream);
|
||||
}
|
||||
|
||||
static void stream_stopped(struct bt_audio_stream *stream, uint8_t reason)
|
||||
static void stream_stopped(struct bt_bap_stream *stream, uint8_t reason)
|
||||
{
|
||||
printk("Audio Stream %p stopped with reason 0x%02X\n", stream, reason);
|
||||
|
||||
|
|
@ -514,19 +510,19 @@ static void stream_stopped(struct bt_audio_stream *stream, uint8_t reason)
|
|||
k_work_cancel_delayable(&audio_send_work);
|
||||
}
|
||||
|
||||
static void stream_released(struct bt_audio_stream *stream)
|
||||
static void stream_released(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Audio Stream %p released\n", stream);
|
||||
}
|
||||
|
||||
static void stream_recv(struct bt_audio_stream *stream,
|
||||
static void stream_recv(struct bt_bap_stream *stream,
|
||||
const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf)
|
||||
{
|
||||
printk("Incoming audio on stream %p len %u\n", stream, buf->len);
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops stream_ops = {
|
||||
static struct bt_bap_stream_ops stream_ops = {
|
||||
.configured = stream_configured,
|
||||
.qos_set = stream_qos_set,
|
||||
.enabled = stream_enabled,
|
||||
|
|
@ -826,12 +822,12 @@ static int discover_sources(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int configure_stream(struct bt_audio_stream *stream,
|
||||
static int configure_stream(struct bt_bap_stream *stream,
|
||||
struct bt_audio_ep *ep)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_audio_stream_config(default_conn, stream, ep,
|
||||
err = bt_bap_stream_config(default_conn, stream, ep,
|
||||
&codec_configuration.codec);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
|
|
@ -852,7 +848,7 @@ static int configure_streams(void)
|
|||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(sinks); i++) {
|
||||
struct bt_audio_ep *ep = sinks[i].ep;
|
||||
struct bt_audio_stream *stream = &streams[i];
|
||||
struct bt_bap_stream *stream = &streams[i];
|
||||
|
||||
if (ep == NULL) {
|
||||
continue;
|
||||
|
|
@ -871,7 +867,7 @@ static int configure_streams(void)
|
|||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(sources); i++) {
|
||||
struct bt_audio_ep *ep = sources[i];
|
||||
struct bt_audio_stream *stream = &streams[i + configured_sink_stream_count];
|
||||
struct bt_bap_stream *stream = &streams[i + configured_sink_stream_count];
|
||||
|
||||
if (ep == NULL) {
|
||||
continue;
|
||||
|
|
@ -949,7 +945,7 @@ static int set_stream_qos(void)
|
|||
{
|
||||
int err;
|
||||
|
||||
err = bt_audio_stream_qos(default_conn, unicast_group);
|
||||
err = bt_bap_stream_qos(default_conn, unicast_group);
|
||||
if (err != 0) {
|
||||
printk("Unable to setup QoS: %d\n", err);
|
||||
return err;
|
||||
|
|
@ -972,7 +968,7 @@ static int enable_streams(void)
|
|||
for (size_t i = 0U; i < configured_stream_count; i++) {
|
||||
int err;
|
||||
|
||||
err = bt_audio_stream_enable(&streams[i],
|
||||
err = bt_bap_stream_enable(&streams[i],
|
||||
codec_configuration.codec.meta,
|
||||
codec_configuration.codec.meta_count);
|
||||
if (err != 0) {
|
||||
|
|
@ -995,7 +991,7 @@ static int start_streams(void)
|
|||
for (size_t i = 0U; i < configured_stream_count; i++) {
|
||||
int err;
|
||||
|
||||
err = bt_audio_stream_start(&streams[i]);
|
||||
err = bt_bap_stream_start(&streams[i]);
|
||||
if (err != 0) {
|
||||
printk("Unable to start stream: %d\n", err);
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ static struct bt_codec lc3_codec =
|
|||
|
||||
static struct bt_conn *default_conn;
|
||||
static struct k_work_delayable audio_send_work;
|
||||
static struct bt_audio_stream sink_streams[CONFIG_BT_ASCS_ASE_SNK_COUNT];
|
||||
static struct bt_bap_stream sink_streams[CONFIG_BT_ASCS_ASE_SNK_COUNT];
|
||||
static struct bt_audio_source {
|
||||
struct bt_audio_stream stream;
|
||||
struct bt_bap_stream stream;
|
||||
uint16_t seq_num;
|
||||
uint16_t max_sdu;
|
||||
size_t len_to_send;
|
||||
|
|
@ -70,7 +70,7 @@ static const struct bt_data ad[] = {
|
|||
BT_DATA(BT_DATA_SVC_DATA16, unicast_server_addata, ARRAY_SIZE(unicast_server_addata)),
|
||||
};
|
||||
|
||||
static uint16_t get_and_incr_seq_num(const struct bt_audio_stream *stream)
|
||||
static uint16_t get_and_incr_seq_num(const struct bt_bap_stream *stream)
|
||||
{
|
||||
for (size_t i = 0U; i < configured_source_stream_count; i++) {
|
||||
if (stream == &source_streams[i].stream) {
|
||||
|
|
@ -191,14 +191,14 @@ static void audio_timer_timeout(struct k_work *work)
|
|||
* data going to the server)
|
||||
*/
|
||||
for (size_t i = 0; i < configured_source_stream_count; i++) {
|
||||
struct bt_audio_stream *stream = &source_streams[i].stream;
|
||||
struct bt_bap_stream *stream = &source_streams[i].stream;
|
||||
|
||||
buf = net_buf_alloc(&tx_pool, K_FOREVER);
|
||||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
|
||||
net_buf_add_mem(buf, buf_data, ++source_streams[i].len_to_send);
|
||||
|
||||
ret = bt_audio_stream_send(stream, buf,
|
||||
ret = bt_bap_stream_send(stream, buf,
|
||||
get_and_incr_seq_num(stream),
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
if (ret < 0) {
|
||||
|
|
@ -218,7 +218,7 @@ static void audio_timer_timeout(struct k_work *work)
|
|||
k_work_schedule(&audio_send_work, K_MSEC(1000U));
|
||||
}
|
||||
|
||||
static enum bt_audio_dir stream_dir(const struct bt_audio_stream *stream)
|
||||
static enum bt_audio_dir stream_dir(const struct bt_bap_stream *stream)
|
||||
{
|
||||
for (size_t i = 0U; i < ARRAY_SIZE(source_streams); i++) {
|
||||
if (stream == &source_streams[i].stream) {
|
||||
|
|
@ -236,11 +236,11 @@ static enum bt_audio_dir stream_dir(const struct bt_audio_stream *stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct bt_audio_stream *stream_alloc(enum bt_audio_dir dir)
|
||||
static struct bt_bap_stream *stream_alloc(enum bt_audio_dir dir)
|
||||
{
|
||||
if (dir == BT_AUDIO_DIR_SOURCE) {
|
||||
for (size_t i = 0; i < ARRAY_SIZE(source_streams); i++) {
|
||||
struct bt_audio_stream *stream = &source_streams[i].stream;
|
||||
struct bt_bap_stream *stream = &source_streams[i].stream;
|
||||
|
||||
if (!stream->conn) {
|
||||
return stream;
|
||||
|
|
@ -248,7 +248,7 @@ static struct bt_audio_stream *stream_alloc(enum bt_audio_dir dir)
|
|||
}
|
||||
} else {
|
||||
for (size_t i = 0; i < ARRAY_SIZE(sink_streams); i++) {
|
||||
struct bt_audio_stream *stream = &sink_streams[i];
|
||||
struct bt_bap_stream *stream = &sink_streams[i];
|
||||
|
||||
if (!stream->conn) {
|
||||
return stream;
|
||||
|
|
@ -260,7 +260,7 @@ static struct bt_audio_stream *stream_alloc(enum bt_audio_dir dir)
|
|||
}
|
||||
|
||||
static int lc3_config(struct bt_conn *conn, const struct bt_audio_ep *ep, enum bt_audio_dir dir,
|
||||
const struct bt_codec *codec, struct bt_audio_stream **stream,
|
||||
const struct bt_codec *codec, struct bt_bap_stream **stream,
|
||||
struct bt_codec_qos_pref *const pref)
|
||||
{
|
||||
printk("ASE Codec Config: conn %p ep %p dir %u\n", conn, ep, dir);
|
||||
|
|
@ -290,7 +290,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_audio_ep *ep, enum b
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_reconfig(struct bt_audio_stream *stream, enum bt_audio_dir dir,
|
||||
static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir,
|
||||
const struct bt_codec *codec, struct bt_codec_qos_pref *const pref)
|
||||
{
|
||||
printk("ASE Codec Reconfig: stream %p\n", stream);
|
||||
|
|
@ -306,7 +306,7 @@ static int lc3_reconfig(struct bt_audio_stream *stream, enum bt_audio_dir dir,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
static int lc3_qos(struct bt_audio_stream *stream, const struct bt_codec_qos *qos)
|
||||
static int lc3_qos(struct bt_bap_stream *stream, const struct bt_codec_qos *qos)
|
||||
{
|
||||
printk("QoS: stream %p qos %p\n", stream, qos);
|
||||
|
||||
|
|
@ -322,7 +322,7 @@ static int lc3_qos(struct bt_audio_stream *stream, const struct bt_codec_qos *qo
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_enable(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
|
||||
static int lc3_enable(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
printk("Enable: stream %p meta_count %u\n", stream, meta_count);
|
||||
|
|
@ -359,7 +359,7 @@ static int lc3_enable(struct bt_audio_stream *stream, const struct bt_codec_data
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_start(struct bt_audio_stream *stream)
|
||||
static int lc3_start(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Start: stream %p\n", stream);
|
||||
|
||||
|
|
@ -424,7 +424,7 @@ static bool valid_metadata_type(uint8_t type, uint8_t len)
|
|||
}
|
||||
}
|
||||
|
||||
static int lc3_metadata(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
|
||||
static int lc3_metadata(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
printk("Metadata: stream %p meta_count %u\n", stream, meta_count);
|
||||
|
|
@ -441,21 +441,21 @@ static int lc3_metadata(struct bt_audio_stream *stream, const struct bt_codec_da
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_disable(struct bt_audio_stream *stream)
|
||||
static int lc3_disable(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Disable: stream %p\n", stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_stop(struct bt_audio_stream *stream)
|
||||
static int lc3_stop(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Stop: stream %p\n", stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_release(struct bt_audio_stream *stream)
|
||||
static int lc3_release(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Release: stream %p\n", stream);
|
||||
return 0;
|
||||
|
|
@ -476,7 +476,7 @@ static const struct bt_bap_unicast_server_cb unicast_server_cb = {
|
|||
|
||||
#if defined(CONFIG_LIBLC3)
|
||||
|
||||
static void stream_recv_lc3_codec(struct bt_audio_stream *stream,
|
||||
static void stream_recv_lc3_codec(struct bt_bap_stream *stream,
|
||||
const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf)
|
||||
{
|
||||
|
|
@ -527,7 +527,7 @@ static void stream_recv_lc3_codec(struct bt_audio_stream *stream,
|
|||
|
||||
#else
|
||||
|
||||
static void stream_recv(struct bt_audio_stream *stream,
|
||||
static void stream_recv(struct bt_bap_stream *stream,
|
||||
const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf)
|
||||
{
|
||||
|
|
@ -536,7 +536,7 @@ static void stream_recv(struct bt_audio_stream *stream,
|
|||
|
||||
#endif
|
||||
|
||||
static void stream_stopped(struct bt_audio_stream *stream, uint8_t reason)
|
||||
static void stream_stopped(struct bt_bap_stream *stream, uint8_t reason)
|
||||
{
|
||||
printk("Audio Stream %p stopped with reason 0x%02X\n", stream, reason);
|
||||
|
||||
|
|
@ -545,13 +545,13 @@ static void stream_stopped(struct bt_audio_stream *stream, uint8_t reason)
|
|||
}
|
||||
|
||||
|
||||
static void stream_enabled_cb(struct bt_audio_stream *stream)
|
||||
static void stream_enabled_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
/* The unicast server is responsible for starting sink ASEs after the
|
||||
* client has enabled them.
|
||||
*/
|
||||
if (stream_dir(stream) == BT_AUDIO_DIR_SINK) {
|
||||
const int err = bt_audio_stream_start(stream);
|
||||
const int err = bt_bap_stream_start(stream);
|
||||
|
||||
if (err != 0) {
|
||||
printk("Failed to start stream %p: %d", stream, err);
|
||||
|
|
@ -559,7 +559,7 @@ static void stream_enabled_cb(struct bt_audio_stream *stream)
|
|||
}
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops stream_ops = {
|
||||
static struct bt_bap_stream_ops stream_ops = {
|
||||
#if defined(CONFIG_LIBLC3)
|
||||
.recv = stream_recv_lc3_codec,
|
||||
#else
|
||||
|
|
@ -721,11 +721,11 @@ void main(void)
|
|||
bt_pacs_cap_register(BT_AUDIO_DIR_SOURCE, &cap_source);
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(sink_streams); i++) {
|
||||
bt_audio_stream_cb_register(&sink_streams[i], &stream_ops);
|
||||
bt_bap_stream_cb_register(&sink_streams[i], &stream_ops);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(source_streams); i++) {
|
||||
bt_audio_stream_cb_register(&source_streams[i].stream,
|
||||
bt_bap_stream_cb_register(&source_streams[i].stream,
|
||||
&stream_ops);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ zephyr_library_sources_ifdef(CONFIG_MCTL media_proxy.c)
|
|||
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_ASCS ascs.c)
|
||||
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_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_BAP_UNICAST_CLIENT bap_unicast_client.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_BAP_BROADCAST_SOURCE bap_broadcast_source.c)
|
||||
|
|
|
|||
|
|
@ -252,16 +252,15 @@ config BT_BAP_BROADCAST_ASSISTANT_RECV_STATE_COUNT
|
|||
|
||||
endif # BT_BAP_BROADCAST_ASSISTANT
|
||||
|
||||
config BT_AUDIO_DEBUG_STREAM
|
||||
bool "Bluetooth Audio Stream debug"
|
||||
config BT_BAP_DEBUG_STREAM
|
||||
bool "Basic Audio Profile Stream debug"
|
||||
select DEPRECATED
|
||||
depends on BT_AUDIO_STREAM
|
||||
depends on BT_BAP_STREAM
|
||||
help
|
||||
Use this option to enable Bluetooth Audio Stream debug logs for the
|
||||
Bluetooth Audio functionality.
|
||||
Use this option to enable Basic Audio Profile Stream debug logs.
|
||||
|
||||
module = BT_AUDIO_STREAM
|
||||
legacy-debug-sym = BT_AUDIO_DEBUG_STREAM
|
||||
module = BT_BAP_STREAM
|
||||
legacy-debug-sym = BT_BAP_DEBUG_STREAM
|
||||
module-str = "Bluetooth Audio Stream"
|
||||
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
||||
|
||||
|
|
@ -270,9 +269,9 @@ module = BT_AUDIO_CODEC
|
|||
module-str = "Bluetooth Audio Codec"
|
||||
source "subsys/logging/Kconfig.template.log_config_inherit"
|
||||
|
||||
config BT_AUDIO_DEBUG_STREAM_DATA
|
||||
config BT_BAP_DEBUG_STREAM_DATA
|
||||
bool "Bluetooth Audio Stream data debug"
|
||||
depends on BT_AUDIO_STREAM_LOG_LEVEL_DBG
|
||||
depends on BT_BAP_STREAM_LOG_LEVEL_DBG
|
||||
help
|
||||
Use this option to enable Bluetooth Audio Stream data debug logs for
|
||||
the Bluetooth Audio functionality. This will enable debug logs for all
|
||||
|
|
@ -369,7 +368,7 @@ legacy-debug-sym = BT_DEBUG_BAP_BROADCAST_ASSISTANT
|
|||
module-str = "Broadcast Audio Scan Service client debug"
|
||||
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
||||
|
||||
config BT_AUDIO_STREAM
|
||||
config BT_BAP_STREAM
|
||||
# Virtual/hidden option
|
||||
bool
|
||||
default y if BT_ASCS || BT_BAP_UNICAST_CLIENT || \
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include <zephyr/bluetooth/gatt.h>
|
||||
#include "zephyr/bluetooth/iso.h"
|
||||
#include <zephyr/bluetooth/audio/audio.h>
|
||||
#include <zephyr/bluetooth/audio/bap.h>
|
||||
#include <zephyr/bluetooth/audio/pacs.h>
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
|
|
@ -75,7 +76,7 @@ K_MEM_SLAB_DEFINE(ase_slab, sizeof(struct bt_ascs_ase),
|
|||
|
||||
static struct bt_ascs sessions[CONFIG_BT_MAX_CONN];
|
||||
NET_BUF_SIMPLE_DEFINE_STATIC(ase_buf, CONFIG_BT_L2CAP_TX_MTU);
|
||||
static struct bt_audio_stream *enabling[CONFIG_BT_ISO_MAX_CHAN];
|
||||
static struct bt_bap_stream *enabling[CONFIG_BT_ISO_MAX_CHAN];
|
||||
|
||||
static int control_point_notify(struct bt_conn *conn, const void *data, uint16_t len);
|
||||
static int ascs_ep_get_status(struct bt_audio_ep *ep,
|
||||
|
|
@ -128,8 +129,8 @@ static void ascs_disconnect_stream_work_handler(struct k_work *work)
|
|||
struct bt_ascs_ase *ase = CONTAINER_OF(d_work, struct bt_ascs_ase,
|
||||
disconnect_work);
|
||||
struct bt_audio_ep *ep = &ase->ep;
|
||||
struct bt_audio_stream *stream = ep->stream;
|
||||
struct bt_audio_stream *pair_stream;
|
||||
struct bt_bap_stream *stream = ep->stream;
|
||||
struct bt_bap_stream *pair_stream;
|
||||
|
||||
__ASSERT(stream != NULL &&
|
||||
ep->iso != NULL &&
|
||||
|
|
@ -171,7 +172,7 @@ static void ascs_disconnect_stream_work_handler(struct k_work *work)
|
|||
if (stream != NULL &&
|
||||
ep->iso != NULL &&
|
||||
ep->iso->chan.state == BT_ISO_STATE_CONNECTED) {
|
||||
const int err = bt_audio_stream_disconnect(stream);
|
||||
const int err = bt_bap_stream_disconnect(stream);
|
||||
|
||||
if (err != 0) {
|
||||
LOG_ERR("Failed to disconnect CIS %p: %d",
|
||||
|
|
@ -180,7 +181,7 @@ static void ascs_disconnect_stream_work_handler(struct k_work *work)
|
|||
}
|
||||
}
|
||||
|
||||
static int ascs_disconnect_stream(struct bt_audio_stream *stream)
|
||||
static int ascs_disconnect_stream(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_ascs_ase *ase = CONTAINER_OF(stream->ep, struct bt_ascs_ase,
|
||||
ep);
|
||||
|
|
@ -201,7 +202,7 @@ static int ascs_disconnect_stream(struct bt_audio_stream *stream)
|
|||
|
||||
void ascs_ep_set_state(struct bt_audio_ep *ep, uint8_t state)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
bool state_changed;
|
||||
uint8_t old_state;
|
||||
|
||||
|
|
@ -228,7 +229,7 @@ void ascs_ep_set_state(struct bt_audio_ep *ep, uint8_t state)
|
|||
stream = ep->stream;
|
||||
|
||||
if (stream->ops != NULL) {
|
||||
const struct bt_audio_stream_ops *ops = stream->ops;
|
||||
const struct bt_bap_stream_ops *ops = stream->ops;
|
||||
|
||||
switch (state) {
|
||||
case BT_AUDIO_EP_STATE_IDLE:
|
||||
|
|
@ -405,7 +406,7 @@ void ascs_ep_set_state(struct bt_audio_ep *ep, uint8_t state)
|
|||
bt_audio_iso_unbind_ep(ep->iso, ep);
|
||||
}
|
||||
|
||||
bt_audio_stream_detach(stream);
|
||||
bt_bap_stream_detach(stream);
|
||||
ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_IDLE);
|
||||
} else {
|
||||
/* Either the client or the server may disconnect the
|
||||
|
|
@ -585,7 +586,7 @@ static int ascs_iso_accept(const struct bt_iso_accept_info *info,
|
|||
LOG_DBG("acl %p", info->acl);
|
||||
|
||||
for (size_t i = 0U; i < ARRAY_SIZE(enabling); i++) {
|
||||
struct bt_audio_stream *c = enabling[i];
|
||||
struct bt_bap_stream *c = enabling[i];
|
||||
|
||||
if (c != NULL && c->ep->cig_id == info->cig_id && c->ep->cis_id == info->cis_id) {
|
||||
*iso_chan = &enabling[i]->ep->iso->chan;
|
||||
|
|
@ -602,9 +603,9 @@ static int ascs_iso_accept(const struct bt_iso_accept_info *info,
|
|||
return -EPERM;
|
||||
}
|
||||
|
||||
static int ascs_iso_listen(struct bt_audio_stream *stream)
|
||||
static int ascs_iso_listen(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_stream **free_stream = NULL;
|
||||
struct bt_bap_stream **free_stream = NULL;
|
||||
static struct bt_iso_server iso_server = {
|
||||
.sec_level = BT_SECURITY_L2,
|
||||
.accept = ascs_iso_accept,
|
||||
|
|
@ -653,8 +654,8 @@ static void ascs_iso_recv(struct bt_iso_chan *chan,
|
|||
struct net_buf *buf)
|
||||
{
|
||||
struct bt_audio_iso *iso = CONTAINER_OF(chan, struct bt_audio_iso, chan);
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_audio_stream *stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep;
|
||||
|
||||
ep = iso->rx.ep;
|
||||
|
|
@ -674,7 +675,7 @@ static void ascs_iso_recv(struct bt_iso_chan *chan,
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA) &&
|
||||
if (IS_ENABLED(CONFIG_BT_BAP_DEBUG_STREAM_DATA) &&
|
||||
ep->status.state != BT_AUDIO_EP_STATE_STREAMING) {
|
||||
LOG_DBG("ep %p is not in the streaming state: %s",
|
||||
ep, bt_audio_ep_state_str(ep->status.state));
|
||||
|
|
@ -689,7 +690,7 @@ static void ascs_iso_recv(struct bt_iso_chan *chan,
|
|||
|
||||
ops = stream->ops;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA)) {
|
||||
if (IS_ENABLED(CONFIG_BT_BAP_DEBUG_STREAM_DATA)) {
|
||||
LOG_DBG("stream %p ep %p len %zu", stream, stream->ep, net_buf_frags_len(buf));
|
||||
}
|
||||
|
||||
|
|
@ -703,8 +704,8 @@ static void ascs_iso_recv(struct bt_iso_chan *chan,
|
|||
static void ascs_iso_sent(struct bt_iso_chan *chan)
|
||||
{
|
||||
struct bt_audio_iso *iso = CONTAINER_OF(chan, struct bt_audio_iso, chan);
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_audio_stream *stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep;
|
||||
|
||||
ep = iso->tx.ep;
|
||||
|
|
@ -721,7 +722,7 @@ static void ascs_iso_sent(struct bt_iso_chan *chan)
|
|||
|
||||
ops = stream->ops;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA)) {
|
||||
if (IS_ENABLED(CONFIG_BT_BAP_DEBUG_STREAM_DATA)) {
|
||||
LOG_DBG("stream %p ep %p", stream, stream->ep);
|
||||
}
|
||||
|
||||
|
|
@ -732,7 +733,7 @@ static void ascs_iso_sent(struct bt_iso_chan *chan)
|
|||
|
||||
static void ascs_ep_iso_connected(struct bt_audio_ep *ep)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
if (ep->status.state != BT_AUDIO_EP_STATE_ENABLING) {
|
||||
LOG_DBG("ep %p not in enabling state: %s",
|
||||
|
|
@ -778,8 +779,8 @@ static void ascs_iso_connected(struct bt_iso_chan *chan)
|
|||
static void ascs_ep_iso_disconnected(struct bt_audio_ep *ep, uint8_t reason)
|
||||
{
|
||||
struct bt_ascs_ase *ase = CONTAINER_OF(ep, struct bt_ascs_ase, ep);
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_audio_stream *stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
struct bt_bap_stream *stream;
|
||||
int err;
|
||||
|
||||
stream = ep->stream;
|
||||
|
|
@ -815,7 +816,7 @@ static void ascs_ep_iso_disconnected(struct bt_audio_ep *ep, uint8_t reason)
|
|||
|
||||
if (ep->status.state == BT_AUDIO_EP_STATE_RELEASING) {
|
||||
bt_audio_iso_unbind_ep(ep->iso, ep);
|
||||
bt_audio_stream_detach(stream);
|
||||
bt_bap_stream_detach(stream);
|
||||
ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_IDLE);
|
||||
} else {
|
||||
/* The ASE state machine goes into different states from this operation
|
||||
|
|
@ -1018,7 +1019,7 @@ static void ase_release(struct bt_ascs_ase *ase)
|
|||
|
||||
static void ase_disable(struct bt_ascs_ase *ase)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep;
|
||||
int err;
|
||||
|
||||
|
|
@ -1077,7 +1078,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
|||
sys_snode_t *ase_node, *s;
|
||||
|
||||
SYS_SLIST_FOR_EACH_NODE_SAFE(&session->ases, ase_node, s) {
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_ascs_ase *ase;
|
||||
|
||||
ase = CONTAINER_OF(ase_node, struct bt_ascs_ase, node);
|
||||
|
|
@ -1090,7 +1091,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
|||
ase_release(ase);
|
||||
|
||||
if (stream != NULL) {
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
|
||||
/* Notify upper layer */
|
||||
ops = stream->ops;
|
||||
|
|
@ -1167,7 +1168,7 @@ static struct bt_audio_iso *audio_iso_get_or_new(struct bt_ascs *ascs,
|
|||
}
|
||||
|
||||
static void ase_stream_add(struct bt_ascs *ascs, struct bt_ascs_ase *ase,
|
||||
struct bt_audio_stream *stream)
|
||||
struct bt_bap_stream *stream)
|
||||
{
|
||||
LOG_DBG("ase %p stream %p", ase, stream);
|
||||
ase->ep.stream = stream;
|
||||
|
|
@ -1419,7 +1420,7 @@ static int ase_config(struct bt_ascs *ascs, struct bt_ascs_ase *ase,
|
|||
const struct bt_ascs_config *cfg,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_codec codec;
|
||||
int err;
|
||||
|
||||
|
|
@ -1529,18 +1530,17 @@ static int ase_config(struct bt_ascs *ascs, struct bt_ascs_ase *ase,
|
|||
|
||||
ascs_cp_rsp_success(ASE_ID(ase), BT_ASCS_CONFIG_OP);
|
||||
|
||||
/* TODO: bt_audio_stream_attach duplicates some of the
|
||||
/* TODO: bt_bap_stream_attach duplicates some of the
|
||||
* ase_stream_add. Should be cleaned up.
|
||||
*/
|
||||
bt_audio_stream_attach(ascs->conn, stream, &ase->ep,
|
||||
&ase->ep.codec);
|
||||
bt_bap_stream_attach(ascs->conn, stream, &ase->ep, &ase->ep.codec);
|
||||
|
||||
ascs_ep_set_state(&ase->ep, BT_AUDIO_EP_STATE_CODEC_CONFIGURED);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bt_ascs_config_ase(struct bt_conn *conn, struct bt_audio_stream *stream, struct bt_codec *codec,
|
||||
int bt_ascs_config_ase(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_codec *codec,
|
||||
const struct bt_codec_qos_pref *qos_pref)
|
||||
{
|
||||
int err;
|
||||
|
|
@ -1591,7 +1591,7 @@ int bt_ascs_config_ase(struct bt_conn *conn, struct bt_audio_stream *stream, str
|
|||
|
||||
ep->qos_pref = *qos_pref;
|
||||
|
||||
bt_audio_stream_attach(conn, stream, ep, &ep->codec);
|
||||
bt_bap_stream_attach(conn, stream, ep, &ep->codec);
|
||||
|
||||
ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_CODEC_CONFIGURED);
|
||||
|
||||
|
|
@ -1678,11 +1678,8 @@ void bt_ascs_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t func, void *user_
|
|||
}
|
||||
}
|
||||
|
||||
static int ase_stream_qos(struct bt_audio_stream *stream,
|
||||
struct bt_codec_qos *qos,
|
||||
struct bt_ascs *ascs,
|
||||
uint8_t cig_id,
|
||||
uint8_t cis_id)
|
||||
static int ase_stream_qos(struct bt_bap_stream *stream, struct bt_codec_qos *qos,
|
||||
struct bt_ascs *ascs, uint8_t cig_id, uint8_t cis_id)
|
||||
{
|
||||
struct bt_audio_ep *ep;
|
||||
|
||||
|
|
@ -1774,7 +1771,7 @@ static int ase_stream_qos(struct bt_audio_stream *stream,
|
|||
static void ase_qos(struct bt_ascs_ase *ase, const struct bt_ascs_qos *qos)
|
||||
{
|
||||
struct bt_audio_ep *ep = &ase->ep;
|
||||
struct bt_audio_stream *stream = ep->stream;
|
||||
struct bt_bap_stream *stream = ep->stream;
|
||||
struct bt_codec_qos *cqos = &ep->qos;
|
||||
const uint8_t cig_id = qos->cig;
|
||||
const uint8_t cis_id = qos->cis;
|
||||
|
|
@ -2053,7 +2050,7 @@ static int ase_metadata(struct bt_ascs_ase *ase, uint8_t op,
|
|||
struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_codec_data metadata_backup[CONFIG_BT_CODEC_MAX_DATA_COUNT];
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep;
|
||||
uint8_t state;
|
||||
int err;
|
||||
|
|
@ -2124,7 +2121,7 @@ done:
|
|||
static int ase_enable(struct bt_ascs_ase *ase, struct bt_ascs_metadata *meta,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep;
|
||||
int err;
|
||||
|
||||
|
|
@ -2394,7 +2391,7 @@ static ssize_t ascs_disable(struct bt_ascs *ascs, struct net_buf_simple *buf)
|
|||
|
||||
static void ase_stop(struct bt_ascs_ase *ase)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep;
|
||||
int err;
|
||||
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ static inline const char *bt_ascs_reason_str(uint8_t reason)
|
|||
|
||||
void ascs_ep_set_state(struct bt_audio_ep *ep, uint8_t state);
|
||||
|
||||
int bt_ascs_config_ase(struct bt_conn *conn, struct bt_audio_stream *stream, struct bt_codec *codec,
|
||||
int bt_ascs_config_ase(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_codec *codec,
|
||||
const struct bt_codec_qos_pref *qos_pref);
|
||||
|
||||
void bt_ascs_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t func, void *user_data);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include <zephyr/bluetooth/conn.h>
|
||||
#include <zephyr/bluetooth/gatt.h>
|
||||
#include <zephyr/bluetooth/audio/audio.h>
|
||||
#include <zephyr/bluetooth/audio/bap.h>
|
||||
#include <zephyr/bluetooth/audio/pacs.h>
|
||||
|
||||
#include "../host/conn_internal.h"
|
||||
|
|
@ -111,7 +112,7 @@ static void broadcast_sink_set_ep_state(struct bt_audio_ep *ep, uint8_t state)
|
|||
ep->status.state = state;
|
||||
|
||||
if (state == BT_AUDIO_EP_STATE_IDLE) {
|
||||
struct bt_audio_stream *stream = ep->stream;
|
||||
struct bt_bap_stream *stream = ep->stream;
|
||||
|
||||
if (stream != NULL) {
|
||||
bt_audio_iso_unbind_ep(ep->iso, ep);
|
||||
|
|
@ -127,8 +128,8 @@ static void broadcast_sink_iso_recv(struct bt_iso_chan *chan,
|
|||
struct net_buf *buf)
|
||||
{
|
||||
struct bt_audio_iso *iso = CONTAINER_OF(chan, struct bt_audio_iso, chan);
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_audio_stream *stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep = iso->rx.ep;
|
||||
|
||||
if (ep == NULL) {
|
||||
|
|
@ -144,7 +145,7 @@ static void broadcast_sink_iso_recv(struct bt_iso_chan *chan,
|
|||
|
||||
ops = stream->ops;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA)) {
|
||||
if (IS_ENABLED(CONFIG_BT_BAP_DEBUG_STREAM_DATA)) {
|
||||
LOG_DBG("stream %p ep %p len %zu", stream, stream->ep, net_buf_frags_len(buf));
|
||||
}
|
||||
|
||||
|
|
@ -158,8 +159,8 @@ static void broadcast_sink_iso_recv(struct bt_iso_chan *chan,
|
|||
static void broadcast_sink_iso_connected(struct bt_iso_chan *chan)
|
||||
{
|
||||
struct bt_audio_iso *iso = CONTAINER_OF(chan, struct bt_audio_iso, chan);
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_audio_stream *stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep = iso->rx.ep;
|
||||
|
||||
if (ep == NULL) {
|
||||
|
|
@ -190,8 +191,8 @@ static void broadcast_sink_iso_disconnected(struct bt_iso_chan *chan,
|
|||
uint8_t reason)
|
||||
{
|
||||
struct bt_audio_iso *iso = CONTAINER_OF(chan, struct bt_audio_iso, chan);
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_audio_stream *stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep = iso->rx.ep;
|
||||
struct bt_bap_broadcast_sink *sink;
|
||||
|
||||
|
|
@ -917,7 +918,7 @@ static struct bt_audio_ep *broadcast_sink_new_ep(uint8_t index)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int bt_bap_broadcast_sink_setup_stream(uint8_t index, struct bt_audio_stream *stream,
|
||||
static int bt_bap_broadcast_sink_setup_stream(uint8_t index, struct bt_bap_stream *stream,
|
||||
struct bt_codec *codec)
|
||||
{
|
||||
static struct bt_codec_qos codec_qos;
|
||||
|
|
@ -949,7 +950,7 @@ static int bt_bap_broadcast_sink_setup_stream(uint8_t index, struct bt_audio_str
|
|||
|
||||
bt_audio_iso_unref(iso);
|
||||
|
||||
bt_audio_stream_attach(NULL, stream, ep, codec);
|
||||
bt_bap_stream_attach(NULL, stream, ep, codec);
|
||||
stream->qos = &codec_qos;
|
||||
|
||||
return 0;
|
||||
|
|
@ -957,7 +958,7 @@ static int bt_bap_broadcast_sink_setup_stream(uint8_t index, struct bt_audio_str
|
|||
|
||||
static void broadcast_sink_cleanup_streams(struct bt_bap_broadcast_sink *sink)
|
||||
{
|
||||
struct bt_audio_stream *stream, *next;
|
||||
struct bt_bap_stream *stream, *next;
|
||||
|
||||
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&sink->streams, stream, next, _node) {
|
||||
if (stream->ep != NULL) {
|
||||
|
|
@ -1012,7 +1013,7 @@ static bool codec_lookup_id(const struct bt_pacs_cap *cap, void *user_data)
|
|||
}
|
||||
|
||||
int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t indexes_bitfield,
|
||||
struct bt_audio_stream *streams[], const uint8_t broadcast_code[16])
|
||||
struct bt_bap_stream *streams[], const uint8_t broadcast_code[16])
|
||||
{
|
||||
struct bt_iso_big_sync_param param;
|
||||
struct bt_codec *codecs[BROADCAST_SNK_STREAM_CNT] = { NULL };
|
||||
|
|
@ -1103,7 +1104,7 @@ int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t inde
|
|||
|
||||
sink->stream_count = 0U;
|
||||
for (size_t i = 0; i < stream_count; i++) {
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_codec *codec;
|
||||
|
||||
stream = streams[i];
|
||||
|
|
@ -1116,7 +1117,7 @@ int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t inde
|
|||
return err;
|
||||
}
|
||||
|
||||
sink->bis[i] = bt_audio_stream_iso_chan_get(stream);
|
||||
sink->bis[i] = bt_bap_stream_iso_chan_get(stream);
|
||||
sys_slist_append(&sink->streams, &stream->_node);
|
||||
sink->stream_count++;
|
||||
}
|
||||
|
|
@ -1152,7 +1153,7 @@ int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t inde
|
|||
|
||||
int bt_bap_broadcast_sink_stop(struct bt_bap_broadcast_sink *sink)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
sys_snode_t *head_node;
|
||||
int err;
|
||||
|
||||
|
|
@ -1167,7 +1168,7 @@ int bt_bap_broadcast_sink_stop(struct bt_bap_broadcast_sink *sink)
|
|||
}
|
||||
|
||||
head_node = sys_slist_peek_head(&sink->streams);
|
||||
stream = CONTAINER_OF(head_node, struct bt_audio_stream, _node);
|
||||
stream = CONTAINER_OF(head_node, struct bt_bap_stream, _node);
|
||||
|
||||
/* All streams in a broadcast source is in the same state,
|
||||
* so we can just check the first stream
|
||||
|
|
@ -1206,11 +1207,11 @@ int bt_bap_broadcast_sink_delete(struct bt_bap_broadcast_sink *sink)
|
|||
}
|
||||
|
||||
if (!sys_slist_is_empty(&sink->streams)) {
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
sys_snode_t *head_node;
|
||||
|
||||
head_node = sys_slist_peek_head(&sink->streams);
|
||||
stream = CONTAINER_OF(head_node, struct bt_audio_stream, _node);
|
||||
stream = CONTAINER_OF(head_node, struct bt_bap_stream, _node);
|
||||
|
||||
/* All streams in a broadcast source is in the same state,
|
||||
* so we can just check the first stream
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include <zephyr/bluetooth/conn.h>
|
||||
#include <zephyr/bluetooth/gatt.h>
|
||||
#include <zephyr/bluetooth/audio/audio.h>
|
||||
#include <zephyr/bluetooth/audio/bap.h>
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(bt_bap_broadcast_source, CONFIG_BT_BAP_BROADCAST_SOURCE_LOG_LEVEL);
|
||||
|
|
@ -106,7 +107,7 @@ static void broadcast_source_set_ep_state(struct bt_audio_ep *ep, uint8_t state)
|
|||
ep->status.state = state;
|
||||
|
||||
if (state == BT_AUDIO_EP_STATE_IDLE) {
|
||||
struct bt_audio_stream *stream = ep->stream;
|
||||
struct bt_bap_stream *stream = ep->stream;
|
||||
|
||||
if (stream != NULL) {
|
||||
stream->ep = NULL;
|
||||
|
|
@ -119,8 +120,8 @@ static void broadcast_source_set_ep_state(struct bt_audio_ep *ep, uint8_t state)
|
|||
static void broadcast_source_iso_sent(struct bt_iso_chan *chan)
|
||||
{
|
||||
struct bt_audio_iso *iso = CONTAINER_OF(chan, struct bt_audio_iso, chan);
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_audio_stream *stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep = iso->tx.ep;
|
||||
|
||||
if (ep == NULL) {
|
||||
|
|
@ -136,7 +137,7 @@ static void broadcast_source_iso_sent(struct bt_iso_chan *chan)
|
|||
|
||||
ops = stream->ops;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA)) {
|
||||
if (IS_ENABLED(CONFIG_BT_BAP_DEBUG_STREAM_DATA)) {
|
||||
LOG_DBG("stream %p ep %p", stream, stream->ep);
|
||||
}
|
||||
|
||||
|
|
@ -148,8 +149,8 @@ static void broadcast_source_iso_sent(struct bt_iso_chan *chan)
|
|||
static void broadcast_source_iso_connected(struct bt_iso_chan *chan)
|
||||
{
|
||||
struct bt_audio_iso *iso = CONTAINER_OF(chan, struct bt_audio_iso, chan);
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_audio_stream *stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep = iso->tx.ep;
|
||||
|
||||
if (ep == NULL) {
|
||||
|
|
@ -179,8 +180,8 @@ static void broadcast_source_iso_connected(struct bt_iso_chan *chan)
|
|||
static void broadcast_source_iso_disconnected(struct bt_iso_chan *chan, uint8_t reason)
|
||||
{
|
||||
struct bt_audio_iso *iso = CONTAINER_OF(chan, struct bt_audio_iso, chan);
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_audio_stream *stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep = iso->tx.ep;
|
||||
|
||||
if (ep == NULL) {
|
||||
|
|
@ -262,7 +263,7 @@ 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,
|
||||
static int broadcast_source_setup_stream(uint8_t index, struct bt_bap_stream *stream,
|
||||
struct bt_codec *codec, struct bt_codec_qos *qos,
|
||||
struct bt_bap_broadcast_source *source)
|
||||
{
|
||||
|
|
@ -289,7 +290,7 @@ static int broadcast_source_setup_stream(uint8_t index, struct bt_audio_stream *
|
|||
|
||||
bt_audio_iso_unref(iso);
|
||||
|
||||
bt_audio_stream_attach(NULL, stream, ep, codec);
|
||||
bt_bap_stream_attach(NULL, stream, ep, codec);
|
||||
stream->qos = qos;
|
||||
ep->broadcast_source = source;
|
||||
|
||||
|
|
@ -301,7 +302,7 @@ static bool encode_base_subgroup(struct bt_audio_broadcast_subgroup *subgroup,
|
|||
uint8_t *streams_encoded,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
const struct bt_codec *codec;
|
||||
uint8_t stream_count;
|
||||
uint8_t bis_index;
|
||||
|
|
@ -496,7 +497,7 @@ static void broadcast_source_cleanup(struct bt_bap_broadcast_source *source)
|
|||
|
||||
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&source->subgroups, subgroup,
|
||||
next_subgroup, _node) {
|
||||
struct bt_audio_stream *stream, *next_stream;
|
||||
struct bt_bap_stream *stream, *next_stream;
|
||||
|
||||
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&subgroup->streams, stream,
|
||||
next_stream, _node) {
|
||||
|
|
@ -588,7 +589,7 @@ static bool valid_create_param(const struct bt_bap_broadcast_source_create_param
|
|||
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;
|
||||
struct bt_bap_stream *stream;
|
||||
sys_snode_t *head_node;
|
||||
|
||||
if (source == NULL) {
|
||||
|
|
@ -606,7 +607,7 @@ static enum bt_audio_state broadcast_source_get_state(struct bt_bap_broadcast_so
|
|||
subgroup = CONTAINER_OF(head_node, struct bt_audio_broadcast_subgroup, _node);
|
||||
|
||||
head_node = sys_slist_peek_head(&subgroup->streams);
|
||||
stream = CONTAINER_OF(head_node, struct bt_audio_stream, _node);
|
||||
stream = CONTAINER_OF(head_node, struct bt_bap_stream, _node);
|
||||
|
||||
/* All streams in a broadcast source is in the same state,
|
||||
* so we can just check the first stream
|
||||
|
|
@ -685,7 +686,7 @@ int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_create_param *
|
|||
|
||||
for (size_t j = 0U; j < subgroup_param->params_count; j++) {
|
||||
const struct bt_bap_broadcast_source_stream_param *stream_param;
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
stream_param = &subgroup_param->params[j];
|
||||
stream = stream_param->stream;
|
||||
|
|
@ -723,7 +724,7 @@ int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_create_param *
|
|||
|
||||
/* Finalize state changes and store information */
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&source->subgroups, subgroup, _node) {
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&subgroup->streams, stream, _node) {
|
||||
broadcast_source_set_ep_state(stream->ep,
|
||||
|
|
@ -751,7 +752,7 @@ int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, str
|
|||
{
|
||||
struct bt_audio_broadcast_subgroup *subgroup;
|
||||
enum bt_audio_state broadcast_state;
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
CHECKIF(source == NULL) {
|
||||
LOG_DBG("source is NULL");
|
||||
|
|
@ -770,7 +771,7 @@ int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, str
|
|||
|
||||
iso_qos = stream->ep->iso->chan.qos->tx;
|
||||
|
||||
bt_audio_stream_attach(NULL, stream, stream->ep, codec);
|
||||
bt_bap_stream_attach(NULL, stream, stream->ep, codec);
|
||||
|
||||
bt_audio_codec_qos_to_iso_qos(iso_qos, qos);
|
||||
bt_audio_codec_to_iso_path(iso_qos->path, codec);
|
||||
|
|
@ -863,7 +864,7 @@ int bt_bap_broadcast_source_start(struct bt_bap_broadcast_source *source, struct
|
|||
struct bt_iso_big_create_param param = { 0 };
|
||||
struct bt_audio_broadcast_subgroup *subgroup;
|
||||
enum bt_audio_state broadcast_state;
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
size_t bis_count;
|
||||
int err;
|
||||
|
||||
|
|
@ -881,7 +882,7 @@ int bt_bap_broadcast_source_start(struct bt_bap_broadcast_source *source, struct
|
|||
bis_count = 0;
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&source->subgroups, subgroup, _node) {
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&subgroup->streams, stream, _node) {
|
||||
bis[bis_count++] = bt_audio_stream_iso_chan_get(stream);
|
||||
bis[bis_count++] = bt_bap_stream_iso_chan_get(stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct bt_audio_ep {
|
|||
uint8_t cig_id;
|
||||
uint8_t cis_id;
|
||||
struct bt_ascs_ase_status status;
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_codec codec;
|
||||
struct bt_codec_qos qos;
|
||||
struct bt_codec_qos_pref qos_pref;
|
||||
|
|
|
|||
|
|
@ -255,8 +255,7 @@ struct bt_audio_ep *bt_audio_iso_get_paired_ep(const struct bt_audio_ep *ep)
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST_CLIENT)
|
||||
void bt_audio_iso_bind_stream(struct bt_audio_iso *audio_iso,
|
||||
struct bt_audio_stream *stream)
|
||||
void bt_audio_iso_bind_stream(struct bt_audio_iso *audio_iso, struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_iso_dir *audio_iso_ep;
|
||||
|
||||
|
|
@ -284,8 +283,7 @@ void bt_audio_iso_bind_stream(struct bt_audio_iso *audio_iso,
|
|||
stream->audio_iso = bt_audio_iso_ref(audio_iso);
|
||||
}
|
||||
|
||||
void bt_audio_iso_unbind_stream(struct bt_audio_iso *audio_iso,
|
||||
struct bt_audio_stream *stream)
|
||||
void bt_audio_iso_unbind_stream(struct bt_audio_iso *audio_iso, struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_iso_dir *audio_iso_ep;
|
||||
|
||||
|
|
@ -314,8 +312,7 @@ void bt_audio_iso_unbind_stream(struct bt_audio_iso *audio_iso,
|
|||
stream->audio_iso = NULL;
|
||||
}
|
||||
|
||||
struct bt_audio_stream *bt_audio_iso_get_stream(struct bt_audio_iso *iso,
|
||||
enum bt_audio_dir dir)
|
||||
struct bt_bap_stream *bt_audio_iso_get_stream(struct bt_audio_iso *iso, enum bt_audio_dir dir)
|
||||
{
|
||||
__ASSERT(dir == BT_AUDIO_DIR_SINK || dir == BT_AUDIO_DIR_SOURCE,
|
||||
"invalid dir: %u", dir);
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@
|
|||
|
||||
#include <zephyr/bluetooth/iso.h>
|
||||
#include <zephyr/bluetooth/audio/audio.h>
|
||||
#include <zephyr/bluetooth/audio/bap.h>
|
||||
|
||||
struct bt_audio_iso_dir {
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep;
|
||||
struct bt_iso_chan_path path;
|
||||
struct bt_iso_chan_io_qos qos;
|
||||
|
|
@ -48,9 +49,6 @@ struct bt_audio_ep *bt_audio_iso_get_ep(bool unicast_client,
|
|||
|
||||
struct bt_audio_ep *bt_audio_iso_get_paired_ep(const struct bt_audio_ep *ep);
|
||||
/* Unicast client-only functions*/
|
||||
void bt_audio_iso_bind_stream(struct bt_audio_iso *audio_iso,
|
||||
struct bt_audio_stream *stream);
|
||||
void bt_audio_iso_unbind_stream(struct bt_audio_iso *audio_iso,
|
||||
struct bt_audio_stream *stream);
|
||||
struct bt_audio_stream *bt_audio_iso_get_stream(struct bt_audio_iso *iso,
|
||||
enum bt_audio_dir dir);
|
||||
void bt_audio_iso_bind_stream(struct bt_audio_iso *audio_iso, struct bt_bap_stream *stream);
|
||||
void bt_audio_iso_unbind_stream(struct bt_audio_iso *audio_iso, struct bt_bap_stream *stream);
|
||||
struct bt_bap_stream *bt_audio_iso_get_stream(struct bt_audio_iso *iso, enum bt_audio_dir dir);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <zephyr/bluetooth/hci.h>
|
||||
#include <zephyr/bluetooth/iso.h>
|
||||
#include <zephyr/bluetooth/audio/audio.h>
|
||||
#include <zephyr/bluetooth/audio/bap.h>
|
||||
|
||||
#include "../host/conn_internal.h"
|
||||
#include "../host/iso_internal.h"
|
||||
|
|
@ -29,7 +30,7 @@
|
|||
|
||||
#include <zephyr/logging/log.h>
|
||||
|
||||
LOG_MODULE_REGISTER(bt_audio_stream, CONFIG_BT_AUDIO_STREAM_LOG_LEVEL);
|
||||
LOG_MODULE_REGISTER(bt_bap_stream, CONFIG_BT_BAP_STREAM_LOG_LEVEL);
|
||||
|
||||
static uint8_t pack_bt_codec_cc(const struct bt_codec *codec, uint8_t cc[])
|
||||
{
|
||||
|
|
@ -77,8 +78,8 @@ void bt_audio_codec_qos_to_iso_qos(struct bt_iso_chan_io_qos *io,
|
|||
* CONFIG_BT_BAP_BROADCAST_SINK \
|
||||
*/
|
||||
|
||||
void bt_audio_stream_attach(struct bt_conn *conn,
|
||||
struct bt_audio_stream *stream,
|
||||
void bt_bap_stream_attach(struct bt_conn *conn,
|
||||
struct bt_bap_stream *stream,
|
||||
struct bt_audio_ep *ep,
|
||||
struct bt_codec *codec)
|
||||
{
|
||||
|
|
@ -96,7 +97,7 @@ void bt_audio_stream_attach(struct bt_conn *conn,
|
|||
ep->stream = stream;
|
||||
}
|
||||
|
||||
struct bt_iso_chan *bt_audio_stream_iso_chan_get(struct bt_audio_stream *stream)
|
||||
struct bt_iso_chan *bt_bap_stream_iso_chan_get(struct bt_bap_stream *stream)
|
||||
{
|
||||
if (stream != NULL && stream->ep != NULL && stream->ep->iso != NULL) {
|
||||
return &stream->ep->iso->chan;
|
||||
|
|
@ -105,8 +106,8 @@ struct bt_iso_chan *bt_audio_stream_iso_chan_get(struct bt_audio_stream *stream)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void bt_audio_stream_cb_register(struct bt_audio_stream *stream,
|
||||
struct bt_audio_stream_ops *ops)
|
||||
void bt_bap_stream_cb_register(struct bt_bap_stream *stream,
|
||||
struct bt_bap_stream_ops *ops)
|
||||
{
|
||||
stream->ops = ops;
|
||||
}
|
||||
|
|
@ -156,7 +157,7 @@ bool bt_audio_valid_qos(const struct bt_codec_qos *qos)
|
|||
return true;
|
||||
}
|
||||
|
||||
int bt_audio_stream_send(struct bt_audio_stream *stream, struct net_buf *buf,
|
||||
int bt_bap_stream_send(struct bt_bap_stream *stream, struct net_buf *buf,
|
||||
uint16_t seq_num, uint32_t ts)
|
||||
{
|
||||
struct bt_audio_ep *ep;
|
||||
|
|
@ -175,13 +176,13 @@ int bt_audio_stream_send(struct bt_audio_stream *stream, struct net_buf *buf,
|
|||
|
||||
/* TODO: Add checks for broadcast sink */
|
||||
|
||||
return bt_iso_chan_send(bt_audio_stream_iso_chan_get(stream),
|
||||
return bt_iso_chan_send(bt_bap_stream_iso_chan_get(stream),
|
||||
buf, seq_num, ts);
|
||||
}
|
||||
#endif /* CONFIG_BT_BAP_UNICAST || CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST)
|
||||
static bool bt_audio_stream_is_broadcast(const struct bt_audio_stream *stream)
|
||||
static bool bt_bap_stream_is_broadcast(const struct bt_bap_stream *stream)
|
||||
{
|
||||
return (IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SOURCE) &&
|
||||
bt_audio_ep_is_broadcast_src(stream->ep)) ||
|
||||
|
|
@ -189,7 +190,7 @@ static bool bt_audio_stream_is_broadcast(const struct bt_audio_stream *stream)
|
|||
bt_audio_ep_is_broadcast_snk(stream->ep));
|
||||
}
|
||||
|
||||
bool bt_audio_valid_stream_qos(const struct bt_audio_stream *stream,
|
||||
bool bt_audio_valid_stream_qos(const struct bt_bap_stream *stream,
|
||||
const struct bt_codec_qos *qos)
|
||||
{
|
||||
const struct bt_codec_qos_pref *qos_pref = &stream->ep->qos_pref;
|
||||
|
|
@ -208,9 +209,9 @@ bool bt_audio_valid_stream_qos(const struct bt_audio_stream *stream,
|
|||
return true;
|
||||
}
|
||||
|
||||
void bt_audio_stream_detach(struct bt_audio_stream *stream)
|
||||
void bt_bap_stream_detach(struct bt_bap_stream *stream)
|
||||
{
|
||||
const bool is_broadcast = bt_audio_stream_is_broadcast(stream);
|
||||
const bool is_broadcast = bt_bap_stream_is_broadcast(stream);
|
||||
|
||||
LOG_DBG("stream %p", stream);
|
||||
|
||||
|
|
@ -223,13 +224,13 @@ void bt_audio_stream_detach(struct bt_audio_stream *stream)
|
|||
stream->ep = NULL;
|
||||
|
||||
if (!is_broadcast) {
|
||||
bt_audio_stream_disconnect(stream);
|
||||
bt_bap_stream_disconnect(stream);
|
||||
}
|
||||
}
|
||||
|
||||
int bt_audio_stream_disconnect(struct bt_audio_stream *stream)
|
||||
int bt_bap_stream_disconnect(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_iso_chan *iso_chan = bt_audio_stream_iso_chan_get(stream);
|
||||
struct bt_iso_chan *iso_chan = bt_bap_stream_iso_chan_get(stream);
|
||||
|
||||
LOG_DBG("stream %p iso %p", stream, iso_chan);
|
||||
|
||||
|
|
@ -244,7 +245,7 @@ int bt_audio_stream_disconnect(struct bt_audio_stream *stream)
|
|||
return bt_iso_chan_disconnect(iso_chan);
|
||||
}
|
||||
|
||||
void bt_audio_stream_reset(struct bt_audio_stream *stream)
|
||||
void bt_bap_stream_reset(struct bt_bap_stream *stream)
|
||||
{
|
||||
LOG_DBG("stream %p", stream);
|
||||
|
||||
|
|
@ -256,13 +257,13 @@ void bt_audio_stream_reset(struct bt_audio_stream *stream)
|
|||
bt_audio_iso_unbind_ep(stream->ep->iso, stream->ep);
|
||||
}
|
||||
|
||||
bt_audio_stream_detach(stream);
|
||||
bt_bap_stream_detach(stream);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST_CLIENT)
|
||||
|
||||
int bt_audio_stream_config(struct bt_conn *conn,
|
||||
struct bt_audio_stream *stream,
|
||||
int bt_bap_stream_config(struct bt_conn *conn,
|
||||
struct bt_bap_stream *stream,
|
||||
struct bt_audio_ep *ep,
|
||||
struct bt_codec *codec)
|
||||
{
|
||||
|
|
@ -303,7 +304,7 @@ int bt_audio_stream_config(struct bt_conn *conn,
|
|||
return -EBADMSG;
|
||||
}
|
||||
|
||||
bt_audio_stream_attach(conn, stream, ep, codec);
|
||||
bt_bap_stream_attach(conn, stream, ep, codec);
|
||||
|
||||
err = bt_bap_unicast_client_config(stream, codec);
|
||||
if (err != 0) {
|
||||
|
|
@ -314,7 +315,7 @@ int bt_audio_stream_config(struct bt_conn *conn,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_stream_qos(struct bt_conn *conn,
|
||||
int bt_bap_stream_qos(struct bt_conn *conn,
|
||||
struct bt_audio_unicast_group *group)
|
||||
{
|
||||
uint8_t role;
|
||||
|
|
@ -352,7 +353,7 @@ int bt_audio_stream_qos(struct bt_conn *conn,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_stream_enable(struct bt_audio_stream *stream,
|
||||
int bt_bap_stream_enable(struct bt_bap_stream *stream,
|
||||
struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
|
|
@ -387,7 +388,7 @@ int bt_audio_stream_enable(struct bt_audio_stream *stream,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_stream_stop(struct bt_audio_stream *stream)
|
||||
int bt_bap_stream_stop(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_ep *ep;
|
||||
uint8_t role;
|
||||
|
|
@ -425,7 +426,7 @@ int bt_audio_stream_stop(struct bt_audio_stream *stream)
|
|||
}
|
||||
#endif /* CONFIG_BT_BAP_UNICAST_CLIENT */
|
||||
|
||||
int bt_audio_stream_reconfig(struct bt_audio_stream *stream,
|
||||
int bt_bap_stream_reconfig(struct bt_bap_stream *stream,
|
||||
struct bt_codec *codec)
|
||||
{
|
||||
uint8_t state;
|
||||
|
|
@ -476,7 +477,7 @@ int bt_audio_stream_reconfig(struct bt_audio_stream *stream,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_stream_start(struct bt_audio_stream *stream)
|
||||
int bt_bap_stream_start(struct bt_bap_stream *stream)
|
||||
{
|
||||
uint8_t state;
|
||||
uint8_t role;
|
||||
|
|
@ -516,7 +517,7 @@ int bt_audio_stream_start(struct bt_audio_stream *stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_stream_metadata(struct bt_audio_stream *stream,
|
||||
int bt_bap_stream_metadata(struct bt_bap_stream *stream,
|
||||
struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
|
|
@ -566,7 +567,7 @@ int bt_audio_stream_metadata(struct bt_audio_stream *stream,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_stream_disable(struct bt_audio_stream *stream)
|
||||
int bt_bap_stream_disable(struct bt_bap_stream *stream)
|
||||
{
|
||||
uint8_t state;
|
||||
uint8_t role;
|
||||
|
|
@ -608,7 +609,7 @@ int bt_audio_stream_disable(struct bt_audio_stream *stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_audio_stream_release(struct bt_audio_stream *stream)
|
||||
int bt_bap_stream_release(struct bt_bap_stream *stream)
|
||||
{
|
||||
uint8_t state;
|
||||
uint8_t role;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ static void unicast_client_ep_idle_state(struct bt_audio_ep *ep);
|
|||
* If the CIS is used for another stream, or if the CIS is not in the connected
|
||||
* state it will return false.
|
||||
*/
|
||||
static bool unicast_client_can_disconnect_stream(const struct bt_audio_stream *stream)
|
||||
static bool unicast_client_can_disconnect_stream(const struct bt_bap_stream *stream)
|
||||
{
|
||||
const struct bt_audio_ep *stream_ep;
|
||||
enum bt_iso_state iso_state;
|
||||
|
|
@ -137,8 +137,8 @@ static void unicast_client_ep_iso_recv(struct bt_iso_chan *chan,
|
|||
const struct bt_iso_recv_info *info, struct net_buf *buf)
|
||||
{
|
||||
struct bt_audio_iso *iso = CONTAINER_OF(chan, struct bt_audio_iso, chan);
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_audio_stream *stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep = iso->rx.ep;
|
||||
|
||||
if (ep == NULL) {
|
||||
|
|
@ -157,7 +157,7 @@ static void unicast_client_ep_iso_recv(struct bt_iso_chan *chan,
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA) &&
|
||||
if (IS_ENABLED(CONFIG_BT_BAP_DEBUG_STREAM_DATA) &&
|
||||
ep->status.state != BT_AUDIO_EP_STATE_STREAMING) {
|
||||
LOG_DBG("ep %p is not in the streaming state: %s", ep,
|
||||
bt_audio_ep_state_str(ep->status.state));
|
||||
|
|
@ -172,7 +172,7 @@ static void unicast_client_ep_iso_recv(struct bt_iso_chan *chan,
|
|||
|
||||
ops = stream->ops;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA)) {
|
||||
if (IS_ENABLED(CONFIG_BT_BAP_DEBUG_STREAM_DATA)) {
|
||||
LOG_DBG("stream %p ep %p len %zu", stream, ep, net_buf_frags_len(buf));
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ static void unicast_client_ep_iso_recv(struct bt_iso_chan *chan,
|
|||
static void unicast_client_ep_iso_sent(struct bt_iso_chan *chan)
|
||||
{
|
||||
struct bt_audio_iso *iso = CONTAINER_OF(chan, struct bt_audio_iso, chan);
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_audio_ep *ep = iso->tx.ep;
|
||||
|
||||
if (ep == NULL) {
|
||||
|
|
@ -200,7 +200,7 @@ static void unicast_client_ep_iso_sent(struct bt_iso_chan *chan)
|
|||
return;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_AUDIO_DEBUG_STREAM_DATA)) {
|
||||
if (IS_ENABLED(CONFIG_BT_BAP_DEBUG_STREAM_DATA)) {
|
||||
LOG_DBG("stream %p ep %p", stream, ep);
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ static void unicast_client_ep_iso_sent(struct bt_iso_chan *chan)
|
|||
|
||||
static void unicast_client_ep_iso_connected(struct bt_audio_ep *ep)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
if (ep->status.state != BT_AUDIO_EP_STATE_ENABLING) {
|
||||
LOG_DBG("endpoint not in enabling state: %s",
|
||||
|
|
@ -248,7 +248,7 @@ static void unicast_client_iso_connected(struct bt_iso_chan *chan)
|
|||
|
||||
static void unicast_client_ep_iso_disconnected(struct bt_audio_ep *ep, uint8_t reason)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
stream = ep->stream;
|
||||
if (stream == NULL) {
|
||||
|
|
@ -431,8 +431,8 @@ static struct bt_audio_ep *unicast_client_ep_get(struct bt_conn *conn, enum bt_a
|
|||
|
||||
static void unicast_client_ep_idle_state(struct bt_audio_ep *ep)
|
||||
{
|
||||
struct bt_audio_stream *stream = ep->stream;
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
struct bt_bap_stream *stream = ep->stream;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
|
||||
if (stream == NULL) {
|
||||
return;
|
||||
|
|
@ -440,7 +440,7 @@ static void unicast_client_ep_idle_state(struct bt_audio_ep *ep)
|
|||
|
||||
/* If CIS is connected, disconnect and wait for CIS disconnection */
|
||||
if (unicast_client_can_disconnect_stream(stream)) {
|
||||
const int err = bt_audio_stream_disconnect(stream);
|
||||
const int err = bt_bap_stream_disconnect(stream);
|
||||
|
||||
if (err != 0) {
|
||||
LOG_ERR("Failed to disconnect stream: %d", err);
|
||||
|
|
@ -460,7 +460,7 @@ static void unicast_client_ep_idle_state(struct bt_audio_ep *ep)
|
|||
LOG_WRN("No callback for released set");
|
||||
}
|
||||
|
||||
bt_audio_stream_reset(stream);
|
||||
bt_bap_stream_reset(stream);
|
||||
}
|
||||
|
||||
static void unicast_client_ep_qos_update(struct bt_audio_ep *ep,
|
||||
|
|
@ -494,7 +494,7 @@ static void unicast_client_ep_config_state(struct bt_audio_ep *ep, struct net_bu
|
|||
{
|
||||
struct bt_ascs_ase_status_config *cfg;
|
||||
struct bt_codec_qos_pref *pref;
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
void *cc;
|
||||
|
||||
if (buf->len < sizeof(*cfg)) {
|
||||
|
|
@ -559,7 +559,7 @@ static void unicast_client_ep_qos_state(struct bt_audio_ep *ep, struct net_buf_s
|
|||
uint8_t old_state)
|
||||
{
|
||||
struct bt_ascs_ase_status_qos *qos;
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
if (buf->len < sizeof(*qos)) {
|
||||
LOG_ERR("QoS status too short");
|
||||
|
|
@ -608,7 +608,7 @@ static void unicast_client_ep_qos_state(struct bt_audio_ep *ep, struct net_buf_s
|
|||
|
||||
/* Disconnect ISO if connected */
|
||||
if (unicast_client_can_disconnect_stream(stream)) {
|
||||
const int err = bt_audio_stream_disconnect(stream);
|
||||
const int err = bt_bap_stream_disconnect(stream);
|
||||
|
||||
if (err != 0) {
|
||||
LOG_ERR("Failed to disconnect stream: %d", err);
|
||||
|
|
@ -643,7 +643,7 @@ static void unicast_client_ep_enabling_state(struct bt_audio_ep *ep, struct net_
|
|||
bool state_changed)
|
||||
{
|
||||
struct bt_ascs_ase_status_enable *enable;
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
void *metadata;
|
||||
|
||||
if (buf->len < sizeof(*enable)) {
|
||||
|
|
@ -694,7 +694,7 @@ static void unicast_client_ep_streaming_state(struct bt_audio_ep *ep, struct net
|
|||
bool state_changed)
|
||||
{
|
||||
struct bt_ascs_ase_status_stream *stream_status;
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
if (buf->len < sizeof(*stream_status)) {
|
||||
LOG_ERR("Streaming status too short");
|
||||
|
|
@ -733,7 +733,7 @@ static void unicast_client_ep_streaming_state(struct bt_audio_ep *ep, struct net
|
|||
static void unicast_client_ep_disabling_state(struct bt_audio_ep *ep, struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_ascs_ase_status_disable *disable;
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
if (buf->len < sizeof(*disable)) {
|
||||
LOG_ERR("Disabling status too short");
|
||||
|
|
@ -760,7 +760,7 @@ static void unicast_client_ep_disabling_state(struct bt_audio_ep *ep, struct net
|
|||
|
||||
static void unicast_client_ep_releasing_state(struct bt_audio_ep *ep, struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
stream = ep->stream;
|
||||
if (stream == NULL) {
|
||||
|
|
@ -777,7 +777,7 @@ static void unicast_client_ep_releasing_state(struct bt_audio_ep *ep, struct net
|
|||
* Section 9.3.15 in when the Unicast Client has determined
|
||||
* that the ASE is in the Releasing state.
|
||||
*/
|
||||
const int err = bt_audio_stream_disconnect(stream);
|
||||
const int err = bt_bap_stream_disconnect(stream);
|
||||
|
||||
if (err != 0) {
|
||||
LOG_ERR("Failed to disconnect stream: %d", err);
|
||||
|
|
@ -1589,12 +1589,12 @@ static void unicast_client_reset(struct bt_audio_ep *ep)
|
|||
{
|
||||
struct bt_bap_unicast_client_ep *client_ep =
|
||||
CONTAINER_OF(ep, struct bt_bap_unicast_client_ep, ep);
|
||||
struct bt_audio_stream *stream = ep->stream;
|
||||
struct bt_bap_stream *stream = ep->stream;
|
||||
|
||||
LOG_DBG("ep %p", ep);
|
||||
|
||||
if (stream != NULL && ep->status.state != BT_AUDIO_EP_STATE_IDLE) {
|
||||
const struct bt_audio_stream_ops *ops;
|
||||
const struct bt_bap_stream_ops *ops;
|
||||
|
||||
/* Notify upper layer */
|
||||
ops = stream->ops;
|
||||
|
|
@ -1605,7 +1605,7 @@ static void unicast_client_reset(struct bt_audio_ep *ep)
|
|||
}
|
||||
}
|
||||
|
||||
bt_audio_stream_reset(stream);
|
||||
bt_bap_stream_reset(stream);
|
||||
|
||||
(void)memset(ep, 0, sizeof(*ep));
|
||||
|
||||
|
|
@ -1724,7 +1724,7 @@ static int bt_audio_cig_reconfigure(struct bt_audio_unicast_group *group,
|
|||
static void audio_stream_qos_cleanup(const struct bt_conn *conn,
|
||||
struct bt_audio_unicast_group *group)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&group->streams, stream, _node) {
|
||||
if (stream->conn != conn && stream->ep != NULL) {
|
||||
|
|
@ -1743,12 +1743,12 @@ static int unicast_client_cig_terminate(struct bt_audio_unicast_group *group)
|
|||
return bt_iso_cig_terminate(group->cig);
|
||||
}
|
||||
|
||||
static int unicast_client_stream_connect(struct bt_audio_stream *stream)
|
||||
static int unicast_client_stream_connect(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_iso_connect_param param;
|
||||
struct bt_iso_chan *iso_chan;
|
||||
|
||||
iso_chan = bt_audio_stream_iso_chan_get(stream);
|
||||
iso_chan = bt_bap_stream_iso_chan_get(stream);
|
||||
|
||||
LOG_DBG("stream %p iso %p", stream, iso_chan);
|
||||
|
||||
|
|
@ -1800,7 +1800,7 @@ static int unicast_group_add_iso(struct bt_audio_unicast_group *group, struct bt
|
|||
|
||||
static void unicast_group_del_iso(struct bt_audio_unicast_group *group, struct bt_audio_iso *iso)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
__ASSERT_NO_MSG(group != NULL);
|
||||
__ASSERT_NO_MSG(iso != NULL);
|
||||
|
|
@ -1863,7 +1863,7 @@ static void unicast_group_add_stream(struct bt_audio_unicast_group *group,
|
|||
struct bt_audio_unicast_group_stream_param *param,
|
||||
struct bt_audio_iso *iso, enum bt_audio_dir dir)
|
||||
{
|
||||
struct bt_audio_stream *stream = param->stream;
|
||||
struct bt_bap_stream *stream = param->stream;
|
||||
struct bt_codec_qos *qos = param->qos;
|
||||
|
||||
LOG_DBG("group %p stream %p qos %p iso %p dir %u", group, stream, qos, iso, dir);
|
||||
|
|
@ -1921,7 +1921,7 @@ static int unicast_group_add_stream_pair(struct bt_audio_unicast_group *group,
|
|||
}
|
||||
|
||||
static void unicast_group_del_stream(struct bt_audio_unicast_group *group,
|
||||
struct bt_audio_stream *stream)
|
||||
struct bt_bap_stream *stream)
|
||||
{
|
||||
__ASSERT_NO_MSG(group != NULL);
|
||||
__ASSERT_NO_MSG(stream != NULL);
|
||||
|
|
@ -1983,7 +1983,7 @@ static struct bt_audio_unicast_group *unicast_group_alloc(void)
|
|||
|
||||
static void unicast_group_free(struct bt_audio_unicast_group *group)
|
||||
{
|
||||
struct bt_audio_stream *stream, *next;
|
||||
struct bt_bap_stream *stream, *next;
|
||||
|
||||
__ASSERT_NO_MSG(group != NULL);
|
||||
|
||||
|
|
@ -2150,7 +2150,7 @@ int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_gr
|
|||
size_t num_param)
|
||||
{
|
||||
const struct bt_codec_qos *group_qos = unicast_group->qos;
|
||||
struct bt_audio_stream *tmp_stream;
|
||||
struct bt_bap_stream *tmp_stream;
|
||||
size_t total_stream_cnt;
|
||||
struct bt_iso_cig *cig;
|
||||
size_t num_added;
|
||||
|
|
@ -2235,7 +2235,7 @@ fail:
|
|||
|
||||
int bt_audio_unicast_group_delete(struct bt_audio_unicast_group *unicast_group)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
|
||||
CHECKIF(unicast_group == NULL)
|
||||
{
|
||||
|
|
@ -2268,7 +2268,7 @@ int bt_audio_unicast_group_delete(struct bt_audio_unicast_group *unicast_group)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_bap_unicast_client_config(struct bt_audio_stream *stream, const struct bt_codec *codec)
|
||||
int bt_bap_unicast_client_config(struct bt_bap_stream *stream, const struct bt_codec *codec)
|
||||
{
|
||||
struct bt_audio_ep *ep = stream->ep;
|
||||
struct bt_ascs_config_op *op;
|
||||
|
|
@ -2295,7 +2295,7 @@ int bt_bap_unicast_client_config(struct bt_audio_stream *stream, const struct bt
|
|||
|
||||
int bt_bap_unicast_client_qos(struct bt_conn *conn, struct bt_audio_unicast_group *group)
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
struct bt_ascs_config_op *op;
|
||||
struct net_buf_simple *buf;
|
||||
struct bt_audio_ep *ep;
|
||||
|
|
@ -2411,7 +2411,7 @@ int bt_bap_unicast_client_qos(struct bt_conn *conn, struct bt_audio_unicast_grou
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_bap_unicast_client_enable(struct bt_audio_stream *stream, struct bt_codec_data *meta,
|
||||
int bt_bap_unicast_client_enable(struct bt_bap_stream *stream, struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
struct bt_audio_ep *ep = stream->ep;
|
||||
|
|
@ -2434,7 +2434,7 @@ int bt_bap_unicast_client_enable(struct bt_audio_stream *stream, struct bt_codec
|
|||
return bt_bap_unicast_client_ep_send(stream->conn, ep, buf);
|
||||
}
|
||||
|
||||
int bt_bap_unicast_client_metadata(struct bt_audio_stream *stream, struct bt_codec_data *meta,
|
||||
int bt_bap_unicast_client_metadata(struct bt_bap_stream *stream, struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
struct bt_audio_ep *ep = stream->ep;
|
||||
|
|
@ -2457,7 +2457,7 @@ int bt_bap_unicast_client_metadata(struct bt_audio_stream *stream, struct bt_cod
|
|||
return bt_bap_unicast_client_ep_send(stream->conn, ep, buf);
|
||||
}
|
||||
|
||||
int bt_bap_unicast_client_start(struct bt_audio_stream *stream)
|
||||
int bt_bap_unicast_client_start(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_ep *ep = stream->ep;
|
||||
struct net_buf_simple *buf;
|
||||
|
|
@ -2481,7 +2481,7 @@ int bt_bap_unicast_client_start(struct bt_audio_stream *stream)
|
|||
LOG_DBG("unicast_client_stream_connect failed: %d", err);
|
||||
return err;
|
||||
} else if (err == -EALREADY) {
|
||||
LOG_DBG("ISO %p already connected", bt_audio_stream_iso_chan_get(stream));
|
||||
LOG_DBG("ISO %p already connected", bt_bap_stream_iso_chan_get(stream));
|
||||
}
|
||||
|
||||
/* When initiated by the client, valid only if Direction field
|
||||
|
|
@ -2500,7 +2500,7 @@ int bt_bap_unicast_client_start(struct bt_audio_stream *stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_bap_unicast_client_disable(struct bt_audio_stream *stream)
|
||||
int bt_bap_unicast_client_disable(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_ep *ep = stream->ep;
|
||||
struct net_buf_simple *buf;
|
||||
|
|
@ -2522,7 +2522,7 @@ int bt_bap_unicast_client_disable(struct bt_audio_stream *stream)
|
|||
return bt_bap_unicast_client_ep_send(stream->conn, ep, buf);
|
||||
}
|
||||
|
||||
int bt_bap_unicast_client_stop(struct bt_audio_stream *stream)
|
||||
int bt_bap_unicast_client_stop(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_ep *ep = stream->ep;
|
||||
struct net_buf_simple *buf;
|
||||
|
|
@ -2552,7 +2552,7 @@ int bt_bap_unicast_client_stop(struct bt_audio_stream *stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_bap_unicast_client_release(struct bt_audio_stream *stream)
|
||||
int bt_bap_unicast_client_release(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_ep *ep = stream->ep;
|
||||
struct net_buf_simple *buf;
|
||||
|
|
@ -2573,7 +2573,7 @@ int bt_bap_unicast_client_release(struct bt_audio_stream *stream)
|
|||
|
||||
/* Only attempt to release if not IDLE already */
|
||||
if (stream->ep->status.state == BT_AUDIO_EP_STATE_IDLE) {
|
||||
bt_audio_stream_reset(stream);
|
||||
bt_bap_stream_reset(stream);
|
||||
} else {
|
||||
err = unicast_client_ep_release(ep, buf);
|
||||
if (err) {
|
||||
|
|
|
|||
|
|
@ -6,23 +6,23 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
int bt_bap_unicast_client_config(struct bt_audio_stream *stream, const struct bt_codec *codec);
|
||||
int bt_bap_unicast_client_config(struct bt_bap_stream *stream, const struct bt_codec *codec);
|
||||
|
||||
int bt_bap_unicast_client_qos(struct bt_conn *conn, struct bt_audio_unicast_group *group);
|
||||
|
||||
int bt_bap_unicast_client_enable(struct bt_audio_stream *stream, struct bt_codec_data *meta,
|
||||
int bt_bap_unicast_client_enable(struct bt_bap_stream *stream, struct bt_codec_data *meta,
|
||||
size_t meta_count);
|
||||
|
||||
int bt_bap_unicast_client_metadata(struct bt_audio_stream *stream, struct bt_codec_data *meta,
|
||||
int bt_bap_unicast_client_metadata(struct bt_bap_stream *stream, struct bt_codec_data *meta,
|
||||
size_t meta_count);
|
||||
|
||||
int bt_bap_unicast_client_disable(struct bt_audio_stream *stream);
|
||||
int bt_bap_unicast_client_disable(struct bt_bap_stream *stream);
|
||||
|
||||
int bt_bap_unicast_client_start(struct bt_audio_stream *stream);
|
||||
int bt_bap_unicast_client_start(struct bt_bap_stream *stream);
|
||||
|
||||
int bt_bap_unicast_client_stop(struct bt_audio_stream *stream);
|
||||
int bt_bap_unicast_client_stop(struct bt_bap_stream *stream);
|
||||
|
||||
int bt_bap_unicast_client_release(struct bt_audio_stream *stream);
|
||||
int bt_bap_unicast_client_release(struct bt_bap_stream *stream);
|
||||
|
||||
struct net_buf_simple *bt_bap_unicast_client_ep_create_pdu(uint8_t op);
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ int bt_bap_unicast_server_unregister_cb(const struct bt_bap_unicast_server_cb *c
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_bap_unicast_server_reconfig(struct bt_audio_stream *stream, const struct bt_codec *codec)
|
||||
int bt_bap_unicast_server_reconfig(struct bt_bap_stream *stream, const struct bt_codec *codec)
|
||||
{
|
||||
struct bt_audio_ep *ep;
|
||||
int err;
|
||||
|
|
@ -81,7 +81,7 @@ int bt_bap_unicast_server_reconfig(struct bt_audio_stream *stream, const struct
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_bap_unicast_server_start(struct bt_audio_stream *stream)
|
||||
int bt_bap_unicast_server_start(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_ep *ep = stream->ep;
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ int bt_bap_unicast_server_start(struct bt_audio_stream *stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_bap_unicast_server_metadata(struct bt_audio_stream *stream, struct bt_codec_data meta[],
|
||||
int bt_bap_unicast_server_metadata(struct bt_bap_stream *stream, struct bt_codec_data meta[],
|
||||
size_t meta_count)
|
||||
{
|
||||
struct bt_audio_ep *ep;
|
||||
|
|
@ -133,7 +133,7 @@ int bt_bap_unicast_server_metadata(struct bt_audio_stream *stream, struct bt_cod
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_bap_unicast_server_disable(struct bt_audio_stream *stream)
|
||||
int bt_bap_unicast_server_disable(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_ep *ep;
|
||||
int err;
|
||||
|
|
@ -162,7 +162,7 @@ int bt_bap_unicast_server_disable(struct bt_audio_stream *stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_bap_unicast_server_release(struct bt_audio_stream *stream)
|
||||
int bt_bap_unicast_server_release(struct bt_bap_stream *stream)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ int bt_bap_unicast_server_release(struct bt_audio_stream *stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_audio_stream *stream,
|
||||
int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_bap_stream *stream,
|
||||
struct bt_codec *codec,
|
||||
const struct bt_codec_qos_pref *qos_pref)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
extern const struct bt_bap_unicast_server_cb *unicast_server_cb;
|
||||
|
||||
int bt_bap_unicast_server_reconfig(struct bt_audio_stream *stream, const struct bt_codec *codec);
|
||||
int bt_bap_unicast_server_start(struct bt_audio_stream *stream);
|
||||
int bt_bap_unicast_server_metadata(struct bt_audio_stream *stream, struct bt_codec_data meta[],
|
||||
int bt_bap_unicast_server_reconfig(struct bt_bap_stream *stream, const struct bt_codec *codec);
|
||||
int bt_bap_unicast_server_start(struct bt_bap_stream *stream);
|
||||
int bt_bap_unicast_server_metadata(struct bt_bap_stream *stream, struct bt_codec_data meta[],
|
||||
size_t meta_count);
|
||||
int bt_bap_unicast_server_disable(struct bt_audio_stream *stream);
|
||||
int bt_bap_unicast_server_release(struct bt_audio_stream *stream);
|
||||
int bt_bap_unicast_server_disable(struct bt_bap_stream *stream);
|
||||
int bt_bap_unicast_server_release(struct bt_bap_stream *stream);
|
||||
|
|
|
|||
|
|
@ -7,73 +7,73 @@
|
|||
#include <zephyr/bluetooth/audio/cap.h>
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST)
|
||||
static void cap_stream_configured_cb(struct bt_audio_stream *bap_stream,
|
||||
static void cap_stream_configured_cb(struct bt_bap_stream *bap_stream,
|
||||
const struct bt_codec_qos_pref *pref)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
struct bt_cap_stream,
|
||||
bap_stream);
|
||||
struct bt_audio_stream_ops *ops = cap_stream->ops;
|
||||
struct bt_bap_stream_ops *ops = cap_stream->ops;
|
||||
|
||||
if (ops != NULL && ops->configured != NULL) {
|
||||
ops->configured(bap_stream, pref);
|
||||
}
|
||||
}
|
||||
|
||||
static void cap_stream_qos_set_cb(struct bt_audio_stream *bap_stream)
|
||||
static void cap_stream_qos_set_cb(struct bt_bap_stream *bap_stream)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
struct bt_cap_stream,
|
||||
bap_stream);
|
||||
struct bt_audio_stream_ops *ops = cap_stream->ops;
|
||||
struct bt_bap_stream_ops *ops = cap_stream->ops;
|
||||
|
||||
if (ops != NULL && ops->qos_set != NULL) {
|
||||
ops->qos_set(bap_stream);
|
||||
}
|
||||
}
|
||||
|
||||
static void cap_stream_enabled_cb(struct bt_audio_stream *bap_stream)
|
||||
static void cap_stream_enabled_cb(struct bt_bap_stream *bap_stream)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
struct bt_cap_stream,
|
||||
bap_stream);
|
||||
struct bt_audio_stream_ops *ops = cap_stream->ops;
|
||||
struct bt_bap_stream_ops *ops = cap_stream->ops;
|
||||
|
||||
if (ops != NULL && ops->enabled != NULL) {
|
||||
ops->enabled(bap_stream);
|
||||
}
|
||||
}
|
||||
|
||||
static void cap_stream_metadata_updated_cb(struct bt_audio_stream *bap_stream)
|
||||
static void cap_stream_metadata_updated_cb(struct bt_bap_stream *bap_stream)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
struct bt_cap_stream,
|
||||
bap_stream);
|
||||
struct bt_audio_stream_ops *ops = cap_stream->ops;
|
||||
struct bt_bap_stream_ops *ops = cap_stream->ops;
|
||||
|
||||
if (ops != NULL && ops->metadata_updated != NULL) {
|
||||
ops->metadata_updated(bap_stream);
|
||||
}
|
||||
}
|
||||
|
||||
static void cap_stream_disabled_cb(struct bt_audio_stream *bap_stream)
|
||||
static void cap_stream_disabled_cb(struct bt_bap_stream *bap_stream)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
struct bt_cap_stream,
|
||||
bap_stream);
|
||||
struct bt_audio_stream_ops *ops = cap_stream->ops;
|
||||
struct bt_bap_stream_ops *ops = cap_stream->ops;
|
||||
|
||||
if (ops != NULL && ops->disabled != NULL) {
|
||||
ops->disabled(bap_stream);
|
||||
}
|
||||
}
|
||||
|
||||
static void cap_stream_released_cb(struct bt_audio_stream *bap_stream)
|
||||
static void cap_stream_released_cb(struct bt_bap_stream *bap_stream)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
struct bt_cap_stream,
|
||||
bap_stream);
|
||||
struct bt_audio_stream_ops *ops = cap_stream->ops;
|
||||
struct bt_bap_stream_ops *ops = cap_stream->ops;
|
||||
|
||||
if (ops != NULL && ops->released != NULL) {
|
||||
ops->released(bap_stream);
|
||||
|
|
@ -82,24 +82,24 @@ static void cap_stream_released_cb(struct bt_audio_stream *bap_stream)
|
|||
|
||||
#endif /* CONFIG_BT_BAP_UNICAST */
|
||||
|
||||
static void cap_stream_started_cb(struct bt_audio_stream *bap_stream)
|
||||
static void cap_stream_started_cb(struct bt_bap_stream *bap_stream)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
struct bt_cap_stream,
|
||||
bap_stream);
|
||||
struct bt_audio_stream_ops *ops = cap_stream->ops;
|
||||
struct bt_bap_stream_ops *ops = cap_stream->ops;
|
||||
|
||||
if (ops != NULL && ops->started != NULL) {
|
||||
ops->started(bap_stream);
|
||||
}
|
||||
}
|
||||
|
||||
static void cap_stream_stopped_cb(struct bt_audio_stream *bap_stream, uint8_t reason)
|
||||
static void cap_stream_stopped_cb(struct bt_bap_stream *bap_stream, uint8_t reason)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
struct bt_cap_stream,
|
||||
bap_stream);
|
||||
struct bt_audio_stream_ops *ops = cap_stream->ops;
|
||||
struct bt_bap_stream_ops *ops = cap_stream->ops;
|
||||
|
||||
if (ops != NULL && ops->stopped != NULL) {
|
||||
ops->stopped(bap_stream, reason);
|
||||
|
|
@ -107,14 +107,13 @@ static void cap_stream_stopped_cb(struct bt_audio_stream *bap_stream, uint8_t re
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SINK)
|
||||
static void cap_stream_recv_cb(struct bt_audio_stream *bap_stream,
|
||||
const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf)
|
||||
static void cap_stream_recv_cb(struct bt_bap_stream *bap_stream,
|
||||
const struct bt_iso_recv_info *info, struct net_buf *buf)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
struct bt_cap_stream,
|
||||
bap_stream);
|
||||
struct bt_audio_stream_ops *ops = cap_stream->ops;
|
||||
struct bt_bap_stream_ops *ops = cap_stream->ops;
|
||||
|
||||
if (ops != NULL && ops->recv != NULL) {
|
||||
ops->recv(bap_stream, info, buf);
|
||||
|
|
@ -123,12 +122,12 @@ static void cap_stream_recv_cb(struct bt_audio_stream *bap_stream,
|
|||
#endif /* CONFIG_BT_BAP_UNICAST || CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
|
||||
static void cap_stream_sent_cb(struct bt_audio_stream *bap_stream)
|
||||
static void cap_stream_sent_cb(struct bt_bap_stream *bap_stream)
|
||||
{
|
||||
struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream,
|
||||
struct bt_cap_stream,
|
||||
bap_stream);
|
||||
struct bt_audio_stream_ops *ops = cap_stream->ops;
|
||||
struct bt_bap_stream_ops *ops = cap_stream->ops;
|
||||
|
||||
if (ops != NULL && ops->sent != NULL) {
|
||||
ops->sent(bap_stream);
|
||||
|
|
@ -136,7 +135,7 @@ static void cap_stream_sent_cb(struct bt_audio_stream *bap_stream)
|
|||
}
|
||||
#endif /* CONFIG_BT_BAP_UNICAST || CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
||||
static struct bt_audio_stream_ops bap_stream_ops = {
|
||||
static struct bt_bap_stream_ops bap_stream_ops = {
|
||||
#if defined(CONFIG_BT_BAP_UNICAST)
|
||||
.configured = cap_stream_configured_cb,
|
||||
.qos_set = cap_stream_qos_set_cb,
|
||||
|
|
@ -155,9 +154,8 @@ static struct bt_audio_stream_ops bap_stream_ops = {
|
|||
#endif /* CONFIG_BT_BAP_UNICAST || CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
};
|
||||
|
||||
void bt_cap_stream_ops_register(struct bt_cap_stream *stream,
|
||||
struct bt_audio_stream_ops *ops)
|
||||
void bt_cap_stream_ops_register(struct bt_cap_stream *stream, struct bt_bap_stream_ops *ops)
|
||||
{
|
||||
stream->ops = ops;
|
||||
bt_audio_stream_cb_register(&stream->bap_stream, &bap_stream_ops);
|
||||
bt_bap_stream_cb_register(&stream->bap_stream, &bap_stream_ops);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,24 +8,22 @@
|
|||
*/
|
||||
|
||||
/* Disconnect ISO channel */
|
||||
int bt_audio_stream_disconnect(struct bt_audio_stream *stream);
|
||||
int bt_bap_stream_disconnect(struct bt_bap_stream *stream);
|
||||
|
||||
void bt_audio_stream_reset(struct bt_audio_stream *stream);
|
||||
void bt_bap_stream_reset(struct bt_bap_stream *stream);
|
||||
|
||||
void bt_audio_stream_attach(struct bt_conn *conn, struct bt_audio_stream *stream,
|
||||
struct bt_audio_ep *ep,
|
||||
struct bt_codec *codec);
|
||||
void bt_bap_stream_attach(struct bt_conn *conn, struct bt_bap_stream *stream,
|
||||
struct bt_audio_ep *ep, struct bt_codec *codec);
|
||||
|
||||
void bt_audio_codec_to_iso_path(struct bt_iso_chan_path *path,
|
||||
const struct bt_codec *codec);
|
||||
void bt_audio_codec_qos_to_iso_qos(struct bt_iso_chan_io_qos *io,
|
||||
const struct bt_codec_qos *codec_qos);
|
||||
|
||||
void bt_audio_stream_detach(struct bt_audio_stream *stream);
|
||||
void bt_bap_stream_detach(struct bt_bap_stream *stream);
|
||||
|
||||
bool bt_audio_valid_qos(const struct bt_codec_qos *qos);
|
||||
|
||||
bool bt_audio_valid_stream_qos(const struct bt_audio_stream *stream,
|
||||
const struct bt_codec_qos *qos);
|
||||
bool bt_audio_valid_stream_qos(const struct bt_bap_stream *stream, const struct bt_codec_qos *qos);
|
||||
|
||||
struct bt_iso_chan *bt_audio_stream_iso_chan_get(struct bt_audio_stream *stream);
|
||||
struct bt_iso_chan *bt_bap_stream_iso_chan_get(struct bt_bap_stream *stream);
|
||||
|
|
|
|||
|
|
@ -85,10 +85,10 @@ zephyr_library_sources_ifdef(
|
|||
CONFIG_BT_HAS_CLIENT
|
||||
has_client.c
|
||||
)
|
||||
# We use BT_AUDIO_STREAM as a common ground for audio, as that is set whenever
|
||||
# We use BT_BAP_STREAM as a common ground for audio, as that is set whenever
|
||||
# any audio stream functionality is enabled.
|
||||
zephyr_library_sources_ifdef(
|
||||
CONFIG_BT_AUDIO_STREAM
|
||||
CONFIG_BT_BAP_STREAM
|
||||
bap.c
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT), \
|
||||
(0))
|
||||
|
||||
static struct bt_audio_stream streams[UNICAST_SERVER_STREAM_COUNT + UNICAST_CLIENT_STREAM_COUNT];
|
||||
static struct bt_bap_stream streams[UNICAST_SERVER_STREAM_COUNT + UNICAST_CLIENT_STREAM_COUNT];
|
||||
|
||||
static const struct bt_codec_qos_pref qos_pref = BT_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0u, 60u,
|
||||
20000u, 40000u, 20000u, 40000u);
|
||||
|
|
@ -56,15 +56,15 @@ static struct bt_audio_ep *srcs[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT];
|
|||
#endif /* CONFIG_BT_BAP_UNICAST */
|
||||
|
||||
#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_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_stream broadcast_sink_streams[BROADCAST_SNK_STREAM_CNT];
|
||||
static struct bt_bap_broadcast_sink *default_sink;
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
static struct bt_audio_stream *txing_stream;
|
||||
static struct bt_audio_stream *default_stream;
|
||||
static struct bt_bap_stream *txing_stream;
|
||||
static struct bt_bap_stream *default_stream;
|
||||
static uint16_t seq_num;
|
||||
static size_t rx_cnt;
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ static void fill_audio_buf_sin(int16_t *buf, int length_us, int frequency_hz, in
|
|||
}
|
||||
}
|
||||
|
||||
static void init_lc3(const struct bt_audio_stream *stream)
|
||||
static void init_lc3(const struct bt_bap_stream *stream)
|
||||
{
|
||||
size_t num_samples;
|
||||
|
||||
|
|
@ -350,7 +350,7 @@ static void lc3_audio_timer_timeout(struct k_work *work)
|
|||
}
|
||||
}
|
||||
|
||||
err = bt_audio_stream_send(txing_stream, buf, seq_num,
|
||||
err = bt_bap_stream_send(txing_stream, buf, seq_num,
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
if (err < 0) {
|
||||
shell_error(ctx_shell,
|
||||
|
|
@ -554,7 +554,7 @@ static struct named_lc3_preset *set_preset(enum bt_audio_dir dir,
|
|||
return set_preset;
|
||||
}
|
||||
|
||||
static void set_stream(struct bt_audio_stream *stream)
|
||||
static void set_stream(struct bt_bap_stream *stream)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -577,7 +577,7 @@ static void print_qos(const struct bt_codec_qos *qos)
|
|||
|
||||
static int cmd_select_unicast(const struct shell *sh, size_t argc, char *argv[])
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
unsigned long index;
|
||||
int err = 0;
|
||||
|
||||
|
|
@ -601,10 +601,10 @@ static int cmd_select_unicast(const struct shell *sh, size_t argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct bt_audio_stream *stream_alloc(void)
|
||||
static struct bt_bap_stream *stream_alloc(void)
|
||||
{
|
||||
for (size_t i = 0; i < ARRAY_SIZE(streams); i++) {
|
||||
struct bt_audio_stream *stream = &streams[i];
|
||||
struct bt_bap_stream *stream = &streams[i];
|
||||
|
||||
if (!stream->conn) {
|
||||
return stream;
|
||||
|
|
@ -615,7 +615,7 @@ static struct bt_audio_stream *stream_alloc(void)
|
|||
}
|
||||
|
||||
static int lc3_config(struct bt_conn *conn, const struct bt_audio_ep *ep, enum bt_audio_dir dir,
|
||||
const struct bt_codec *codec, struct bt_audio_stream **stream,
|
||||
const struct bt_codec *codec, struct bt_bap_stream **stream,
|
||||
struct bt_codec_qos_pref *const pref)
|
||||
{
|
||||
shell_print(ctx_shell, "ASE Codec Config: conn %p ep %p dir %u", conn, ep, dir);
|
||||
|
|
@ -638,7 +638,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_audio_ep *ep, enum b
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_reconfig(struct bt_audio_stream *stream, enum bt_audio_dir dir,
|
||||
static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir,
|
||||
const struct bt_codec *codec, struct bt_codec_qos_pref *const pref)
|
||||
{
|
||||
shell_print(ctx_shell, "ASE Codec Reconfig: stream %p", stream);
|
||||
|
|
@ -654,7 +654,7 @@ static int lc3_reconfig(struct bt_audio_stream *stream, enum bt_audio_dir dir,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_qos(struct bt_audio_stream *stream, const struct bt_codec_qos *qos)
|
||||
static int lc3_qos(struct bt_bap_stream *stream, const struct bt_codec_qos *qos)
|
||||
{
|
||||
shell_print(ctx_shell, "QoS: stream %p %p", stream, qos);
|
||||
|
||||
|
|
@ -663,7 +663,7 @@ static int lc3_qos(struct bt_audio_stream *stream, const struct bt_codec_qos *qo
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_enable(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
|
||||
static int lc3_enable(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
shell_print(ctx_shell, "Enable: stream %p meta_count %zu", stream,
|
||||
|
|
@ -672,7 +672,7 @@ static int lc3_enable(struct bt_audio_stream *stream, const struct bt_codec_data
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_start(struct bt_audio_stream *stream)
|
||||
static int lc3_start(struct bt_bap_stream *stream)
|
||||
{
|
||||
shell_print(ctx_shell, "Start: stream %p", stream);
|
||||
|
||||
|
|
@ -725,7 +725,7 @@ static bool valid_metadata_type(uint8_t type, uint8_t len)
|
|||
}
|
||||
}
|
||||
|
||||
static int lc3_metadata(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
|
||||
static int lc3_metadata(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
shell_print(ctx_shell, "Metadata: stream %p meta_count %zu", stream,
|
||||
|
|
@ -744,21 +744,21 @@ static int lc3_metadata(struct bt_audio_stream *stream, const struct bt_codec_da
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_disable(struct bt_audio_stream *stream)
|
||||
static int lc3_disable(struct bt_bap_stream *stream)
|
||||
{
|
||||
shell_print(ctx_shell, "Disable: stream %p", stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_stop(struct bt_audio_stream *stream)
|
||||
static int lc3_stop(struct bt_bap_stream *stream)
|
||||
{
|
||||
shell_print(ctx_shell, "Stop: stream %p", stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_release(struct bt_audio_stream *stream)
|
||||
static int lc3_release(struct bt_bap_stream *stream)
|
||||
{
|
||||
shell_print(ctx_shell, "Release: stream %p", stream);
|
||||
|
||||
|
|
@ -866,7 +866,7 @@ static int handle_metadata_update(struct bt_codec *codec,
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST_CLIENT)
|
||||
static uint8_t stream_dir(const struct bt_audio_stream *stream)
|
||||
static uint8_t stream_dir(const struct bt_bap_stream *stream)
|
||||
{
|
||||
#if CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0
|
||||
for (size_t i = 0; i < ARRAY_SIZE(snks); i++) {
|
||||
|
|
@ -1114,13 +1114,13 @@ static int cmd_config(const struct shell *sh, size_t argc, char *argv[])
|
|||
}
|
||||
|
||||
if (default_stream && default_stream->ep == ep) {
|
||||
if (bt_audio_stream_reconfig(default_stream,
|
||||
if (bt_bap_stream_reconfig(default_stream,
|
||||
&named_preset->preset.codec) < 0) {
|
||||
shell_error(sh, "Unable reconfig stream");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
} else {
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
int err;
|
||||
|
||||
if (default_stream == NULL) {
|
||||
|
|
@ -1129,7 +1129,7 @@ static int cmd_config(const struct shell *sh, size_t argc, char *argv[])
|
|||
stream = default_stream;
|
||||
}
|
||||
|
||||
err = bt_audio_stream_config(default_conn, stream, ep,
|
||||
err = bt_bap_stream_config(default_conn, stream, ep,
|
||||
&named_preset->preset.codec);
|
||||
if (err != 0) {
|
||||
shell_error(sh, "Unable to config stream: %d", err);
|
||||
|
|
@ -1159,7 +1159,7 @@ static int create_unicast_group(const struct shell *sh)
|
|||
memset(&group_param, 0, sizeof(group_param));
|
||||
|
||||
for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) {
|
||||
struct bt_audio_stream *stream = &streams[i];
|
||||
struct bt_bap_stream *stream = &streams[i];
|
||||
|
||||
if (stream->ep != NULL) {
|
||||
struct bt_audio_unicast_group_stream_param *stream_param;
|
||||
|
|
@ -1223,7 +1223,7 @@ static int cmd_qos(const struct shell *sh, size_t argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
err = bt_audio_stream_qos(default_conn, default_unicast_group);
|
||||
err = bt_bap_stream_qos(default_conn, default_unicast_group);
|
||||
if (err) {
|
||||
shell_error(sh, "Unable to setup QoS: %d", err);
|
||||
return -ENOEXEC;
|
||||
|
|
@ -1257,7 +1257,7 @@ static int cmd_enable(const struct shell *sh, size_t argc, char *argv[])
|
|||
return err;
|
||||
}
|
||||
|
||||
err = bt_audio_stream_enable(default_stream, meta, meta_count);
|
||||
err = bt_bap_stream_enable(default_stream, meta, meta_count);
|
||||
if (err) {
|
||||
shell_error(sh, "Unable to enable Channel");
|
||||
return -ENOEXEC;
|
||||
|
|
@ -1275,7 +1275,7 @@ static int cmd_stop(const struct shell *sh, size_t argc, char *argv[])
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
err = bt_audio_stream_stop(default_stream);
|
||||
err = bt_bap_stream_stop(default_stream);
|
||||
if (err) {
|
||||
shell_error(sh, "Unable to stop Channel");
|
||||
return -ENOEXEC;
|
||||
|
|
@ -1348,7 +1348,7 @@ static int cmd_metadata(const struct shell *sh, size_t argc, char *argv[])
|
|||
return err;
|
||||
}
|
||||
|
||||
err = bt_audio_stream_metadata(default_stream, meta, meta_count);
|
||||
err = bt_bap_stream_metadata(default_stream, meta, meta_count);
|
||||
if (err) {
|
||||
shell_error(sh, "Unable to set Channel metadata");
|
||||
return -ENOEXEC;
|
||||
|
|
@ -1366,7 +1366,7 @@ static int cmd_start(const struct shell *sh, size_t argc, char *argv[])
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
err = bt_audio_stream_start(default_stream);
|
||||
err = bt_bap_stream_start(default_stream);
|
||||
if (err) {
|
||||
shell_error(sh, "Unable to start Channel");
|
||||
return -ENOEXEC;
|
||||
|
|
@ -1384,7 +1384,7 @@ static int cmd_disable(const struct shell *sh, size_t argc, char *argv[])
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
err = bt_audio_stream_disable(default_stream);
|
||||
err = bt_bap_stream_disable(default_stream);
|
||||
if (err) {
|
||||
shell_error(sh, "Unable to disable Channel");
|
||||
return -ENOEXEC;
|
||||
|
|
@ -1400,7 +1400,7 @@ static int cmd_list(const struct shell *sh, size_t argc, char *argv[])
|
|||
shell_print(sh, "Configured Channels:");
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(streams); i++) {
|
||||
struct bt_audio_stream *stream = &streams[i];
|
||||
struct bt_bap_stream *stream = &streams[i];
|
||||
|
||||
if (stream->conn) {
|
||||
shell_print(sh, " %s#%u: stream %p ep %p group %p",
|
||||
|
|
@ -1447,7 +1447,7 @@ static int cmd_release(const struct shell *sh, size_t argc, char *argv[])
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
err = bt_audio_stream_release(default_stream);
|
||||
err = bt_bap_stream_release(default_stream);
|
||||
if (err) {
|
||||
shell_error(sh, "Unable to release Channel");
|
||||
return -ENOEXEC;
|
||||
|
|
@ -1602,7 +1602,7 @@ static struct bt_bap_broadcast_sink_cb sink_cbs = {
|
|||
#endif /* CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SINK)
|
||||
static void audio_recv(struct bt_audio_stream *stream,
|
||||
static void audio_recv(struct bt_bap_stream *stream,
|
||||
const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf)
|
||||
{
|
||||
|
|
@ -1632,12 +1632,12 @@ static void audio_recv(struct bt_audio_stream *stream,
|
|||
}
|
||||
#endif /* CONFIG_BT_BAP_UNICAST || CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
|
||||
static void stream_started_cb(struct bt_audio_stream *stream)
|
||||
static void stream_started_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Stream %p started\n", stream);
|
||||
}
|
||||
|
||||
static void stream_stopped_cb(struct bt_audio_stream *stream, uint8_t reason)
|
||||
static void stream_stopped_cb(struct bt_bap_stream *stream, uint8_t reason)
|
||||
{
|
||||
printk("Stream %p stopped with reason 0x%02X\n", stream, reason);
|
||||
|
||||
|
|
@ -1652,7 +1652,7 @@ static void stream_stopped_cb(struct bt_audio_stream *stream, uint8_t reason)
|
|||
}
|
||||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST)
|
||||
static void stream_released_cb(struct bt_audio_stream *stream)
|
||||
static void stream_released_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
shell_print(ctx_shell, "Stream %p released\n", stream);
|
||||
|
||||
|
|
@ -1686,7 +1686,7 @@ static void stream_released_cb(struct bt_audio_stream *stream)
|
|||
}
|
||||
#endif /* CONFIG_BT_BAP_UNICAST */
|
||||
|
||||
static struct bt_audio_stream_ops stream_ops = {
|
||||
static struct bt_bap_stream_ops stream_ops = {
|
||||
#if defined(CONFIG_BT_BAP_UNICAST) || defined(CONFIG_BT_BAP_BROADCAST_SINK)
|
||||
.recv = audio_recv,
|
||||
#endif /* CONFIG_BT_BAP_UNICAST || CONFIG_BT_BAP_BROADCAST_SINK */
|
||||
|
|
@ -1701,7 +1701,7 @@ static struct bt_audio_stream_ops stream_ops = {
|
|||
static int cmd_select_broadcast_source(const struct shell *sh, size_t argc,
|
||||
char *argv[])
|
||||
{
|
||||
struct bt_audio_stream *stream;
|
||||
struct bt_bap_stream *stream;
|
||||
unsigned long index;
|
||||
int err = 0;
|
||||
|
||||
|
|
@ -1942,7 +1942,7 @@ static int cmd_accept_broadcast(const struct shell *sh, size_t argc,
|
|||
|
||||
static int cmd_sync_broadcast(const struct shell *sh, size_t argc, char *argv[])
|
||||
{
|
||||
struct bt_audio_stream *streams[ARRAY_SIZE(broadcast_sink_streams)];
|
||||
struct bt_bap_stream *streams[ARRAY_SIZE(broadcast_sink_streams)];
|
||||
uint32_t bis_bitfield;
|
||||
int err;
|
||||
|
||||
|
|
@ -2181,7 +2181,7 @@ static int cmd_init(const struct shell *sh, size_t argc, char *argv[])
|
|||
|
||||
#if defined(CONFIG_BT_BAP_UNICAST)
|
||||
for (i = 0; i < ARRAY_SIZE(streams); i++) {
|
||||
bt_audio_stream_cb_register(&streams[i], &stream_ops);
|
||||
bt_bap_stream_cb_register(&streams[i], &stream_ops);
|
||||
}
|
||||
#endif /* CONFIG_BT_BAP_UNICAST */
|
||||
|
||||
|
|
@ -2189,14 +2189,14 @@ static int cmd_init(const struct shell *sh, size_t argc, char *argv[])
|
|||
bt_bap_broadcast_sink_register_cb(&sink_cbs);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(broadcast_sink_streams); i++) {
|
||||
bt_audio_stream_cb_register(&broadcast_sink_streams[i],
|
||||
bt_bap_stream_cb_register(&broadcast_sink_streams[i],
|
||||
&stream_ops);
|
||||
}
|
||||
#endif /* CONFIG_BT_BAP_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],
|
||||
bt_bap_stream_cb_register(&broadcast_source_streams[i],
|
||||
&stream_ops);
|
||||
}
|
||||
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
|
||||
|
|
@ -2259,7 +2259,7 @@ static int cmd_send(const struct shell *sh, size_t argc, char *argv[])
|
|||
|
||||
seq_num = get_next_seq_num(txing_stream->qos->interval);
|
||||
|
||||
ret = bt_audio_stream_send(txing_stream, buf, seq_num,
|
||||
ret = bt_bap_stream_send(txing_stream, buf, seq_num,
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
if (ret < 0) {
|
||||
shell_print(sh, "Unable to send: %d", -ret);
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ CONFIG_BT_BAP_BROADCAST_SINK_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
|
||||
CONFIG_BT_BAP_STREAM_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_AUDIO_ISO_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_AUDIO_CODEC_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_BAP_SCAN_DELEGATOR_LOG_LEVEL_DBG=y
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
extern enum bst_result_t bst_result;
|
||||
|
||||
static struct bt_audio_stream g_streams[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT];
|
||||
static struct bt_bap_stream g_streams[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT];
|
||||
static struct bt_audio_ep *g_sinks[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT];
|
||||
|
||||
/* Mandatory support preset by both client and server */
|
||||
|
|
@ -32,7 +32,7 @@ CREATE_FLAG(flag_stream_enabled);
|
|||
CREATE_FLAG(flag_stream_started);
|
||||
CREATE_FLAG(flag_stream_released);
|
||||
|
||||
static void stream_configured(struct bt_audio_stream *stream,
|
||||
static void stream_configured(struct bt_bap_stream *stream,
|
||||
const struct bt_codec_qos_pref *pref)
|
||||
{
|
||||
printk("Configured stream %p\n", stream);
|
||||
|
|
@ -44,50 +44,50 @@ static void stream_configured(struct bt_audio_stream *stream,
|
|||
SET_FLAG(flag_stream_codec_configured);
|
||||
}
|
||||
|
||||
static void stream_qos_set(struct bt_audio_stream *stream)
|
||||
static void stream_qos_set(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("QoS set stream %p\n", stream);
|
||||
|
||||
atomic_inc(&flag_stream_qos_configured);
|
||||
}
|
||||
|
||||
static void stream_enabled(struct bt_audio_stream *stream)
|
||||
static void stream_enabled(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Enabled stream %p\n", stream);
|
||||
|
||||
SET_FLAG(flag_stream_enabled);
|
||||
}
|
||||
|
||||
static void stream_started(struct bt_audio_stream *stream)
|
||||
static void stream_started(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Started stream %p\n", stream);
|
||||
|
||||
SET_FLAG(flag_stream_started);
|
||||
}
|
||||
|
||||
static void stream_metadata_updated(struct bt_audio_stream *stream)
|
||||
static void stream_metadata_updated(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Metadata updated stream %p\n", stream);
|
||||
}
|
||||
|
||||
static void stream_disabled(struct bt_audio_stream *stream)
|
||||
static void stream_disabled(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Disabled stream %p\n", stream);
|
||||
}
|
||||
|
||||
static void stream_stopped(struct bt_audio_stream *stream, uint8_t reason)
|
||||
static void stream_stopped(struct bt_bap_stream *stream, uint8_t reason)
|
||||
{
|
||||
printk("Stopped stream %p with reason 0x%02X\n", stream, reason);
|
||||
}
|
||||
|
||||
static void stream_released(struct bt_audio_stream *stream)
|
||||
static void stream_released(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Released stream %p\n", stream);
|
||||
|
||||
SET_FLAG(flag_stream_released);
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops stream_ops = {
|
||||
static struct bt_bap_stream_ops stream_ops = {
|
||||
.configured = stream_configured,
|
||||
.qos_set = stream_qos_set,
|
||||
.enabled = stream_enabled,
|
||||
|
|
@ -264,14 +264,14 @@ static void discover_sink(void)
|
|||
WAIT_FOR_FLAG(flag_sink_discovered);
|
||||
}
|
||||
|
||||
static int codec_configure_stream(struct bt_audio_stream *stream,
|
||||
static int codec_configure_stream(struct bt_bap_stream *stream,
|
||||
struct bt_audio_ep *ep)
|
||||
{
|
||||
int err;
|
||||
|
||||
UNSET_FLAG(flag_stream_codec_configured);
|
||||
|
||||
err = bt_audio_stream_config(default_conn, stream, ep,
|
||||
err = bt_bap_stream_config(default_conn, stream, ep,
|
||||
&preset_16_2_1.codec);
|
||||
if (err != 0) {
|
||||
FAIL("Could not configure stream: %d\n", err);
|
||||
|
|
@ -286,7 +286,7 @@ static int codec_configure_stream(struct bt_audio_stream *stream,
|
|||
static void codec_configure_streams(size_t stream_cnt)
|
||||
{
|
||||
for (size_t i = 0U; i < stream_cnt; i++) {
|
||||
struct bt_audio_stream *stream = &g_streams[i];
|
||||
struct bt_bap_stream *stream = &g_streams[i];
|
||||
int err;
|
||||
|
||||
if (g_sinks[i] == NULL) {
|
||||
|
|
@ -308,7 +308,7 @@ static void qos_configure_streams(struct bt_audio_unicast_group *unicast_group,
|
|||
|
||||
UNSET_FLAG(flag_stream_qos_configured);
|
||||
|
||||
err = bt_audio_stream_qos(default_conn, unicast_group);
|
||||
err = bt_bap_stream_qos(default_conn, unicast_group);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to QoS configure streams: %d", err);
|
||||
|
||||
|
|
@ -320,13 +320,13 @@ static void qos_configure_streams(struct bt_audio_unicast_group *unicast_group,
|
|||
}
|
||||
}
|
||||
|
||||
static int enable_stream(struct bt_audio_stream *stream)
|
||||
static int enable_stream(struct bt_bap_stream *stream)
|
||||
{
|
||||
int err;
|
||||
|
||||
UNSET_FLAG(flag_stream_enabled);
|
||||
|
||||
err = bt_audio_stream_enable(stream, NULL, 0);
|
||||
err = bt_bap_stream_enable(stream, NULL, 0);
|
||||
if (err != 0) {
|
||||
FAIL("Could not enable stream: %d\n", err);
|
||||
|
||||
|
|
@ -341,7 +341,7 @@ static int enable_stream(struct bt_audio_stream *stream)
|
|||
static void enable_streams(size_t stream_cnt)
|
||||
{
|
||||
for (size_t i = 0U; i < stream_cnt; i++) {
|
||||
struct bt_audio_stream *stream = &g_streams[i];
|
||||
struct bt_bap_stream *stream = &g_streams[i];
|
||||
int err;
|
||||
|
||||
err = enable_stream(stream);
|
||||
|
|
@ -354,13 +354,13 @@ static void enable_streams(size_t stream_cnt)
|
|||
}
|
||||
}
|
||||
|
||||
static int start_stream(struct bt_audio_stream *stream)
|
||||
static int start_stream(struct bt_bap_stream *stream)
|
||||
{
|
||||
int err;
|
||||
|
||||
UNSET_FLAG(flag_stream_started);
|
||||
|
||||
err = bt_audio_stream_start(stream);
|
||||
err = bt_bap_stream_start(stream);
|
||||
if (err != 0) {
|
||||
FAIL("Could not start stream: %d\n", err);
|
||||
|
||||
|
|
@ -375,7 +375,7 @@ static int start_stream(struct bt_audio_stream *stream)
|
|||
static void start_streams(size_t stream_cnt)
|
||||
{
|
||||
for (size_t i = 0U; i < 1; i++) {
|
||||
struct bt_audio_stream *stream = &g_streams[i];
|
||||
struct bt_bap_stream *stream = &g_streams[i];
|
||||
int err;
|
||||
|
||||
err = start_stream(stream);
|
||||
|
|
@ -398,7 +398,7 @@ static size_t release_streams(size_t stream_cnt)
|
|||
|
||||
UNSET_FLAG(flag_stream_released);
|
||||
|
||||
err = bt_audio_stream_release(&g_streams[i]);
|
||||
err = bt_bap_stream_release(&g_streams[i]);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to release stream[%zu]: %d", i, err);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ static struct bt_codec lc3_codec =
|
|||
BT_CODEC_LC3(BT_CODEC_LC3_FREQ_16KHZ, BT_CODEC_LC3_DURATION_10, CHANNEL_COUNT_1, 40u, 40u,
|
||||
1u, (BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL | BT_AUDIO_CONTEXT_TYPE_MEDIA));
|
||||
|
||||
static struct bt_audio_stream streams[CONFIG_BT_ASCS_ASE_SNK_COUNT + CONFIG_BT_ASCS_ASE_SRC_COUNT];
|
||||
static struct bt_bap_stream streams[CONFIG_BT_ASCS_ASE_SNK_COUNT + CONFIG_BT_ASCS_ASE_SRC_COUNT];
|
||||
|
||||
static const struct bt_codec_qos_pref qos_pref =
|
||||
BT_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000);
|
||||
|
|
@ -43,10 +43,10 @@ static void print_ase_info(struct bt_audio_ep *ep, void *user_data)
|
|||
printk("ASE info: id %u state %u dir %u\n", info.id, info.state, info.dir);
|
||||
}
|
||||
|
||||
static struct bt_audio_stream *stream_alloc(void)
|
||||
static struct bt_bap_stream *stream_alloc(void)
|
||||
{
|
||||
for (size_t i = 0; i < ARRAY_SIZE(streams); i++) {
|
||||
struct bt_audio_stream *stream = &streams[i];
|
||||
struct bt_bap_stream *stream = &streams[i];
|
||||
|
||||
if (!stream->conn) {
|
||||
return stream;
|
||||
|
|
@ -57,7 +57,7 @@ static struct bt_audio_stream *stream_alloc(void)
|
|||
}
|
||||
|
||||
static int lc3_config(struct bt_conn *conn, const struct bt_audio_ep *ep, enum bt_audio_dir dir,
|
||||
const struct bt_codec *codec, struct bt_audio_stream **stream,
|
||||
const struct bt_codec *codec, struct bt_bap_stream **stream,
|
||||
struct bt_codec_qos_pref *const pref)
|
||||
{
|
||||
printk("ASE Codec Config: conn %p ep %p dir %u\n", conn, ep, dir);
|
||||
|
|
@ -82,7 +82,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_audio_ep *ep, enum b
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_reconfig(struct bt_audio_stream *stream, enum bt_audio_dir dir,
|
||||
static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir,
|
||||
const struct bt_codec *codec, struct bt_codec_qos_pref *const pref)
|
||||
{
|
||||
printk("ASE Codec Reconfig: stream %p\n", stream);
|
||||
|
|
@ -93,7 +93,7 @@ static int lc3_reconfig(struct bt_audio_stream *stream, enum bt_audio_dir dir,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
static int lc3_qos(struct bt_audio_stream *stream, const struct bt_codec_qos *qos)
|
||||
static int lc3_qos(struct bt_bap_stream *stream, const struct bt_codec_qos *qos)
|
||||
{
|
||||
printk("QoS: stream %p qos %p\n", stream, qos);
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ static int lc3_qos(struct bt_audio_stream *stream, const struct bt_codec_qos *qo
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_enable(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
|
||||
static int lc3_enable(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
printk("Enable: stream %p meta_count %zu\n", stream, meta_count);
|
||||
|
|
@ -110,7 +110,7 @@ static int lc3_enable(struct bt_audio_stream *stream, const struct bt_codec_data
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_start(struct bt_audio_stream *stream)
|
||||
static int lc3_start(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Start: stream %p\n", stream);
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ static bool valid_metadata_type(uint8_t type, uint8_t len)
|
|||
}
|
||||
}
|
||||
|
||||
static int lc3_metadata(struct bt_audio_stream *stream, const struct bt_codec_data *meta,
|
||||
static int lc3_metadata(struct bt_bap_stream *stream, const struct bt_codec_data *meta,
|
||||
size_t meta_count)
|
||||
{
|
||||
printk("Metadata: stream %p meta_count %zu\n", stream, meta_count);
|
||||
|
|
@ -177,21 +177,21 @@ static int lc3_metadata(struct bt_audio_stream *stream, const struct bt_codec_da
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_disable(struct bt_audio_stream *stream)
|
||||
static int lc3_disable(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Disable: stream %p\n", stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_stop(struct bt_audio_stream *stream)
|
||||
static int lc3_stop(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Stop: stream %p\n", stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lc3_release(struct bt_audio_stream *stream)
|
||||
static int lc3_release(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Release: stream %p\n", stream);
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ static const struct bt_bap_unicast_server_cb unicast_server_cb = {
|
|||
.release = lc3_release,
|
||||
};
|
||||
|
||||
static void stream_enabled_cb(struct bt_audio_stream *stream)
|
||||
static void stream_enabled_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
struct bt_audio_ep_info ep_info;
|
||||
int err;
|
||||
|
|
@ -225,7 +225,7 @@ static void stream_enabled_cb(struct bt_audio_stream *stream)
|
|||
|
||||
if (ep_info.dir == BT_AUDIO_DIR_SINK) {
|
||||
/* Automatically do the receiver start ready operation */
|
||||
err = bt_audio_stream_start(stream);
|
||||
err = bt_bap_stream_start(stream);
|
||||
|
||||
if (err != 0) {
|
||||
FAIL("Failed to start stream: %d\n", err);
|
||||
|
|
@ -234,13 +234,13 @@ static void stream_enabled_cb(struct bt_audio_stream *stream)
|
|||
}
|
||||
}
|
||||
|
||||
static void stream_recv(struct bt_audio_stream *stream, const struct bt_iso_recv_info *info,
|
||||
static void stream_recv(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf)
|
||||
{
|
||||
printk("Incoming audio on stream %p len %u\n", stream, buf->len);
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops stream_ops = {
|
||||
static struct bt_bap_stream_ops stream_ops = {
|
||||
.enabled = stream_enabled_cb,
|
||||
.recv = stream_recv
|
||||
};
|
||||
|
|
@ -289,7 +289,7 @@ static void init(void)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(streams); i++) {
|
||||
bt_audio_stream_cb_register(&streams[i], &stream_ops);
|
||||
bt_bap_stream_cb_register(&streams[i], &stream_ops);
|
||||
}
|
||||
|
||||
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, unicast_server_ad, ARRAY_SIZE(unicast_server_ad),
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ CREATE_FLAG(pa_sync_lost);
|
|||
CREATE_FLAG(flag_received);
|
||||
|
||||
static struct bt_bap_broadcast_sink *g_sink;
|
||||
static struct bt_audio_stream broadcast_sink_streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT];
|
||||
static struct bt_audio_stream *streams[ARRAY_SIZE(broadcast_sink_streams)];
|
||||
static struct bt_bap_stream broadcast_sink_streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT];
|
||||
static struct bt_bap_stream *streams[ARRAY_SIZE(broadcast_sink_streams)];
|
||||
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);
|
||||
|
|
@ -149,26 +149,26 @@ static struct bt_pacs_cap cap = {
|
|||
.codec = &preset_16_2_1.codec,
|
||||
};
|
||||
|
||||
static void started_cb(struct bt_audio_stream *stream)
|
||||
static void started_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Stream %p started\n", stream);
|
||||
k_sem_give(&sem_started);
|
||||
}
|
||||
|
||||
static void stopped_cb(struct bt_audio_stream *stream, uint8_t reason)
|
||||
static void stopped_cb(struct bt_bap_stream *stream, uint8_t reason)
|
||||
{
|
||||
printk("Stream %p stopped with reason 0x%02X\n", stream, reason);
|
||||
k_sem_give(&sem_stopped);
|
||||
}
|
||||
|
||||
static void recv_cb(struct bt_audio_stream *stream,
|
||||
static void recv_cb(struct bt_bap_stream *stream,
|
||||
const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf)
|
||||
{
|
||||
SET_FLAG(flag_received);
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops stream_ops = {
|
||||
static struct bt_bap_stream_ops stream_ops = {
|
||||
.started = started_cb,
|
||||
.stopped = stopped_cb,
|
||||
.recv = recv_cb
|
||||
|
|
@ -200,7 +200,7 @@ static int init(void)
|
|||
|
||||
for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) {
|
||||
streams[i] = &broadcast_sink_streams[i];
|
||||
bt_audio_stream_cb_register(streams[i], &stream_ops);
|
||||
bt_bap_stream_cb_register(streams[i], &stream_ops);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ NET_BUF_POOL_FIXED_DEFINE(tx_pool,
|
|||
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_BAP_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_audio_stream *streams[ARRAY_SIZE(broadcast_source_streams)];
|
||||
static struct bt_bap_stream broadcast_source_streams[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT];
|
||||
static struct bt_bap_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,
|
||||
BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED);
|
||||
|
|
@ -39,19 +39,19 @@ CREATE_FLAG(flag_stopping);
|
|||
static K_SEM_DEFINE(sem_started, 0U, ARRAY_SIZE(streams));
|
||||
static K_SEM_DEFINE(sem_stopped, 0U, ARRAY_SIZE(streams));
|
||||
|
||||
static void started_cb(struct bt_audio_stream *stream)
|
||||
static void started_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Stream %p started\n", stream);
|
||||
k_sem_give(&sem_started);
|
||||
}
|
||||
|
||||
static void stopped_cb(struct bt_audio_stream *stream, uint8_t reason)
|
||||
static void stopped_cb(struct bt_bap_stream *stream, uint8_t reason)
|
||||
{
|
||||
printk("Stream %p stopped with reason 0x%02X\n", stream, reason);
|
||||
k_sem_give(&sem_stopped);
|
||||
}
|
||||
|
||||
static void sent_cb(struct bt_audio_stream *stream)
|
||||
static void sent_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
static uint8_t mock_data[CONFIG_BT_ISO_TX_MTU];
|
||||
static bool mock_data_initialized;
|
||||
|
|
@ -81,7 +81,7 @@ static void sent_cb(struct bt_audio_stream *stream)
|
|||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
/* Use preset_16_2_1 as that is the config we end up using */
|
||||
net_buf_add_mem(buf, mock_data, preset_16_2_1.qos.sdu);
|
||||
ret = bt_audio_stream_send(stream, buf, seq_num++,
|
||||
ret = bt_bap_stream_send(stream, buf, seq_num++,
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
if (ret < 0) {
|
||||
/* This will end broadcasting on this stream. */
|
||||
|
|
@ -91,7 +91,7 @@ static void sent_cb(struct bt_audio_stream *stream)
|
|||
}
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops stream_ops = {
|
||||
static struct bt_bap_stream_ops stream_ops = {
|
||||
.started = started_cb,
|
||||
.stopped = stopped_cb,
|
||||
.sent = sent_cb
|
||||
|
|
@ -113,7 +113,7 @@ static int setup_broadcast_source(struct bt_bap_broadcast_source **source)
|
|||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(stream_params); i++) {
|
||||
stream_params[i].stream = &broadcast_source_streams[i];
|
||||
bt_audio_stream_cb_register(stream_params[i].stream,
|
||||
bt_bap_stream_cb_register(stream_params[i].stream,
|
||||
&stream_ops);
|
||||
stream_params[i].data_count = 1U;
|
||||
stream_params[i].data = &bis_codec_data;
|
||||
|
|
|
|||
|
|
@ -165,30 +165,26 @@ static struct bt_bap_broadcast_sink_cb broadcast_sink_cbs = {
|
|||
.pa_sync_lost = pa_sync_lost_cb
|
||||
};
|
||||
|
||||
static void started_cb(struct bt_audio_stream *stream)
|
||||
static void started_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Stream %p started\n", stream);
|
||||
k_sem_give(&sem_broadcast_started);
|
||||
}
|
||||
|
||||
static void stopped_cb(struct bt_audio_stream *stream, uint8_t reason)
|
||||
static void stopped_cb(struct bt_bap_stream *stream, uint8_t reason)
|
||||
{
|
||||
printk("Stream %p stopped with reason 0x%02X\n", stream, reason);
|
||||
k_sem_give(&sem_broadcast_stopped);
|
||||
}
|
||||
|
||||
static void recv_cb(struct bt_audio_stream *stream,
|
||||
const struct bt_iso_recv_info *info,
|
||||
static void recv_cb(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info,
|
||||
struct net_buf *buf)
|
||||
{
|
||||
SET_FLAG(flag_received);
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops broadcast_stream_ops = {
|
||||
.started = started_cb,
|
||||
.stopped = stopped_cb,
|
||||
.recv = recv_cb
|
||||
};
|
||||
static struct bt_bap_stream_ops broadcast_stream_ops = {
|
||||
.started = started_cb, .stopped = stopped_cb, .recv = recv_cb};
|
||||
|
||||
/* TODO: Expand with CAP service data */
|
||||
static const struct bt_data cap_acceptor_ad[] = {
|
||||
|
|
@ -298,7 +294,7 @@ static void test_cap_acceptor_unicast(void)
|
|||
|
||||
static void test_cap_acceptor_broadcast(void)
|
||||
{
|
||||
static struct bt_audio_stream *bap_streams[ARRAY_SIZE(broadcast_sink_streams)];
|
||||
static struct bt_bap_stream *bap_streams[ARRAY_SIZE(broadcast_sink_streams)];
|
||||
int err;
|
||||
|
||||
init();
|
||||
|
|
|
|||
|
|
@ -41,19 +41,19 @@ CREATE_FLAG(flag_discovered);
|
|||
CREATE_FLAG(flag_mtu_exchanged);
|
||||
CREATE_FLAG(flag_broadcast_stopping);
|
||||
|
||||
static void broadcast_started_cb(struct bt_audio_stream *stream)
|
||||
static void broadcast_started_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
printk("Stream %p started\n", stream);
|
||||
k_sem_give(&sem_broadcast_started);
|
||||
}
|
||||
|
||||
static void broadcast_stopped_cb(struct bt_audio_stream *stream, uint8_t reason)
|
||||
static void broadcast_stopped_cb(struct bt_bap_stream *stream, uint8_t reason)
|
||||
{
|
||||
printk("Stream %p stopped with reason 0x%02X\n", stream, reason);
|
||||
k_sem_give(&sem_broadcast_stopped);
|
||||
}
|
||||
|
||||
static void broadcast_sent_cb(struct bt_audio_stream *stream)
|
||||
static void broadcast_sent_cb(struct bt_bap_stream *stream)
|
||||
{
|
||||
static uint8_t mock_data[CONFIG_BT_ISO_TX_MTU];
|
||||
static bool mock_data_initialized;
|
||||
|
|
@ -88,8 +88,7 @@ static void broadcast_sent_cb(struct bt_audio_stream *stream)
|
|||
|
||||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
net_buf_add_mem(buf, mock_data, broadcast_preset_16_2_1.qos.sdu);
|
||||
ret = bt_audio_stream_send(stream, buf, seq_num++,
|
||||
BT_ISO_TIMESTAMP_NONE);
|
||||
ret = bt_bap_stream_send(stream, buf, seq_num++, BT_ISO_TIMESTAMP_NONE);
|
||||
if (ret < 0) {
|
||||
/* This will end broadcasting on this stream. */
|
||||
printk("Unable to broadcast data on %p: %d\n", stream, ret);
|
||||
|
|
@ -98,11 +97,9 @@ static void broadcast_sent_cb(struct bt_audio_stream *stream)
|
|||
}
|
||||
}
|
||||
|
||||
static struct bt_audio_stream_ops broadcast_stream_ops = {
|
||||
.started = broadcast_started_cb,
|
||||
.stopped = broadcast_stopped_cb,
|
||||
.sent = broadcast_sent_cb
|
||||
};
|
||||
static struct bt_bap_stream_ops broadcast_stream_ops = {.started = broadcast_started_cb,
|
||||
.stopped = broadcast_stopped_cb,
|
||||
.sent = broadcast_sent_cb};
|
||||
|
||||
static void cap_discovery_complete_cb(struct bt_conn *conn, int err,
|
||||
const struct bt_csip_set_coordinator_csis_inst *csis_inst)
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ CONFIG_BT_AICS_CLIENT_LOG_LEVEL_DBG=y
|
|||
CONFIG_BT_VOCS_CLIENT_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_AICS_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_VOCS_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_AUDIO_STREAM_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_BAP_STREAM_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_AUDIO_ISO_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_AUDIO_CODEC_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_CSIP_SET_COORDINATOR_LOG_LEVEL_DBG=y
|
||||
|
|
|
|||
Loading…
Reference in a new issue