Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Bluetooth Audio

Bluetooth Audio. More...

Modules

 Codec capability parsing APIs
 Audio codec capabilities APIs.
 
 Codec config parsing APIs
 Audio codec Config APIs.
 

Data Structures

struct  bt_audio_codec_octets_per_codec_frame
 
struct  bt_audio_codec_cap
 Codec capability structure. More...
 
struct  bt_audio_codec_cfg
 Codec specific configuration structure. More...
 
struct  bt_audio_codec_qos
 Codec QoS structure. More...
 
struct  bt_audio_codec_qos_pref
 Audio Stream Quality of Service Preference structure. More...
 

Macros

#define BT_AUDIO_BROADCAST_ID_SIZE   3 /* octets */
 
#define BT_AUDIO_BROADCAST_ID_MAX   0xFFFFFFU
 Maximum broadcast ID value.
 
#define BT_AUDIO_PD_PREF_NONE   0x000000U
 Indicates that the server have no preference for the presentation delay.
 
#define BT_AUDIO_PD_MAX   0xFFFFFFU
 Maximum presentation delay in microseconds.
 
#define BT_AUDIO_BROADCAST_CODE_SIZE   16
 
#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MIN   1
 Minimum supported channel counts.
 
#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MAX   8
 Maximum supported channel counts.
 
#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_SUPPORT(...)    ((enum bt_audio_codec_cap_chan_count)((FOR_EACH(BIT, (|), __VA_ARGS__)) >> 1))
 Channel count support capability.
 
#define BT_AUDIO_CONTEXT_TYPE_ANY
 Any known context.
 
#define BT_AUDIO_METADATA_TYPE_IS_KNOWN(_type)
 Helper to check whether metadata type is known by the stack.
 
#define BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL   0x00
 
#define BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED   0x01
 
#define BT_AUDIO_CODEC_DATA(_type, _bytes...)    (sizeof((uint8_t)_type) + sizeof((uint8_t[]){_bytes})), (_type), _bytes
 Helper to declare elements of bt_audio_codec_cap arrays.
 
#define BT_AUDIO_CODEC_CFG(_id, _cid, _vid, _data, _meta)
 Helper to declare Codec config parsing APIs.
 
#define BT_AUDIO_CODEC_CAP(_id, _cid, _vid, _data, _meta)
 Helper to declare Codec capability parsing APIs structure.
 
#define BT_AUDIO_LOCATION_ANY
 Any known location.
 
#define BT_AUDIO_CODEC_QOS(_interval, _framing, _phy, _sdu, _rtn, _latency, _pd)
 Helper to declare elements of bt_audio_codec_qos.
 
#define BT_AUDIO_CODEC_QOS_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd)
 Helper to declare Input Unframed bt_audio_codec_qos.
 
#define BT_AUDIO_CODEC_QOS_FRAMED(_interval, _sdu, _rtn, _latency, _pd)
 Helper to declare Input Framed bt_audio_codec_qos.
 
#define BT_AUDIO_CODEC_QOS_PREF(_unframed_supported, _phy, _rtn, _latency, _pd_min, _pd_max, _pref_pd_min, _pref_pd_max)
 Helper to declare elements of bt_audio_codec_qos_pref.
 

Enumerations

enum  bt_audio_codec_cap_type {
  BT_AUDIO_CODEC_CAP_TYPE_FREQ = 0x01 , BT_AUDIO_CODEC_CAP_TYPE_DURATION = 0x02 , BT_AUDIO_CODEC_CAP_TYPE_CHAN_COUNT = 0x03 , BT_AUDIO_CODEC_CAP_TYPE_FRAME_LEN = 0x04 ,
  BT_AUDIO_CODEC_CAP_TYPE_FRAME_COUNT = 0x05
}
 Codec capability types. More...
 
enum  bt_audio_codec_cap_freq {
  BT_AUDIO_CODEC_CAP_FREQ_8KHZ = BIT(0) , BT_AUDIO_CODEC_CAP_FREQ_11KHZ = BIT(1) , BT_AUDIO_CODEC_CAP_FREQ_16KHZ = BIT(2) , BT_AUDIO_CODEC_CAP_FREQ_22KHZ = BIT(3) ,
  BT_AUDIO_CODEC_CAP_FREQ_24KHZ = BIT(4) , BT_AUDIO_CODEC_CAP_FREQ_32KHZ = BIT(5) , BT_AUDIO_CODEC_CAP_FREQ_44KHZ = BIT(6) , BT_AUDIO_CODEC_CAP_FREQ_48KHZ = BIT(7) ,
  BT_AUDIO_CODEC_CAP_FREQ_88KHZ = BIT(8) , BT_AUDIO_CODEC_CAP_FREQ_96KHZ = BIT(9) , BT_AUDIO_CODEC_CAP_FREQ_176KHZ = BIT(10) , BT_AUDIO_CODEC_CAP_FREQ_192KHZ = BIT(11) ,
  BT_AUDIO_CODEC_CAP_FREQ_384KHZ = BIT(12) , BT_AUDIO_CODEC_CAP_FREQ_ANY
}
 Supported frequencies bitfield. More...
 
