Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
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 to hold minimum and maximum supported codec frame sizes More... | |
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 |
Size of the broadcast ID in 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 |
Maximum size of the broadcast code in octets. | |
#define | BT_AUDIO_BROADCAST_NAME_LEN_MIN 4 |
The minimum size of a Broadcast Name as defined by Bluetooth Assigned Numbers. | |
#define | BT_AUDIO_BROADCAST_NAME_LEN_MAX 128 |
The maximum size of a Broadcast Name as defined by Bluetooth Assigned Numbers. | |
#define | BT_AUDIO_LANG_SIZE 3 |
Size of the stream language value, e.g. | |
#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_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. | |
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. | |
uint8_t | bt_audio_get_chan_count (enum bt_audio_location chan_allocation) |
Function to get the number of channels from the channel allocation. | |
Unicast Announcement Type | |
#define | BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL 0x00 |
Unicast Server is connectable and is requesting a connection. | |
#define | BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED 0x01 |
Unicast Server is connectable but is not requesting a connection. | |
Bluetooth Audio.
#define BT_AUDIO_BROADCAST_CODE_SIZE 16 |
#include <zephyr/bluetooth/audio/audio.h>
Maximum size of the broadcast code in octets.
#define BT_AUDIO_BROADCAST_ID_MAX 0xFFFFFFU |
#include <zephyr/bluetooth/audio/audio.h>
Maximum broadcast ID value.
#define BT_AUDIO_BROADCAST_ID_SIZE 3 |
#include <zephyr/bluetooth/audio/audio.h>
Size of the broadcast ID in octets.
#define BT_AUDIO_BROADCAST_NAME_LEN_MAX 128 |
#include <zephyr/bluetooth/audio/audio.h>
The maximum size of a Broadcast Name as defined by Bluetooth Assigned Numbers.
#define BT_AUDIO_BROADCAST_NAME_LEN_MIN 4 |
#include <zephyr/bluetooth/audio/audio.h>
The minimum size of a Broadcast Name as defined by Bluetooth Assigned Numbers.
#define BT_AUDIO_CODEC_CAP | ( | _id, | |
_cid, | |||
_vid, | |||
_data, | |||
_meta | |||
) |
#include <zephyr/bluetooth/audio/audio.h>
Helper to declare Codec capability parsing APIs structure.
_id | Codec ID |
_cid | Company ID |
_vid | Vendor ID |
_data | Codec Specific Data in LVT format |
_meta | Codec Specific Metadata in LVT format |
#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MAX 8 |
#include <zephyr/bluetooth/audio/audio.h>
Maximum supported channel counts.
#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MIN 1 |
#include <zephyr/bluetooth/audio/audio.h>
Minimum supported channel counts.
#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)
#define BT_AUDIO_CODEC_CFG | ( | _id, | |
_cid, | |||
_vid, | |||
_data, | |||
_meta | |||
) |
#include <zephyr/bluetooth/audio/audio.h>
Helper to declare Codec config parsing APIs.
_id | Codec ID |
_cid | Company ID |
_vid | Vendor ID |
_data | Codec Specific Data in LVT format |
_meta | Codec Specific Metadata in LVT format |
#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.
_type | Type of advertising data field |
_bytes | Variable number of single-byte parameters |
#define BT_AUDIO_CODEC_QOS | ( | _interval, | |
_framing, | |||
_phy, | |||
_sdu, | |||
_rtn, | |||
_latency, | |||
_pd | |||
) |
#include <zephyr/bluetooth/audio/audio.h>
Helper to declare elements of bt_audio_codec_qos.
_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) |
#define BT_AUDIO_CODEC_QOS_FRAMED | ( | _interval, | |
_sdu, | |||
_rtn, | |||
_latency, | |||
_pd | |||
) |
#include <zephyr/bluetooth/audio/audio.h>
Helper to declare Input Framed bt_audio_codec_qos.
_interval | SDU interval (usec) |
_sdu | Maximum SDU Size |
_rtn | Retransmission number |
_latency | Maximum Transport Latency (msec) |
_pd | Presentation Delay (usec) |
#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>
Helper to declare elements of bt_audio_codec_qos_pref.
_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) |
#define BT_AUDIO_CODEC_QOS_UNFRAMED | ( | _interval, | |
_sdu, | |||
_rtn, | |||
_latency, | |||
_pd | |||
) |
#include <zephyr/bluetooth/audio/audio.h>
Helper to declare Input Unframed bt_audio_codec_qos.
_interval | SDU interval (usec) |
_sdu | Maximum SDU Size |
_rtn | Retransmission number |
_latency | Maximum Transport Latency (msec) |
_pd | Presentation Delay (usec) |
#define BT_AUDIO_CONTEXT_TYPE_ANY |
#include <zephyr/bluetooth/audio/audio.h>
Any known context.
#define BT_AUDIO_LANG_SIZE 3 |
#define BT_AUDIO_LOCATION_ANY |
#include <zephyr/bluetooth/audio/audio.h>
Any known location.
#define BT_AUDIO_METADATA_TYPE_IS_KNOWN | ( | _type | ) |
#include <zephyr/bluetooth/audio/audio.h>
Helper to check whether metadata type is known by the stack.
_type
is evaluated thrice. #define BT_AUDIO_PD_MAX 0xFFFFFFU |
#include <zephyr/bluetooth/audio/audio.h>
Maximum presentation delay in microseconds.
#define BT_AUDIO_PD_PREF_NONE 0x000000U |
#include <zephyr/bluetooth/audio/audio.h>
Indicates that the server have no preference for the presentation delay.
#define BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL 0x00 |
#include <zephyr/bluetooth/audio/audio.h>
Unicast Server is connectable and is requesting a connection.
#define BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED 0x01 |
#include <zephyr/bluetooth/audio/audio.h>
Unicast Server is connectable but is not requesting a connection.
anonymous enum |
#include <zephyr/bluetooth/audio/audio.h>
Codec QoS Preferred PHY.
Enumerator | |
---|---|
BT_AUDIO_CODEC_QOS_1M | LE 1M PHY. |
BT_AUDIO_CODEC_QOS_2M | LE 2M PHY. |
BT_AUDIO_CODEC_QOS_CODED | LE Coded PHY. |
#include <zephyr/bluetooth/audio/audio.h>
Audio Active State defined by the Generic Audio assigned numbers (bluetooth.com).
Enumerator | |
---|---|
BT_AUDIO_ACTIVE_STATE_DISABLED | No audio data is being transmitted. |
BT_AUDIO_ACTIVE_STATE_ENABLED | Audio data is being transmitted. |
#include <zephyr/bluetooth/audio/audio.h>
Supported audio capabilities channel count bitfield.
#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. |
#include <zephyr/bluetooth/audio/audio.h>
Supported frequencies bitfield.
#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.
#include <zephyr/bluetooth/audio/audio.h>
Codec configuration frame duration.
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 |
#include <zephyr/bluetooth/audio/audio.h>
Codec configuration sampling freqency.
#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.
#include <zephyr/bluetooth/audio/audio.h>
Codec QoS Framing.
Enumerator | |
---|---|
BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED | Packets may be framed or unframed. |
BT_AUDIO_CODEC_QOS_FRAMING_FRAMED | Packets are always framed. |
enum 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
enum bt_audio_dir |
#include <zephyr/bluetooth/audio/audio.h>
Audio direction from the perspective of the BAP Unicast Server / BAP Broadcast Sink.
enum 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
#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_LANG | Language. 3 octet lower case language code defined by ISO 639-3 Possible values can be found at https://iso639-3.sil.org/code_tables/639/data |
BT_AUDIO_METADATA_TYPE_CCID_LIST | Array of 8-bit CCID values. |
BT_AUDIO_METADATA_TYPE_PARENTAL_RATING | Parental rating. See 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 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. |
#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.
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.
ltv | Length-type-value (LTV) encoded data. |
size | Size of the ltv data. |
func | Callback 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_data | User data to be passed to the callback. |
0 | if all entries were parsed. |
-EINVAL | if the data is incorrectly encoded |
-ECANCELED | if parsing was prematurely cancelled by the callback |
uint8_t bt_audio_get_chan_count | ( | enum bt_audio_location | chan_allocation | ) |
#include <zephyr/bluetooth/audio/audio.h>
Function to get the number of channels from the channel allocation.
chan_allocation | The channel allocation |