Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
Bluetooth Audio. More...
Modules | |
Assigned numbers to string API | |
Assigned numbers to string API. | |
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... | |
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_RTN_PREF_NONE 0xFFU |
Indicates that the unicast server does not have a preference for any retransmission number. | |
#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. | |
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. | |
int | bt_audio_data_get_val (const uint8_t ltv_data[], size_t size, uint8_t type, const uint8_t **data) |
Get the value of a specific data type in an length-type-value data array. | |
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_ID_MAX 0xFFFFFFU |
#include <include/zephyr/bluetooth/audio/audio.h>
Maximum broadcast ID value.
#define BT_AUDIO_BROADCAST_ID_SIZE 3 |
#include <include/zephyr/bluetooth/audio/audio.h>
Size of the broadcast ID in octets.
#define BT_AUDIO_BROADCAST_NAME_LEN_MAX 128 |
#include <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 <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 <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 <include/zephyr/bluetooth/audio/audio.h>
Maximum supported channel counts.
#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MIN 1 |
#include <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 <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 <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 <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_CONTEXT_TYPE_ANY |
#include <include/zephyr/bluetooth/audio/audio.h>
Any known context.
#define BT_AUDIO_LANG_SIZE 3 |
#define BT_AUDIO_LOCATION_ANY |
#include <include/zephyr/bluetooth/audio/audio.h>
Any known location.
#define BT_AUDIO_METADATA_TYPE_IS_KNOWN | ( | _type | ) |
#include <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 <include/zephyr/bluetooth/audio/audio.h>
Maximum presentation delay in microseconds.
#define BT_AUDIO_PD_PREF_NONE 0x000000U |
#include <include/zephyr/bluetooth/audio/audio.h>
Indicates that the server have no preference for the presentation delay.
#define BT_AUDIO_RTN_PREF_NONE 0xFFU |
#include <include/zephyr/bluetooth/audio/audio.h>
Indicates that the unicast server does not have a preference for any retransmission number.
#define BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL 0x00 |
#include <include/zephyr/bluetooth/audio/audio.h>
Unicast Server is connectable and is requesting a connection.
#define BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED 0x01 |
#include <include/zephyr/bluetooth/audio/audio.h>
Unicast Server is connectable but is not requesting a connection.
#include <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 <include/zephyr/bluetooth/audio/audio.h>
Assisted Listening Stream defined by the Generic Audio assigned numbers (bluetooth.com).
Enumerator | |
---|---|
BT_AUDIO_ASSISTED_LISTENING_STREAM_UNSPECIFIED | Unspecified audio enhancement. |
#include <include/zephyr/bluetooth/audio/audio.h>
Supported audio capabilities channel count bitfield.
#include <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 <include/zephyr/bluetooth/audio/audio.h>
Supported frequencies bitfield.
#include <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 <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 <include/zephyr/bluetooth/audio/audio.h>
Codec configuration sampling freqency.
#include <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.
enum bt_audio_context |
#include <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 <include/zephyr/bluetooth/audio/audio.h>
Audio direction from the perspective of the BAP Unicast Server / BAP Broadcast Sink.
enum bt_audio_location |
#include <include/zephyr/bluetooth/audio/audio.h>
Location values for BT Audio.
These values are defined by the Generic Audio Assigned Numbers, bluetooth.com
#include <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_ASSISTED_LISTENING_STREAM | Assisted listening stream. See bt_audio_assisted_listening_stream for valid values. |
BT_AUDIO_METADATA_TYPE_BROADCAST_NAME | UTF-8 encoded Broadcast name. |
BT_AUDIO_METADATA_TYPE_EXTENDED | Extended metadata. |
BT_AUDIO_METADATA_TYPE_VENDOR | Vendor specific metadata. |
#include <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_get_val | ( | const uint8_t | ltv_data[], |
size_t | size, | ||
uint8_t | type, | ||
const uint8_t ** | data | ||
) |
#include <include/zephyr/bluetooth/audio/audio.h>
Get the value of a specific data type in an length-type-value data array.
[in] | ltv_data | The array containing the length-type-value tuples |
[in] | size | The size of ltv_data |
[in] | type | The type to get the value for. May be any type, but typically either bt_audio_codec_cap_type, bt_audio_codec_cfg_type or bt_audio_metadata_type. |
[out] | data | Pointer to the data-pointer to update when item is found. Any found data will be little endian. |
Length | The length of found data (may be 0). |
-EINVAL | if arguments are invalid |
-ENODATA | if not found |
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 <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 <include/zephyr/bluetooth/audio/audio.h>
Function to get the number of channels from the channel allocation.
chan_allocation | The channel allocation |