enum  bt_audio_codec_cap_frame_dur {
  BT_AUDIO_CODEC_CAP_DURATION_7_5 = BIT(0) , BT_AUDIO_CODEC_CAP_DURATION_10 = BIT(1) , BT_AUDIO_CODEC_CAP_DURATION_ANY , BT_AUDIO_CODEC_CAP_DURATION_PREFER_7_5 = BIT(4) ,
  BT_AUDIO_CODEC_CAP_DURATION_PREFER_10 = BIT(5)
}
 Supported frame durations bitfield. More...
 
enum  bt_audio_codec_cap_chan_count {
  BT_AUDIO_CODEC_CAP_CHAN_COUNT_1 = BIT(0) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_2 = BIT(1) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_3 = BIT(2) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_4 = BIT(3) ,
  BT_AUDIO_CODEC_CAP_CHAN_COUNT_5 = BIT(4) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_6 = BIT(5) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_7 = BIT(6) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_8 = BIT(7) ,
  BT_AUDIO_CODEC_CAP_CHAN_COUNT_ANY
}
 
enum  bt_audio_codec_cfg_type {
  BT_AUDIO_CODEC_CFG_FREQ = 0x01 , BT_AUDIO_CODEC_CFG_DURATION = 0x02 , BT_AUDIO_CODEC_CFG_CHAN_ALLOC = 0x03 , BT_AUDIO_CODEC_CFG_FRAME_LEN = 0x04 ,
  BT_AUDIO_CODEC_CFG_FRAME_BLKS_PER_SDU = 0x05
}
 Codec configuration types. More...
 
enum  bt_audio_codec_cfg_freq {
  BT_AUDIO_CODEC_CFG_FREQ_8KHZ = 0x01 , BT_AUDIO_CODEC_CFG_FREQ_11KHZ = 0x02 , BT_AUDIO_CODEC_CFG_FREQ_16KHZ = 0x03 , BT_AUDIO_CODEC_CFG_FREQ_22KHZ = 0x04 ,
  BT_AUDIO_CODEC_CFG_FREQ_24KHZ = 0x05 , BT_AUDIO_CODEC_CFG_FREQ_32KHZ = 0x06 , BT_AUDIO_CODEC_CFG_FREQ_44KHZ = 0x07 , BT_AUDIO_CODEC_CFG_FREQ_48KHZ = 0x08 ,
  BT_AUDIO_CODEC_CFG_FREQ_88KHZ = 0x09 , BT_AUDIO_CODEC_CFG_FREQ_96KHZ = 0x0a , BT_AUDIO_CODEC_CFG_FREQ_176KHZ = 0x0b , BT_AUDIO_CODEC_CFG_FREQ_192KHZ = 0x0c ,
  BT_AUDIO_CODEC_CFG_FREQ_384KHZ = 0x0d
}
 
enum  bt_audio_codec_cfg_frame_dur { BT_AUDIO_CODEC_CFG_DURATION_7_5 = 0x00 , BT_AUDIO_CODEC_CFG_DURATION_10 = 0x01 }
 
enum  bt_audio_context {
  BT_AUDIO_CONTEXT_TYPE_PROHIBITED = 0 , BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED = BIT(0) , BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL = BIT(1) , BT_AUDIO_CONTEXT_TYPE_MEDIA = BIT(2) ,
  BT_AUDIO_CONTEXT_TYPE_GAME = BIT(3) , BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL = BIT(4) , BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS = BIT(5) , BT_AUDIO_CONTEXT_TYPE_LIVE = BIT(6) ,
  BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS = BIT(7) , BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS = BIT(8) , BT_AUDIO_CONTEXT_TYPE_RINGTONE = BIT(9) , BT_AUDIO_CONTEXT_TYPE_ALERTS = BIT(10) ,
  BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM = BIT(11)
}
 Audio Context Type for Generic Audio. More...
 
enum  bt_audio_parental_rating {
  BT_AUDIO_PARENTAL_RATING_NO_RATING = 0x00 , BT_AUDIO_PARENTAL_RATING_AGE_ANY = 0x01 , BT_AUDIO_PARENTAL_RATING_AGE_5_OR_ABOVE = 0x02 , BT_AUDIO_PARENTAL_RATING_AGE_6_OR_ABOVE = 0x03 ,
  BT_AUDIO_PARENTAL_RATING_AGE_7_OR_ABOVE = 0x04 , BT_AUDIO_PARENTAL_RATING_AGE_8_OR_ABOVE = 0x05 , BT_AUDIO_PARENTAL_RATING_AGE_9_OR_ABOVE = 0x06 , BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE = 0x07 ,
  BT_AUDIO_PARENTAL_RATING_AGE_11_OR_ABOVE = 0x08 , BT_AUDIO_PARENTAL_RATING_AGE_12_OR_ABOVE = 0x09 , BT_AUDIO_PARENTAL_RATING_AGE_13_OR_ABOVE = 0x0A , BT_AUDIO_PARENTAL_RATING_AGE_14_OR_ABOVE = 0x0B ,
  BT_AUDIO_PARENTAL_RATING_AGE_15_OR_ABOVE = 0x0C , BT_AUDIO_PARENTAL_RATING_AGE_16_OR_ABOVE = 0x0D , BT_AUDIO_PARENTAL_RATING_AGE_17_OR_ABOVE = 0x0E , BT_AUDIO_PARENTAL_RATING_AGE_18_OR_ABOVE = 0x0F
}
 Parental rating defined by the Generic Audio assigned numbers (bluetooth.com). More...
 
