Bluetooth Audio
API Reference
- group bt_audio
Bluetooth Audio.
Defines
-
BT_AUDIO_BROADCAST_ID_SIZE
-
BT_AUDIO_CONTEXT_TYPE_ANY
Any known context.
-
BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL
-
BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED
-
BROADCAST_SNK_STREAM_CNT
-
BROADCAST_SNK_SUBGROUP_CNT
-
BT_CODEC_DATA(_type, _bytes...)
Helper to declare elements of bt_codec_data arrays.
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.
- Parameters
_type – Type of advertising data field
_bytes – Variable number of single-byte parameters
-
BT_CODEC(_id, _cid, _vid, _data, _meta)
Helper to declare bt_codec structure.
- Parameters
_id – Codec ID
_cid – Company ID
_vid – Vendor ID
_data – Codec Specific Data in LVT format
_meta – Codec Specific Metadata in LVT format
-
BT_CODEC_QOS(_interval, _framing, _phy, _sdu, _rtn, _latency, _pd)
Helper to declare elements of bt_codec_qos.
- Parameters
_interval – SDU interval (usec)
_framing – Framing
_phy – Target PHY
_sdu – Maximum SDU Size
_rtn – Retransmission number
_latency – Maximum Transport Latency (msec)
_pd – Presentation Delay (usec)
-
BT_CODEC_QOS_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd)
Helper to declare Input Unframed bt_codec_qos.
- Parameters
_interval – SDU interval (usec)
_sdu – Maximum SDU Size
_rtn – Retransmission number
_latency – Maximum Transport Latency (msec)
_pd – Presentation Delay (usec)
-
BT_CODEC_QOS_FRAMED(_interval, _sdu, _rtn, _latency, _pd)
Helper to declare Input Framed bt_codec_qos.
- Parameters
_interval – SDU interval (usec)
_sdu – Maximum SDU Size
_rtn – Retransmission number
_latency – Maximum Transport Latency (msec)
_pd – Presentation Delay (usec)
-
BT_CODEC_QOS_PREF(_unframed_supported, _phy, _rtn, _latency, _pd_min, _pd_max, _pref_pd_min, _pref_pd_max)
Helper to declare elements of bt_codec_qos_pref.
- Parameters
_unframed_supported – Unframed PDUs supported
_phy – Preferred Target PHY
_rtn – Preferred Retransmission number
_latency – Preferred Maximum Transport Latency (msec)
_pd_min – Minimum Presentation Delay (usec)
_pd_max – Maximum Presentation Delay (usec)
_pref_pd_min – Preferred Minimum Presentation Delay (usec)
_pref_pd_max – Preferred Maximum Presentation Delay (usec)
-
BT_AUDIO_LC3_PRESET(_codec, _qos)
Helper to declare an LC3 preset structure
-
BT_AUDIO_LC3_UNICAST_PRESET_8_1_1(_loc, _stream_context)
Helper to declare LC3 Unicast 8_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_8_2_1(_loc, _stream_context)
Helper to declare LC3 Unicast 8_2_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_16_1_1(_loc, _stream_context)
Helper to declare LC3 Unicast 16_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_16_2_1(_loc, _stream_context)
Helper to declare LC3 Unicast 16_2_1 codec configuration.
Mandatory to support as both unicast client and server
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_24_1_1(_loc, _stream_context)
Helper to declare LC3 Unicast 24_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_24_2_1(_loc, _stream_context)
Helper to declare LC3 Unicast 24_2_1 codec configuration.
Mandatory to support as unicast server
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_32_1_1(_loc, _stream_context)
Helper to declare LC3 Unicast 32_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_32_2_1(_loc, _stream_context)
Helper to declare LC3 Unicast 32_2_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_441_1_1(_loc, _stream_context)
Helper to declare LC3 Unicast 441_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_441_2_1(_loc, _stream_context)
Helper to declare LC3 Unicast 441_2_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_1_1(_loc, _stream_context)
Helper to declare LC3 Unicast 48_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_2_1(_loc, _stream_context)
Helper to declare LC3 Unicast 48_2_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_3_1(_loc, _stream_context)
Helper to declare LC3 Unicast 48_3_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_4_1(_loc, _stream_context)
Helper to declare LC3 Unicast 48_4_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_5_1(_loc, _stream_context)
Helper to declare LC3 Unicast 8_5_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_6_1(_loc, _stream_context)
Helper to declare LC3 Unicast 48_6_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_8_1_2(_loc, _stream_context)
Helper to declare LC3 Unicast 8_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_8_2_2(_loc, _stream_context)
Helper to declare LC3 Unicast 8_2_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_16_1_2(_loc, _stream_context)
Helper to declare LC3 Unicast 16_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_16_2_2(_loc, _stream_context)
Helper to declare LC3 Unicast 16_2_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_24_1_2(_loc, _stream_context)
Helper to declare LC3 Unicast 24_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_24_2_2(_loc, _stream_context)
Helper to declare LC3 Unicast 24_2_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_32_1_2(_loc, _stream_context)
Helper to declare LC3 Unicast 32_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_32_2_2(_loc, _stream_context)
Helper to declare LC3 Unicast 32_2_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_441_1_2(_loc, _stream_context)
Helper to declare LC3 Unicast 441_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_441_2_2(_loc, _stream_context)
Helper to declare LC3 Unicast 441_2_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_1_2(_loc, _stream_context)
Helper to declare LC3 Unicast 48_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_2_2(_loc, _stream_context)
Helper to declare LC3 Unicast 48_2_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_3_2(_loc, _stream_context)
Helper to declare LC3 Unicast 48_3_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_4_2(_loc, _stream_context)
Helper to declare LC3 Unicast 48_4_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_5_2(_loc, _stream_context)
Helper to declare LC3 Unicast 48_5_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_UNICAST_PRESET_48_6_2(_loc, _stream_context)
Helper to declare LC3 Unicast 48_6_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_8_1_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 8_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_8_2_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 8_2_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_16_1_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 16_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_16_2_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 16_2_1 codec configuration.
Mandatory to support as both broadcast source and sink
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_24_1_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 24_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_24_2_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 24_2_1 codec configuration.
Mandatory to support as broadcast sink
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_32_1_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 32_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_32_2_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 32_2_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_441_1_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 441_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_441_2_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 441_2_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_1_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_1_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_2_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_2_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_3_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_3_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_4_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_4_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_5_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_5_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_6_1(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_6_1 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_8_1_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 8_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_8_2_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 8_2_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_16_1_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 16_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_16_2_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 16_2_2 codec configuration.
Mandatory to support as both broadcast source and sink
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_24_1_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 24_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_24_2_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 24_2_2 codec configuration.
Mandatory to support as broadcast sink
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_32_1_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 32_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_32_2_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 32_2_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_441_1_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 441_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_441_2_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 441_2_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_1_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_1_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_2_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_2_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_3_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_3_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_4_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_4_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_5_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_5_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
-
BT_AUDIO_LC3_BROADCAST_PRESET_48_6_2(_loc, _stream_context)
Helper to declare LC3 Broadcast 48_6_2 codec configuration.
- Parameters
_loc – Audio channel location bitfield (bt_audio_location)
_stream_context – Stream context (BT_AUDIO_CONTEXT_*)
Enums
-
enum bt_audio_context
Audio Context Type for Generic Audio.
These values are defined by the Generic Audio Assigned Numbers, bluetooth.com
Values:
-
enumerator BT_AUDIO_CONTEXT_TYPE_PROHIBITED = 0
-
enumerator BT_AUDIO_CONTEXT_TYPE_PROHIBITED = 0
-
enum bt_audio_parental_rating
Parental rating defined by the Generic Audio assigned numbers (bluetooth.com).
The numbering scheme is aligned with Annex F of EN 300 707 v1.2.1 which defined parental rating for viewing.
Values:
-
enumerator BT_AUDIO_PARENTAL_RATING_NO_RATING = 0x00
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_ANY = 0x01
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_5_OR_ABOVE = 0x02
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_6_OR_ABOVE = 0x03
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_7_OR_ABOVE = 0x04
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_8_OR_ABOVE = 0x05
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_9_OR_ABOVE = 0x06
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE = 0x07
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_11_OR_ABOVE = 0x08
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_12_OR_ABOVE = 0x09
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_13_OR_ABOVE = 0x0A
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_14_OR_ABOVE = 0x0B
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_15_OR_ABOVE = 0x0C
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_16_OR_ABOVE = 0x0D
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_17_OR_ABOVE = 0x0E
-
enumerator BT_AUDIO_PARENTAL_RATING_AGE_18_OR_ABOVE = 0x0F
-
enumerator BT_AUDIO_PARENTAL_RATING_NO_RATING = 0x00
-
enum bt_audio_metadata_type
Codec metadata type IDs.
Metadata types defined by the Generic Audio assigned numbers (bluetooth.com).
Values:
-
enumerator BT_AUDIO_METADATA_TYPE_PREF_CONTEXT = 0x01
Preferred audio context.
Bitfield of preferred audio contexts. If 0, the context type is not a preferred use case for this codec configuration. See the BT_AUDIO_CONTEXT_* for valid values.
-
enumerator BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT = 0x02
Streaming audio context.
Bitfield of streaming audio contexts. If 0, the context type is not a preferred use case for this codec configuration. See the BT_AUDIO_CONTEXT_* for valid values.
-
enumerator BT_AUDIO_METADATA_TYPE_PROGRAM_INFO = 0x03
UTF-8 encoded title or summary of stream content
-
enumerator BT_AUDIO_METADATA_TYPE_STREAM_LANG = 0x04
Stream language.
3 octet lower case language code defined by ISO 639-3
-
enumerator BT_AUDIO_METADATA_TYPE_CCID_LIST = 0x05
Array of 8-bit CCID values
-
enumerator BT_AUDIO_METADATA_TYPE_PARENTAL_RATING = 0x06
Parental rating.
See @ref bt_audio_parental_rating for valid values.
-
enumerator BT_AUDIO_METADATA_TYPE_PROGRAM_INFO_URI = 0x07
UTF-8 encoded URI for additional Program information
-
enumerator BT_AUDIO_METADATA_TYPE_EXTENDED = 0xFE
Extended metadata
-
enumerator BT_AUDIO_METADATA_TYPE_VENDOR = 0xFF
Vendor specific metadata
-
enumerator BT_AUDIO_METADATA_TYPE_PREF_CONTEXT = 0x01
-
enum bt_audio_location
Location values for BT Audio.
These values are defined by the Generic Audio Assigned Numbers, bluetooth.com
Values:
-
enum bt_audio_dir
Audio Capability type.
Values:
-
enumerator BT_AUDIO_DIR_SINK = 0x01
-
enumerator BT_AUDIO_DIR_SOURCE = 0x02
-
enumerator BT_AUDIO_DIR_SINK = 0x01
Functions
-
int bt_audio_unicast_client_register_cb(const struct bt_audio_unicast_client_cb *cb)
Register unicast client callbacks.
Only one callback structure can be registered, and attempting to registering more than one will result in an error.
- Parameters
cb – Unicast client callback structure.
- Returns
0 in case of success or negative value in case of error.
-
void bt_audio_stream_cb_register(struct bt_audio_stream *stream, struct bt_audio_stream_ops *ops)
Register Audio callbacks for a stream.
Register Audio callbacks for a stream.
- Parameters
stream – Stream object.
ops – Stream operations structure.
-
struct bt_codec_data
- #include <audio.h>
Codec configuration structure.
-
struct bt_codec
- #include <audio.h>
Codec structure.
Public Members
-
uint8_t id
Codec ID
-
uint16_t cid
Codec Company ID
-
uint16_t vid
Codec Company Vendor ID
-
size_t data_count
Codec Specific Data count
-
struct bt_codec_data data[CONFIG_BT_CODEC_MAX_DATA_COUNT]
Codec Specific Data
-
size_t meta_count
Codec Specific Metadata count
-
struct bt_codec_data meta[CONFIG_BT_CODEC_MAX_METADATA_COUNT]
Codec Specific Metadata
-
uint8_t id
-
struct bt_audio_base_bis_data
- #include <audio.h>
Public Members
-
size_t data_count
Codec Specific Data count.
Only valid if the data_count of struct bt_codec in the subgroup is 0
-
struct bt_codec_data data[CONFIG_BT_CODEC_MAX_DATA_COUNT]
Codec Specific Data
Only valid if the data_count of struct bt_codec in the subgroup is 0
-
size_t data_count
-
struct bt_audio_base_subgroup
- #include <audio.h>
-
struct bt_audio_base
- #include <audio.h>
-
struct bt_codec_qos
- #include <audio.h>
Codec QoS structure.
-
struct bt_codec_qos_pref
- #include <audio.h>
Audio Stream Quality of Service Preference structure.
Public Members
-
bool unframed_supported
Unframed PDUs supported.
Unlike the other fields, this is not a preference but whether the codec supports unframed ISOAL PDUs.
-
uint8_t phy
Preferred PHY
-
uint8_t rtn
Preferred Retransmission Number
-
uint16_t latency
Preferred Transport Latency
-
uint32_t pd_min
Minimum Presentation Delay.
Unlike the other fields, this is not a preference but a minimum requirement.
-
uint32_t pd_max
Maximum Presentation Delay.
Unlike the other fields, this is not a preference but a maximum requirement.
-
uint32_t pref_pd_min
Preferred minimum Presentation Delay.
-
uint32_t pref_pd_max
Preferred maximum Presentation Delay
-
bool unframed_supported
-
struct bt_audio_lc3_preset
- #include <audio.h>
Struct to hold a BAP defined LC3 preset
Public Members
-
struct bt_codec_qos qos
The BAP spec defined QoS values
-
struct bt_codec_qos qos
-
struct bt_audio_stream
- #include <audio.h>
Audio stream structure.
Audio Streams represents a stream configuration of a Remote Endpoint and a Local Capability.
Note
Audio streams are unidirectional although its QoS can be configured to be bidirectional if stream are linked, in which case the QoS must be symmetric in both directions.
Public Members
-
struct bt_conn *conn
Connection reference
-
struct bt_audio_ep *ep
Endpoint reference
-
struct bt_codec_qos *qos
QoS Configuration
-
struct bt_iso_chan *iso
ISO channel reference
-
struct bt_audio_stream_ops *ops
Audio stream operations
-
void *user_data
Stream user data
-
struct bt_conn *conn
-
struct bt_audio_unicast_client_cb
- #include <audio.h>
Unicast Client callback structure
Public Members
-
void (*location)(struct bt_conn *conn, enum bt_audio_dir dir, enum bt_audio_location loc)
Remote Unicast Server Audio Locations.
This callback is called whenever the audio locations is read from the server or otherwise notified to the client.
- Param conn
Connection to the remote unicast server.
- Param dir
Direction of the location.
- Param loc
The location bitfield value.
- Return
0 in case of success or negative value in case of error.
-
void (*available_contexts)(struct bt_conn *conn, enum bt_audio_context snk_ctx, enum bt_audio_context src_ctx)
Remote Unicast Server Available Contexts.
This callback is called whenever the available contexts are read from the server or otherwise notified to the client.
- Param conn
Connection to the remote unicast server.
- Param snk_ctx
The sink context bitfield value.
- Param src_ctx
The source context bitfield value.
- Return
0 in case of success or negative value in case of error.
-
void (*location)(struct bt_conn *conn, enum bt_audio_dir dir, enum bt_audio_location loc)
-
struct bt_audio_unicast_server_cb
- #include <audio.h>
Unicast Server callback structure
Public Members
-
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, struct bt_codec_qos_pref *const pref)
Endpoint config request callback.
Config callback is called whenever an endpoint is requested to be configured
- Param conn
[in] Connection object.
- Param ep
[in] Local Audio Endpoint being configured.
- Param dir
[in] Direction of the endpoint.
- Param codec
[in] Codec configuration.
- Param stream
[out] Pointer to stream that will be configured for the endpoint.
- Param pref
[out] Pointer to a QoS preference object that shall be populated with values. Invalid values will reject the codec configuration request.
- 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, const struct bt_codec *codec, struct bt_codec_qos_pref *const pref)
Stream reconfig request callback.
Reconfig callback is called whenever an Audio Stream needs to be reconfigured with different codec configuration.
- Param stream
[in] Stream object being reconfigured.
- Param dir
[in] Direction of the endpoint.
- Param codec
[in] Codec configuration.
- Param pref
[out] Pointer to a QoS preference object that shall be populated with values. Invalid values will reject the codec configuration request.
- 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)
Stream QoS request callback.
QoS callback is called whenever an Audio Stream Quality of Service needs to be configured.
- Param stream
Stream object being reconfigured.
- Param qos
Quality of Service configuration.
- 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, size_t meta_count)
Stream Enable request callback.
Enable callback is called whenever an Audio Stream is requested to be enabled to stream.
- Param stream
Stream object being enabled.
- Param meta
Metadata entries
- Param meta_count
Number of metadata entries
- Return
0 in case of success or negative value in case of error.
-
int (*start)(struct bt_audio_stream *stream)
Stream Start request callback.
Start callback is called whenever an Audio Stream is requested to start streaming.
- Param stream
Stream object.
- 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, size_t meta_count)
Stream Metadata update request callback.
Metadata callback is called whenever an Audio Stream is requested to update its metadata.
- Param stream
Stream object.
- Param meta
Metadata entries
- Param meta_count
Number of metadata entries
- Return
0 in case of success or negative value in case of error.
-
int (*disable)(struct bt_audio_stream *stream)
Stream Disable request callback.
Disable callback is called whenever an Audio Stream is requested to disable the stream.
- Param stream
Stream object being disabled.
- Return
0 in case of success or negative value in case of error.
-
int (*stop)(struct bt_audio_stream *stream)
Stream Stop callback.
Stop callback is called whenever an Audio Stream is requested to stop streaming.
- Param stream
Stream object.
- Return
0 in case of success or negative value in case of error.
-
int (*release)(struct bt_audio_stream *stream)
Stream release callback.
Release callback is called whenever a new Audio Stream needs to be released and thus deallocated.
- Param stream
Stream object.
- 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, struct bt_codec_qos_pref *const pref)
-
struct bt_audio_pacs_cb
- #include <audio.h>
Callback structure for the Public Audio Capabilities Service (PACS)
This is used for the Unicast Server (
CONFIG_BT_AUDIO_UNICAST_SERVER
) and Broadcast Sink (CONFIG_BT_AUDIO_BROADCAST_SINK
) roles.Public Members
-
int (*get_available_contexts)(struct bt_conn *conn, enum bt_audio_dir dir, enum bt_audio_context *context)
Get available audio contexts callback.
Get available audio contexts callback is called whenever a remote client requests to read the value of Published Audio Capabilities (PAC) Available Audio Contexts, or if the value needs to be notified.
- Param conn
[in] The connection that requests the available audio contexts. Will be NULL if requested for sending a notification, as a result of calling bt_pacs_available_contexts_changed().
- Param dir
[in] Direction of the endpoint.
- Param context
[out] Pointer to the contexts that needs to be set.
- Return
0 in case of success or negative value in case of error.
-
int (*publish_capability)(struct bt_conn *conn, uint8_t type, uint8_t index, struct bt_codec *const codec)
Publish Capability callback.
Publish Capability callback is called whenever a remote client requests to read the Published Audio Capabilities (PAC) records. The callback will be called iteratively until it returns an error, increasing the
index
each time. Once an error value (non-zero) is returned, the previously returnedcodec
values (if any) will be sent to the client that requested the value.- Param conn
The connection that requests the capabilities. Will be NULL if the capabilities is requested for sending a notification, as a result of calling bt_audio_capability_register() or bt_audio_capability_unregister().
- Param type
Type of the endpoint.
- Param index
Index of the codec object requested. Multiple objects may be returned, and this value keep tracks of how many have previously been returned.
- Param codec
Codec object that shall be populated if returning success (0). Ignored if returning non-zero.
- Return
0 in case of success or negative value in case of error.
-
int (*get_available_contexts)(struct bt_conn *conn, enum bt_audio_dir dir, enum bt_audio_context *context)
-
struct bt_audio_broadcast_sink_cb
- #include <audio.h>
Broadcast Audio Sink callback structure
Public Members
-
bool (*scan_recv)(const struct bt_le_scan_recv_info *info, struct net_buf_simple *ad, uint32_t broadcast_id)
Scan receive callback.
Scan receive callback is called whenever a broadcast source has been found.
- Param info
Advertiser packet information.
- Param ad
Buffer containing advertiser data.
- Param broadcast_id
24-bit broadcast ID
- Return
true to sync to the broadcaster, else false. Syncing to the broadcaster will stop the current scan.
-
void (*pa_synced)(struct bt_audio_broadcast_sink *sink, struct bt_le_per_adv_sync *sync, uint32_t broadcast_id)
Periodic advertising sync callback.
Called when synchronized to a periodic advertising. When synchronized a bt_audio_broadcast_sink structure is allocated for future use.
- Param sink
Pointer to the allocated sink structure.
- Param sync
Pointer to the periodic advertising sync.
- Param broadcast_id
24-bit broadcast ID previously reported by scan_recv.
-
void (*base_recv)(struct bt_audio_broadcast_sink *sink, const struct bt_audio_base *base)
Broadcast Audio Source Endpoint (BASE) received.
Callback for when we receive a BASE from a broadcaster after syncing to the broadcaster’s periodic advertising.
- Param sink
Pointer to the sink structure.
- Param base
Broadcast Audio Source Endpoint (BASE).
-
void (*syncable)(struct bt_audio_broadcast_sink *sink, bool encrypted)
Broadcast sink is syncable.
Called whenever a broadcast sink is not synchronized to audio, but the audio is synchronizable. This is inferred when a BIGInfo report is received.
Once this callback has been called, it is possible to call bt_audio_broadcast_sink_sync() to synchronize to the audio stream(s).
- Param sink
Pointer to the sink structure.
- Param encrypted
Whether or not the broadcast is encrypted
-
void (*scan_term)(int err)
Scan terminated callback.
Scan terminated callback is called whenever a scan started by bt_audio_broadcast_sink_scan_start() is terminated before bt_audio_broadcast_sink_scan_stop().
Typical reasons for this are that the periodic advertising has synchronized (success criteria) or the scan timed out. It may also be called if the periodic advertising failed to synchronize.
- Param err
0 in case of success or negative value in case of error.
-
void (*pa_sync_lost)(struct bt_audio_broadcast_sink *sink)
Periodic advertising synchronization lost callback.
The periodic advertising synchronization lost callback is called if the periodic advertising sync is lost. If this happens, the sink object is deleted. To synchronize to the broadcaster again, bt_audio_broadcast_sink_scan_start() must be called.
- Param sink
Pointer to the sink structure.
-
bool (*scan_recv)(const struct bt_le_scan_recv_info *info, struct net_buf_simple *ad, uint32_t broadcast_id)
-
struct bt_audio_stream_ops
- #include <audio.h>
Stream operation.
Public Members
-
void (*started)(struct bt_audio_stream *stream)
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 (*stopped)(struct bt_audio_stream *stream)
Stream stopped callback.
Stopped callback is called whenever an Audio Stream has been stopped.
- Param stream
Stream object that has been stopped.
-
void (*started)(struct bt_audio_stream *stream)
-
BT_AUDIO_BROADCAST_ID_SIZE
- group bt_audio_client
Typedefs
-
typedef void (*bt_audio_discover_func_t)(struct bt_conn *conn, struct bt_codec *codec, struct bt_audio_ep *ep, struct bt_audio_discover_params *params)
Discover Audio capabilities and endpoints callback function.
If discovery procedure has complete both cap and ep are set to NULL.
Functions
-
int bt_audio_discover(struct bt_conn *conn, struct bt_audio_discover_params *params)
Discover remote capabilities and endpoints.
This procedure is used by a client to discover remote capabilities and endpoints and notifies via params callback.
Note
This procedure is asynchronous therefore the parameters need to remains valid while it is active.
- Parameters
conn – Connection object
params – Discover parameters
-
int bt_audio_stream_config(struct bt_conn *conn, struct bt_audio_stream *stream, struct bt_audio_ep *ep, struct bt_codec *codec)
Configure Audio Stream.
This procedure is used by a client to configure a new stream using the remote endpoint, local capability and codec configuration.
- Parameters
conn – Connection object
stream – Stream object being configured
ep – Remote Audio Endpoint being configured
codec – Codec configuration
- Returns
Allocated Audio Stream object or NULL in case of error.
-
int bt_audio_stream_reconfig(struct bt_audio_stream *stream, const struct bt_codec *codec)
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.
- Parameters
stream – Stream object being reconfigured
codec – Codec configuration
- Returns
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)
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
conn
will have the Quality of Service configured. This shall only be used to configure unicast streams.- Parameters
conn – Connection object
group – Unicast group object
- Returns
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)
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.
- Parameters
stream – Stream object
meta_count – Number of metadata entries
meta – Metadata entries
- Returns
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)
Change Audio Stream Metadata.
This procedure is used by a unicast client or unicast server to change the metadata of a stream.
- Parameters
stream – Stream object
meta_count – Number of metadata entries
meta – Metadata entries
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_stream_disable(struct bt_audio_stream *stream)
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.
- Parameters
stream – Stream object
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_stream_start(struct bt_audio_stream *stream)
Start Audio Stream.
This procedure is used by a unicast client or unicast server to make a stream start streaming.
This shall only be called for unicast streams. Broadcast sinks will always be started once synchronized, and broadcast source streams shall be started with bt_audio_broadcast_source_start().
- Parameters
stream – Stream object
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_stream_stop(struct bt_audio_stream *stream)
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_audio_broadcast_source_stop().
- Parameters
stream – Stream object
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_stream_release(struct bt_audio_stream *stream, bool cache)
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_audio_broadcast_sink_delete(). Broadcast source streams cannot be released, but can be deleted by bt_audio_broadcast_source_delete().
- Parameters
stream – Stream object
cache – True to cache the codec configuration or false to forget it
- Returns
0 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, uint32_t seq_num, uint32_t ts)
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.
- Parameters
stream – Stream object.
buf – Buffer containing data to be sent.
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.
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 BT_ISO_TIMESTAMP_NONE which will simply enqueue the ISO SDU in a FIFO manner.
- Returns
Bytes sent in case of success or negative value in case of error.
-
int bt_audio_unicast_group_create(struct bt_audio_unicast_group_param params[], size_t num_param, struct bt_audio_unicast_group **unicast_group)
Create audio unicast group.
Create a new audio unicast group with one or more audio streams as a unicast client. Streams in a unicast group shall share the same interval, framing and latency (see bt_codec_qos).
- Parameters
params – [in] Array of stream parameters being used for the group.
num_param – [in] Number of parameters in
params
.unicast_group – [out] Pointer to the unicast group created
- Returns
Zero on success or (negative) error code otherwise.
-
int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_group, struct bt_audio_unicast_group_param params[], size_t num_param)
Add streams to a unicast group as a unicast client.
This function can be used to add additional streams to a 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()). This can also be called after the streams have been stopped (see bt_audio_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 bt_audio_unicast_group_delete(), but this will require all streams in the group to be released first.
- Parameters
unicast_group – Pointer to the unicast group
params – Array of stream parameters with streams being added to the group.
num_param – Number of paramers in
params
.
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_unicast_group_delete(struct bt_audio_unicast_group *unicast_group)
Delete audio unicast group.
Delete a audio unicast group as a client. All streams in the group shall be in the idle or configured state.
- Parameters
unicast_group – Pointer to the unicast group to delete
- Returns
Zero on success or (negative) error code otherwise.
-
struct bt_audio_discover_params
- #include <audio.h>
Public Members
-
enum bt_audio_dir dir
Capabilities type
-
bt_audio_discover_func_t func
Callback function
-
uint8_t num_caps
Number of capabilities found
-
uint8_t num_eps
Number of endpoints found
-
uint8_t err
Error code.
-
enum bt_audio_dir dir
-
struct bt_audio_unicast_group_param
- #include <audio.h>
Parameter struct for the unicast group functions.
Parameter struct for the bt_audio_unicast_group_create() and bt_audio_unicast_group_add_streams() functions.
Public Members
-
struct bt_audio_stream *stream
Pointer to a stream object.
-
struct bt_codec_qos *qos
The QoS settings for the bt_audio_unicast_group_param::stream.
-
enum bt_audio_dir dir
The direction of the bt_audio_unicast_group_param::stream.
If two streams are being used for the same ACL connection but in different directions, they may use the same CIS.
-
struct bt_audio_stream *stream
-
typedef void (*bt_audio_discover_func_t)(struct bt_conn *conn, struct bt_codec *codec, struct bt_audio_ep *ep, struct bt_audio_discover_params *params)
- group bt_audio_server
Functions
-
int bt_audio_pacs_register_cb(const struct bt_audio_pacs_cb *cb)
Register Published Audio Capabilities Service callbacks.
Only one callback structure can be registered, and attempting to registering more than one will result in an error.
This can only be done for the Unicast Server (
CONFIG_BT_AUDIO_UNICAST_SERVER
) and Broadcast Sink (CONFIG_BT_AUDIO_BROADCAST_SINK
) roles.Calling bt_audio_capability_register() will implicitly register the callbacks.
- Parameters
cb – Unicast server callback structure.
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_pacs_location_changed(enum bt_audio_dir dir)
Notify that the location has changed.
- Parameters
dir – Direction of the location changed.
- Returns
0 in case of success or negative value in case of error.
-
int bt_pacs_available_contexts_changed(void)
Notify available audio contexts changed.
Notify connected clients that the available audio contexts has changed
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_unicast_server_register_cb(const struct bt_audio_unicast_server_cb *cb)
Register unicast server callbacks.
Only one callback structure can be registered, and attempting to registering more than one will result in an error.
- Parameters
cb – Unicast server callback structure.
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_unicast_server_unregister_cb(const struct bt_audio_unicast_server_cb *cb)
Unregister unicast server callbacks.
May only unregister a callback structure that has previously been registered by bt_audio_unicast_server_register_cb().
- Parameters
cb – Unicast server callback structure.
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_pacs_register_cb(const struct bt_audio_pacs_cb *cb)
- group bt_audio_broadcast
Audio Broadcast APIs.
Functions
-
int bt_audio_broadcast_source_create(struct bt_audio_stream *streams[], size_t num_stream, struct bt_codec *codec, struct bt_codec_qos *qos, struct bt_audio_broadcast_source **source)
Create audio broadcast source.
Create a new audio broadcast source with one or more audio streams.
The broadcast source will be visible for scanners once this has been called, and the device will advertise audio announcements.
No audio data can be sent until bt_audio_broadcast_source_start() has been called and no audio information (BIGInfo) will be visible to scanners (see bt_le_per_adv_sync_cb).
- Parameters
streams – [in] Array of stream object pointers being used for the broadcaster.
num_stream – [in] Number of streams in
streams
.codec – [in] Codec configuration.
qos – [in] Quality of Service configuration
source – [out] Pointer to the broadcast source created
- Returns
Zero on success or (negative) error code otherwise.
-
int bt_audio_broadcast_source_reconfig(struct bt_audio_broadcast_source *source, struct bt_codec *codec, struct bt_codec_qos *qos)
Reconfigure audio broadcast source.
Reconfigure an audio broadcast source with a new codec and codec quality of service parameters.
- Parameters
source – Pointer to the broadcast source
codec – Codec configuration.
qos – Quality of Service configuration
- Returns
Zero on success or (negative) error code otherwise.
-
int bt_audio_broadcast_source_start(struct bt_audio_broadcast_source *source)
Start audio broadcast source.
Start an audio broadcast source with one or more audio streams. The broadcast source will start advertising BIGInfo, and audio data can be streamed.
- Parameters
source – Pointer to the broadcast source
- Returns
Zero on success or (negative) error code otherwise.
-
int bt_audio_broadcast_source_stop(struct bt_audio_broadcast_source *source)
Stop audio broadcast source.
Stop an audio broadcast source. The broadcast source will stop advertising BIGInfo, and audio data can no longer be streamed.
- Parameters
source – Pointer to the broadcast source
- Returns
Zero on success or (negative) error code otherwise.
-
int bt_audio_broadcast_source_delete(struct bt_audio_broadcast_source *source)
Delete audio broadcast source.
Delete an audio broadcast source. The broadcast source will stop advertising entirely, and the source can no longer be used.
- Parameters
source – Pointer to the broadcast source
- Returns
Zero on success or (negative) error code otherwise.
-
void bt_audio_broadcast_sink_register_cb(struct bt_audio_broadcast_sink_cb *cb)
Register Broadcast sink callbacks *.
- Parameters
cb – Broadcast sink callback structure.
-
int bt_audio_broadcast_sink_scan_start(const struct bt_le_scan_param *param)
Start scan for broadcast sources.
Starts a scan for broadcast sources. Scan results will be received by the scan_recv callback. Only reports from devices advertising broadcast audio support will be sent. Note that a broadcast source may advertise broadcast audio capabilities, but may not be streaming.
- Parameters
param – Scan parameters.
- Returns
Zero on success or (negative) error code otherwise.
-
int bt_audio_broadcast_sink_scan_stop(void)
Stop scan for broadcast sources.
Stops ongoing scanning for broadcast sources.
- Returns
Zero on success or (negative) error code otherwise.
-
int bt_audio_broadcast_sink_sync(struct bt_audio_broadcast_sink *sink, uint32_t indexes_bitfield, struct bt_audio_stream *streams[], const uint8_t broadcast_code[16])
Sync to a broadcaster’s audio.
- Parameters
sink – Pointer to the sink object from the base_recv callback.
indexes_bitfield – Bitfield of the BIS index to sync to. To sync to e.g. BIS index 1 and 2, this should have the value of BIT(1) | BIT(2).
streams – Stream object pointers to be used for the receiver. If multiple BIS indexes shall be synchronized, multiple streams shall be provided.
broadcast_code – The 16-octet broadcast code. Shall be supplied if the broadcast is encrypted (see the syncable callback).
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_broadcast_sink_stop(struct bt_audio_broadcast_sink *sink)
Stop audio broadcast sink.
Stop an audio broadcast sink. The broadcast sink will stop receiving BIGInfo, and audio data can no longer be streamed.
- Parameters
sink – Pointer to the broadcast sink
- Returns
Zero on success or (negative) error code otherwise.
-
int bt_audio_broadcast_sink_delete(struct bt_audio_broadcast_sink *sink)
Release a broadcast 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.
- Parameters
sink – Pointer to the sink object to delete.
- Returns
0 in case of success or negative value in case of error.
-
int bt_audio_broadcast_source_create(struct bt_audio_stream *streams[], size_t num_stream, struct bt_codec *codec, struct bt_codec_qos *qos, struct bt_audio_broadcast_source **source)
- group bt_audio_codec_cfg
Audio codec Config APIs.
Functions to parse codec config data when formatted as LTV wrapped into bt_codec.
Enums
-
enum bt_audio_codec_parse_err
Codec parser error codes for Codec config parsing APIs.
Values:
-
enumerator BT_AUDIO_CODEC_PARSE_ERR_SUCCESS = 0
The requested type is not present in the data set.
-
enumerator BT_AUDIO_CODEC_PARSE_ERR_TYPE_NOT_FOUND = -1
The requested type is not present in the data set.
-
enumerator BT_AUDIO_CODEC_PARSE_ERR_INVALID_VALUE_FOUND = -2
The value found is invalid.
-
enumerator BT_AUDIO_CODEC_PARSE_ERR_INVALID_PARAM = -3
The parameters specified to the function call are not valid.
-
enumerator BT_AUDIO_CODEC_PARSE_ERR_SUCCESS = 0
Functions
-
int bt_codec_cfg_get_freq(const struct bt_codec *codec)
Extract the frequency from a codec configuration.
- Parameters
codec – The codec configuration to extract data from.
- Returns
The frequency in Hz if found else a negative value of type bt_audio_codec_parse_err.
-
int bt_codec_cfg_get_frame_duration_us(const struct bt_codec *codec)
Extract frame duration from BT codec config.
- Parameters
codec – The codec configuration to extract data from.
- Returns
Frame duration in microseconds if value is found else a negative value of type bt_audio_codec_parse_err.
-
int bt_codec_cfg_get_chan_allocation_val(const struct bt_codec *codec, uint32_t *chan_allocation)
Extract channel allocation from BT codec config.
The value returned is a bit field representing one or more audio locations as specified by bt_audio_location Shall match one or more of the bits set in BT_PAC_SNK_LOC/BT_PAC_SRC_LOC.
Up to the configured BT_CODEC_LC3_CHAN_COUNT number of channels can be present.
- Parameters
codec – The codec configuration to extract data from.
chan_allocation – Pointer to the variable to store the extracted value in.
- Returns
BT_AUDIO_CODEC_PARSE_SUCCESS if value is found and stored in the pointer provided else a negative value of type bt_audio_codec_parse_err.
-
int bt_codec_cfg_get_octets_per_frame(const struct bt_codec *codec)
Extract frame size in octets from BT codec config.
The overall SDU size will be octets_per_frame * blocks_per_sdu.
The Bluetooth specificationa are not clear about this value - it does not state that the codec shall use this SDU size only. A codec like LC3 supports variable bit-rate (per SDU) hence it might be allowed for an encoder to reduce the frame size below this value. Hence it is recommended to use the received SDU size and divide by blocks_per_sdu rather than relying on this octets_per_sdu value to be fixed.
- Parameters
codec – The codec configuration to extract data from.
- Returns
Frame length in octets if value is found else a negative value of type bt_audio_codec_parse_err.
-
int bt_codec_cfg_get_frame_blocks_per_sdu(const struct bt_codec *codec, bool fallback_to_default)
Extract number of audio frame blockss in each SDU from BT codec config.
The overall SDU size will be octets_per_frame * frame_blocks_per_sdu * number-of-channels.
If this value is not present a default value of 1 shall be used.
A frame block is one or more frames that represents data for the same period of time but for different channels. If the stream have two audio channels and this value is two there will be four frames in the SDU.
- Parameters
codec – The codec configuration to extract data from.
fallback_to_default – If true this function will return the default value of 1 if the type is not found. In this case the function will only fail if a NULL pointer is provided.
- Returns
The count of codec frames in each SDU if value is found else a negative value of type bt_audio_codec_parse_err - unless when
fallback_to_default
is true then the value 1 is returned if frames per sdu is not found.
-
bool bt_codec_get_val(const struct bt_codec *codec, uint8_t type, const struct bt_codec_data **data)
Lookup a specific value based on type.
Depending on context bt_codec will be either codec capabilities, codec configuration or meta data.
Typically types used are: bt_codec_capability_type bt_codec_config_type bt_audio_metadata_type
- Parameters
codec – The codec data to search in.
type – The type id to look for
data – Pointer to the data-pointer to update when item is found
- Returns
True if the type is found, false otherwise.
-
enum bt_audio_codec_parse_err