enum  bt_audio_active_state { BT_AUDIO_ACTIVE_STATE_DISABLED = 0x00 , BT_AUDIO_ACTIVE_STATE_ENABLED = 0x01 }
 Audio Active State defined by the Generic Audio assigned numbers (bluetooth.com). More...
 
enum  bt_audio_metadata_type {
  BT_AUDIO_METADATA_TYPE_PREF_CONTEXT = 0x01 , BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT = 0x02 , BT_AUDIO_METADATA_TYPE_PROGRAM_INFO = 0x03 , BT_AUDIO_METADATA_TYPE_STREAM_LANG = 0x04 ,
  BT_AUDIO_METADATA_TYPE_CCID_LIST = 0x05 , BT_AUDIO_METADATA_TYPE_PARENTAL_RATING = 0x06 , BT_AUDIO_METADATA_TYPE_PROGRAM_INFO_URI = 0x07 , BT_AUDIO_METADATA_TYPE_AUDIO_STATE = 0x08 ,
  BT_AUDIO_METADATA_TYPE_BROADCAST_IMMEDIATE = 0x09 , BT_AUDIO_METADATA_TYPE_EXTENDED = 0xFE , BT_AUDIO_METADATA_TYPE_VENDOR = 0xFF
}
 Codec metadata type IDs. More...
 
enum  bt_audio_location {
  BT_AUDIO_LOCATION_MONO_AUDIO = 0 , BT_AUDIO_LOCATION_FRONT_LEFT = BIT(0) , BT_AUDIO_LOCATION_FRONT_RIGHT = BIT(1) , BT_AUDIO_LOCATION_FRONT_CENTER = BIT(2) ,
  BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 = BIT(3) , BT_AUDIO_LOCATION_BACK_LEFT = BIT(4) , BT_AUDIO_LOCATION_BACK_RIGHT = BIT(5) , BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER = BIT(6) ,
  BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER = BIT(7) , BT_AUDIO_LOCATION_BACK_CENTER = BIT(8) , BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 = BIT(9) , BT_AUDIO_LOCATION_SIDE_LEFT = BIT(10) ,
  BT_AUDIO_LOCATION_SIDE_RIGHT = BIT(11) , BT_AUDIO_LOCATION_TOP_FRONT_LEFT = BIT(12) , BT_AUDIO_LOCATION_TOP_FRONT_RIGHT = BIT(13) , BT_AUDIO_LOCATION_TOP_FRONT_CENTER = BIT(14) ,
  BT_AUDIO_LOCATION_TOP_CENTER = BIT(15) , BT_AUDIO_LOCATION_TOP_BACK_LEFT = BIT(16) , BT_AUDIO_LOCATION_TOP_BACK_RIGHT = BIT(17) , BT_AUDIO_LOCATION_TOP_SIDE_LEFT = BIT(18) ,
  BT_AUDIO_LOCATION_TOP_SIDE_RIGHT = BIT(19) , BT_AUDIO_LOCATION_TOP_BACK_CENTER = BIT(20) , BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER = BIT(21) , BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT = BIT(22) ,
  BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT = BIT(23) , BT_AUDIO_LOCATION_FRONT_LEFT_WIDE = BIT(24) , BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE = BIT(25) , BT_AUDIO_LOCATION_LEFT_SURROUND = BIT(26) ,
  BT_AUDIO_LOCATION_RIGHT_SURROUND = BIT(27)
}
 Location values for BT Audio. More...
 
enum  bt_audio_dir { BT_AUDIO_DIR_SINK = 0x01 , BT_AUDIO_DIR_SOURCE = 0x02 }
 Audio Capability type. More...
 
enum  bt_audio_codec_qos_framing { BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED = 0x00 , BT_AUDIO_CODEC_QOS_FRAMING_FRAMED = 0x01 }
 Codec QoS Framing. More...
 
enum  { BT_AUDIO_CODEC_QOS_1M = BIT(0) , BT_AUDIO_CODEC_QOS_2M = BIT(1) , BT_AUDIO_CODEC_QOS_CODED = BIT(2) }
 Codec QoS Preferred PHY. More...
 

Functions

int bt_audio_data_parse (const uint8_t ltv[], size_t size, bool(*func)(struct bt_data *data, void *user_data), void *user_data)
 Helper for parsing length-type-value data.
 

Detailed Description

Bluetooth Audio.

Macro Definition Documentation

◆ BT_AUDIO_BROADCAST_CODE_SIZE

#define BT_AUDIO_BROADCAST_CODE_SIZE   16

◆ BT_AUDIO_BROADCAST_ID_MAX

#define BT_AUDIO_BROADCAST_ID_MAX   0xFFFFFFU

#include <zephyr/bluetooth/audio/audio.h>

Maximum broadcast ID value.

◆ BT_AUDIO_BROADCAST_ID_SIZE

#define BT_AUDIO_BROADCAST_ID_SIZE   3 /* octets */

◆ BT_AUDIO_CODEC_CAP

#define BT_AUDIO_CODEC_CAP (   _id,
  _cid,
  _vid,
  _data,
  _meta 
)

#include <zephyr/bluetooth/audio/audio.h>

Value:
((struct bt_audio_codec_cap){ \
/* Use HCI data path as default, can be overwritten by application */ \
.path_id = BT_ISO_DATA_PATH_HCI, \
.ctlr_transcode = false, \
.id = (_id), \
.cid = (_cid), \
.vid = (_vid), \
.data_len = sizeof((uint8_t[])_data), \
.data = _data, \
.meta_len = sizeof((uint8_t[])_meta), \
.meta = _meta, \
})
#define BT_ISO_DATA_PATH_HCI
Value to set the ISO data path over HCi.
Definition: iso.h:50
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Codec capability structure.
Definition: audio.h:550
uint16_t cid
Codec Company ID.
Definition: audio.h:566

Helper to declare Codec capability parsing APIs structure.

Parameters
_idCodec ID
_cidCompany ID
_vidVendor ID
_dataCodec Specific Data in LVT format
_metaCodec Specific Metadata in LVT format

◆ BT_AUDIO_CODEC_CAP_CHAN_COUNT_MAX

#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MAX   8

#include <zephyr/bluetooth/audio/audio.h>

Maximum supported channel counts.

◆ BT_AUDIO_CODEC_CAP_CHAN_COUNT_MIN

#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MIN   1

#include <zephyr/bluetooth/audio/audio.h>

Minimum supported channel counts.

◆ BT_AUDIO_CODEC_CAP_CHAN_COUNT_SUPPORT

#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_SUPPORT (   ...)     ((enum bt_audio_codec_cap_chan_count)((FOR_EACH(BIT, (|), __VA_ARGS__)) >> 1))

#include <zephyr/bluetooth/audio/audio.h>

Channel count support capability.

Macro accepts variable number of channel counts. The allowed channel counts are defined by specification and have to be in range from BT_AUDIO_CODEC_CAP_CHAN_COUNT_MIN to BT_AUDIO_CODEC_CAP_CHAN_COUNT_MAX inclusive.

Example to support 1 and 3 channels: BT_AUDIO_CODEC_CAP_CHAN_COUNT_SUPPORT(1, 3)

◆ BT_AUDIO_CODEC_CFG

#define BT_AUDIO_CODEC_CFG (   _id,
  _cid,
  _vid,
  _data,
  _meta 
)

#include <zephyr/bluetooth/audio/audio.h>

Value:
((struct bt_audio_codec_cfg){ \
/* Use HCI data path as default, can be overwritten by application */ \
.path_id = BT_ISO_DATA_PATH_HCI, \
.ctlr_transcode = false, \
.id = _id, \
.cid = _cid, \
.vid = _vid, \
.data_len = sizeof((uint8_t[])_data), \
.data = _data, \
.meta_len = sizeof((uint8_t[])_meta), \
.meta = _meta, \
})
Codec specific configuration structure.
Definition: audio.h:584

Helper to declare Codec config parsing APIs.

Parameters
_idCodec ID
_cidCompany ID
_vidVendor ID
_dataCodec Specific Data in LVT format
_metaCodec Specific Metadata in LVT format

◆ BT_AUDIO_CODEC_DATA

#define BT_AUDIO_CODEC_DATA (   _type,
  _bytes... 
)     (sizeof((uint8_t)_type) + sizeof((uint8_t[]){_bytes})), (_type), _bytes

#include <zephyr/bluetooth/audio/audio.h>

Helper to declare elements of bt_audio_codec_cap arrays.

This macro is mainly for creating an array of struct bt_audio_codec_cap data arrays.

Parameters
_typeType of advertising data field
_bytesVariable number of single-byte parameters

◆ BT_AUDIO_CODEC_QOS

#define BT_AUDIO_CODEC_QOS (   _interval,
  _framing,
  _phy,
  _sdu,
  _rtn,
  _latency,
  _pd 
)

#include <zephyr/bluetooth/audio/audio.h>

Value:
((struct bt_audio_codec_qos){ \
.interval = _interval, \
.framing = _framing, \
.phy = _phy, \
.sdu = _sdu, \
.rtn = _rtn, \
IF_ENABLED(UTIL_OR(IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SOURCE), \
IS_ENABLED(CONFIG_BT_BAP_UNICAST)), \
(.latency = _latency,)) \
.pd = _pd, \
})
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition: util_macro.h:124
#define UTIL_OR(a, b)
Like a || b, but does evaluation and short-circuiting at C preprocessor time.
Definition: util_macro.h:378
Codec QoS structure.
Definition: audio.h:704

Helper to declare elements of bt_audio_codec_qos.

Parameters
_intervalSDU interval (usec)
_framingFraming
_phyTarget PHY
_sduMaximum SDU Size
_rtnRetransmission number
_latencyMaximum Transport Latency (msec)
_pdPresentation Delay (usec)

◆ BT_AUDIO_CODEC_QOS_FRAMED

#define BT_AUDIO_CODEC_QOS_FRAMED (   _interval,
  _sdu,
  _rtn,
  _latency,
  _pd 
)

#include <zephyr/bluetooth/audio/audio.h>

Value:
_sdu, _rtn, _latency, _pd)
#define BT_AUDIO_CODEC_QOS(_interval, _framing, _phy, _sdu, _rtn, _latency, _pd)
Helper to declare elements of bt_audio_codec_qos.
Definition: audio.h:651
@ BT_AUDIO_CODEC_QOS_2M
Definition: audio.h:673
@ BT_AUDIO_CODEC_QOS_FRAMING_FRAMED
Definition: audio.h:667

Helper to declare Input Framed bt_audio_codec_qos.

Parameters
_intervalSDU interval (usec)
_sduMaximum SDU Size
_rtnRetransmission number
_latencyMaximum Transport Latency (msec)
_pdPresentation Delay (usec)

◆ BT_AUDIO_CODEC_QOS_PREF

#define BT_AUDIO_CODEC_QOS_PREF (   _unframed_supported,
  _phy,
  _rtn,
  _latency,
  _pd_min,
  _pd_max,
  _pref_pd_min,
  _pref_pd_max 
)

#include <zephyr/bluetooth/audio/audio.h>

Value:
{ \
.unframed_supported = _unframed_supported, \
.phy = _phy, \
.rtn = _rtn, \
.latency = _latency, \
.pd_min = _pd_min, \
.pd_max = _pd_max, \
.pref_pd_min = _pref_pd_min, \
.pref_pd_max = _pref_pd_max, \
}

Helper to declare elements of bt_audio_codec_qos_pref.

Parameters
_unframed_supportedUnframed PDUs supported
_phyPreferred Target PHY
_rtnPreferred Retransmission number
_latencyPreferred Maximum Transport Latency (msec)
_pd_minMinimum Presentation Delay (usec)
_pd_maxMaximum Presentation Delay (usec)
_pref_pd_minPreferred Minimum Presentation Delay (usec)
_pref_pd_maxPreferred Maximum Presentation Delay (usec)

◆ BT_AUDIO_CODEC_QOS_UNFRAMED

#define BT_AUDIO_CODEC_QOS_UNFRAMED (   _interval,
  _sdu,
  _rtn,
  _latency,
  _pd 
)

#include <zephyr/bluetooth/audio/audio.h>

Value:
_sdu, _rtn, _latency, _pd)
@ BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED
Definition: audio.h:666

Helper to declare Input Unframed bt_audio_codec_qos.

Parameters
_intervalSDU interval (usec)
_sduMaximum SDU Size
_rtnRetransmission number
_latencyMaximum Transport Latency (msec)
_pdPresentation Delay (usec)

◆ BT_AUDIO_CONTEXT_TYPE_ANY

#define BT_AUDIO_CONTEXT_TYPE_ANY

#include <zephyr/bluetooth/audio/audio.h>

Value:
@ BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS
Definition: audio.h:292
@ BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM
Definition: audio.h:295
@ BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL
Definition: audio.h:288
@ BT_AUDIO_CONTEXT_TYPE_RINGTONE
Definition: audio.h:293
@ BT_AUDIO_CONTEXT_TYPE_LIVE
Definition: audio.h:290
@ BT_AUDIO_CONTEXT_TYPE_MEDIA
Definition: audio.h:286
@ BT_AUDIO_CONTEXT_TYPE_GAME
Definition: audio.h:287
@ BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS
Definition: audio.h:291
@ BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS
Definition: audio.h:289
@ BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL
Definition: audio.h:285
@ BT_AUDIO_CONTEXT_TYPE_ALERTS
Definition: audio.h:294
@ BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED
Definition: audio.h:284

Any known context.

◆ BT_AUDIO_LOCATION_ANY

#define BT_AUDIO_LOCATION_ANY

#include <zephyr/bluetooth/audio/audio.h>

Value:
@ BT_AUDIO_LOCATION_FRONT_CENTER
Definition: audio.h:489
@ BT_AUDIO_LOCATION_TOP_BACK_LEFT
Definition: audio.h:503
@ BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2
Definition: audio.h:496
@ BT_AUDIO_LOCATION_TOP_SIDE_RIGHT
Definition: audio.h:506
@ BT_AUDIO_LOCATION_FRONT_RIGHT
Definition: audio.h:488
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT
Definition: audio.h:510
@ BT_AUDIO_LOCATION_BACK_RIGHT
Definition: audio.h:492
@ BT_AUDIO_LOCATION_TOP_CENTER
Definition: audio.h:502
@ BT_AUDIO_LOCATION_LEFT_SURROUND
Definition: audio.h:513
@ BT_AUDIO_LOCATION_TOP_FRONT_RIGHT
Definition: audio.h:500
@ BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER
Definition: audio.h:494
@ BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE
Definition: audio.h:512
@ BT_AUDIO_LOCATION_TOP_BACK_RIGHT
Definition: audio.h:504
@ BT_AUDIO_LOCATION_BACK_LEFT
Definition: audio.h:491
@ BT_AUDIO_LOCATION_RIGHT_SURROUND
Definition: audio.h:514
@ BT_AUDIO_LOCATION_SIDE_RIGHT
Definition: audio.h:498
@ BT_AUDIO_LOCATION_TOP_FRONT_LEFT
Definition: audio.h:499
@ BT_AUDIO_LOCATION_SIDE_LEFT
Definition: audio.h:497
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT
Definition: audio.h:509
@ BT_AUDIO_LOCATION_TOP_FRONT_CENTER
Definition: audio.h:501
@ BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1
Definition: audio.h:490
@ BT_AUDIO_LOCATION_FRONT_LEFT
Definition: audio.h:487
@ BT_AUDIO_LOCATION_FRONT_LEFT_WIDE
Definition: audio.h:511
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER
Definition: audio.h:508
@ BT_AUDIO_LOCATION_BACK_CENTER
Definition: audio.h:495
@ BT_AUDIO_LOCATION_TOP_SIDE_LEFT
Definition: audio.h:505
@ BT_AUDIO_LOCATION_TOP_BACK_CENTER
Definition: audio.h:507
@ BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER
Definition: audio.h:493

Any known location.

◆ BT_AUDIO_METADATA_TYPE_IS_KNOWN

#define BT_AUDIO_METADATA_TYPE_IS_KNOWN (   _type)

#include <zephyr/bluetooth/audio/audio.h>

Value:
@ BT_AUDIO_METADATA_TYPE_EXTENDED
Extended metadata.
Definition: audio.h:404
@ BT_AUDIO_METADATA_TYPE_VENDOR
Vendor specific metadata.
Definition: audio.h:407
@ BT_AUDIO_METADATA_TYPE_BROADCAST_IMMEDIATE
Broadcast Audio Immediate Rendering flag
Definition: audio.h:401
@ BT_AUDIO_METADATA_TYPE_PREF_CONTEXT
Preferred audio context.
Definition: audio.h:360
#define IN_RANGE(val, min, max)
Checks if a value is within range.
Definition: util.h:422

Helper to check whether metadata type is known by the stack.

Note
_type is evaluated thrice.

◆ BT_AUDIO_PD_MAX

#define BT_AUDIO_PD_MAX   0xFFFFFFU

#include <zephyr/bluetooth/audio/audio.h>

Maximum presentation delay in microseconds.

◆ BT_AUDIO_PD_PREF_NONE

#define BT_AUDIO_PD_PREF_NONE   0x000000U

#include <zephyr/bluetooth/audio/audio.h>

Indicates that the server have no preference for the presentation delay.

◆ BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL

#define BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL   0x00

◆ BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED

#define BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED   0x01

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <zephyr/bluetooth/audio/audio.h>

Codec QoS Preferred PHY.

Enumerator
BT_AUDIO_CODEC_QOS_1M 
BT_AUDIO_CODEC_QOS_2M 
BT_AUDIO_CODEC_QOS_CODED 

◆ bt_audio_active_state

#include <zephyr/bluetooth/audio/audio.h>

Audio Active State defined by the Generic Audio assigned numbers (bluetooth.com).

Enumerator
BT_AUDIO_ACTIVE_STATE_DISABLED 
BT_AUDIO_ACTIVE_STATE_ENABLED 

◆ bt_audio_codec_cap_chan_count

#include <zephyr/bluetooth/audio/audio.h>

Enumerator
BT_AUDIO_CODEC_CAP_CHAN_COUNT_1 

Supporting 1 channel.

BT_AUDIO_CODEC_CAP_CHAN_COUNT_2 

Supporting 2 channel.

BT_AUDIO_CODEC_CAP_CHAN_COUNT_3 

Supporting 3 channel.

BT_AUDIO_CODEC_CAP_CHAN_COUNT_4 

Supporting 4 channel.

BT_AUDIO_CODEC_CAP_CHAN_COUNT_5 

Supporting 5 channel.

BT_AUDIO_CODEC_CAP_CHAN_COUNT_6 

Supporting 6 channel.

BT_AUDIO_CODEC_CAP_CHAN_COUNT_7 

Supporting 7 channel.

BT_AUDIO_CODEC_CAP_CHAN_COUNT_8 

Supporting 8 channel.

BT_AUDIO_CODEC_CAP_CHAN_COUNT_ANY 

Supporting all channels.

◆ bt_audio_codec_cap_frame_dur

#include <zephyr/bluetooth/audio/audio.h>

Supported frame durations bitfield.

Enumerator
BT_AUDIO_CODEC_CAP_DURATION_7_5 

7.5 msec frame duration capability

BT_AUDIO_CODEC_CAP_DURATION_10 

10 msec frame duration capability

BT_AUDIO_CODEC_CAP_DURATION_ANY 

Any frame duration capability.

BT_AUDIO_CODEC_CAP_DURATION_PREFER_7_5 

7.5 msec preferred frame duration capability.

This shall only be set if BT_AUDIO_CODEC_CAP_DURATION_7_5 is also set, and if BT_AUDIO_CODEC_CAP_DURATION_PREFER_10 is not set.

BT_AUDIO_CODEC_CAP_DURATION_PREFER_10 

10 msec preferred frame duration capability

This shall only be set if BT_AUDIO_CODEC_CAP_DURATION_10 is also set, and if BT_AUDIO_CODEC_CAP_DURATION_PREFER_7_5 is not set.

◆ bt_audio_codec_cap_freq

#include <zephyr/bluetooth/audio/audio.h>

Supported frequencies bitfield.

Enumerator
BT_AUDIO_CODEC_CAP_FREQ_8KHZ 

8 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_11KHZ 

11.025 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_16KHZ 

16 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_22KHZ 

22.05 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_24KHZ 

24 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_32KHZ 

32 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_44KHZ 

44.1 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_48KHZ 

48 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_88KHZ 

88.2 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_96KHZ 

96 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_176KHZ 

176.4 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_192KHZ 

192 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_384KHZ 

384 Khz sampling frequency

BT_AUDIO_CODEC_CAP_FREQ_ANY 

Any frequency capability.

◆ bt_audio_codec_cap_type

#include <zephyr/bluetooth/audio/audio.h>

Codec capability types.

Used to build and parse codec capabilities as specified in the PAC specification. Source is assigned numbers for Generic Audio, bluetooth.com.

Enumerator
BT_AUDIO_CODEC_CAP_TYPE_FREQ 

Supported sampling frequencies.

BT_AUDIO_CODEC_CAP_TYPE_DURATION 

Supported frame durations.

BT_AUDIO_CODEC_CAP_TYPE_CHAN_COUNT 

Supported audio channel counts.

BT_AUDIO_CODEC_CAP_TYPE_FRAME_LEN 

Supported octets per codec frame.

BT_AUDIO_CODEC_CAP_TYPE_FRAME_COUNT 

Supported maximum codec frames per SDU

◆ bt_audio_codec_cfg_frame_dur

#include <zephyr/bluetooth/audio/audio.h>

Enumerator
BT_AUDIO_CODEC_CFG_DURATION_7_5 

7.5 msec Frame Duration configuration

BT_AUDIO_CODEC_CFG_DURATION_10 

10 msec Frame Duration configuration

◆ bt_audio_codec_cfg_freq

#include <zephyr/bluetooth/audio/audio.h>

Enumerator
BT_AUDIO_CODEC_CFG_FREQ_8KHZ 

8 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_11KHZ 

11.025 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_16KHZ 

16 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_22KHZ 

22.05 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_24KHZ 

24 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_32KHZ 

32 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_44KHZ 

44.1 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_48KHZ 

48 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_88KHZ 

88.2 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_96KHZ 

96 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_176KHZ 

176.4 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_192KHZ 

192 Khz codec sampling frequency

BT_AUDIO_CODEC_CFG_FREQ_384KHZ 

384 Khz codec sampling frequency

◆ bt_audio_codec_cfg_type

#include <zephyr/bluetooth/audio/audio.h>

Codec configuration types.

Used to build and parse codec configurations as specified in the ASCS and BAP specifications. Source is assigned numbers for Generic Audio, bluetooth.com.

Enumerator
BT_AUDIO_CODEC_CFG_FREQ 

Sampling frequency.

BT_AUDIO_CODEC_CFG_DURATION 

Frame duration.

BT_AUDIO_CODEC_CFG_CHAN_ALLOC 

Audio channel allocation.

BT_AUDIO_CODEC_CFG_FRAME_LEN 

Octets per codec frame.

BT_AUDIO_CODEC_CFG_FRAME_BLKS_PER_SDU 

Codec frame blocks per SDU.

◆ bt_audio_codec_qos_framing

#include <zephyr/bluetooth/audio/audio.h>

Codec QoS Framing.

Enumerator
BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED 
BT_AUDIO_CODEC_QOS_FRAMING_FRAMED 

◆ bt_audio_context

#include <zephyr/bluetooth/audio/audio.h>

Audio Context Type for Generic Audio.

These values are defined by the Generic Audio Assigned Numbers, bluetooth.com

Enumerator
BT_AUDIO_CONTEXT_TYPE_PROHIBITED 
BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED 
BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL 
BT_AUDIO_CONTEXT_TYPE_MEDIA 
BT_AUDIO_CONTEXT_TYPE_GAME 
BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL 
BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS 
BT_AUDIO_CONTEXT_TYPE_LIVE 
BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS 
BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS 
BT_AUDIO_CONTEXT_TYPE_RINGTONE 
BT_AUDIO_CONTEXT_TYPE_ALERTS 
BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM 

◆ bt_audio_dir

#include <zephyr/bluetooth/audio/audio.h>

Audio Capability type.

Enumerator
BT_AUDIO_DIR_SINK 
BT_AUDIO_DIR_SOURCE 

◆ bt_audio_location

#include <zephyr/bluetooth/audio/audio.h>

Location values for BT Audio.

These values are defined by the Generic Audio Assigned Numbers, bluetooth.com

Enumerator
BT_AUDIO_LOCATION_MONO_AUDIO 
BT_AUDIO_LOCATION_FRONT_LEFT 
BT_AUDIO_LOCATION_FRONT_RIGHT 
BT_AUDIO_LOCATION_FRONT_CENTER 
BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 
BT_AUDIO_LOCATION_BACK_LEFT 
BT_AUDIO_LOCATION_BACK_RIGHT 
BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER 
BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER 
BT_AUDIO_LOCATION_BACK_CENTER 
BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 
BT_AUDIO_LOCATION_SIDE_LEFT 
BT_AUDIO_LOCATION_SIDE_RIGHT 
BT_AUDIO_LOCATION_TOP_FRONT_LEFT 
BT_AUDIO_LOCATION_TOP_FRONT_RIGHT 
BT_AUDIO_LOCATION_TOP_FRONT_CENTER 
BT_AUDIO_LOCATION_TOP_CENTER 
BT_AUDIO_LOCATION_TOP_BACK_LEFT 
BT_AUDIO_LOCATION_TOP_BACK_RIGHT 
BT_AUDIO_LOCATION_TOP_SIDE_LEFT 
BT_AUDIO_LOCATION_TOP_SIDE_RIGHT 
BT_AUDIO_LOCATION_TOP_BACK_CENTER 
BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER 
BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT 
BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT 
BT_AUDIO_LOCATION_FRONT_LEFT_WIDE 
BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE 
BT_AUDIO_LOCATION_LEFT_SURROUND 
BT_AUDIO_LOCATION_RIGHT_SURROUND 

◆ bt_audio_metadata_type

#include <zephyr/bluetooth/audio/audio.h>

Codec metadata type IDs.

Metadata types defined by the Generic Audio assigned numbers (bluetooth.com).

Enumerator
BT_AUDIO_METADATA_TYPE_PREF_CONTEXT 

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.
BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT 

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.
BT_AUDIO_METADATA_TYPE_PROGRAM_INFO 

UTF-8 encoded title or summary of stream content.

BT_AUDIO_METADATA_TYPE_STREAM_LANG 

Stream language.

   3 octet lower case language code defined by ISO 639-3
BT_AUDIO_METADATA_TYPE_CCID_LIST 

Array of 8-bit CCID values.

BT_AUDIO_METADATA_TYPE_PARENTAL_RATING 

Parental rating.

   See @ref bt_audio_parental_rating for valid values.
BT_AUDIO_METADATA_TYPE_PROGRAM_INFO_URI 

UTF-8 encoded URI for additional Program information.

BT_AUDIO_METADATA_TYPE_AUDIO_STATE 

Audio active state.

   See @ref bt_audio_active_state for valid values.
BT_AUDIO_METADATA_TYPE_BROADCAST_IMMEDIATE 

Broadcast Audio Immediate Rendering flag

BT_AUDIO_METADATA_TYPE_EXTENDED 

Extended metadata.

BT_AUDIO_METADATA_TYPE_VENDOR 

Vendor specific metadata.

◆ bt_audio_parental_rating

#include <zephyr/bluetooth/audio/audio.h>

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.

Enumerator
BT_AUDIO_PARENTAL_RATING_NO_RATING 
BT_AUDIO_PARENTAL_RATING_AGE_ANY 
BT_AUDIO_PARENTAL_RATING_AGE_5_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_6_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_7_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_8_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_9_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_11_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_12_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_13_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_14_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_15_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_16_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_17_OR_ABOVE 
BT_AUDIO_PARENTAL_RATING_AGE_18_OR_ABOVE 

Function Documentation

◆ bt_audio_data_parse()

int bt_audio_data_parse ( const uint8_t  ltv[],
size_t  size,
bool(*)(struct bt_data *data, void *user_data)  func,
void *  user_data 
)

#include <zephyr/bluetooth/audio/audio.h>

Helper for parsing length-type-value data.

Parameters
ltvLength-type-value (LTV) encoded data.
sizeSize of the ltv data.
funcCallback function which will be called for each element that's found in the data. The callback should return true to continue parsing, or false to stop parsing.
user_dataUser data to be passed to the callback.
Return values
0if all entries were parsed.
-EINVALif the data is incorrectly encoded
-ECANCELEDif parsing was prematurely cancelled by the callback