xref: /btstack/src/le-audio/le_audio.h (revision d21278d067fcdee1c95bdf85b9ac56975680f804)
15deb0bb6SMatthias Ringwald /*
25deb0bb6SMatthias Ringwald  * Copyright (C) 2022 BlueKitchen GmbH
35deb0bb6SMatthias Ringwald  *
45deb0bb6SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
55deb0bb6SMatthias Ringwald  * modification, are permitted provided that the following conditions
65deb0bb6SMatthias Ringwald  * are met:
75deb0bb6SMatthias Ringwald  *
85deb0bb6SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
95deb0bb6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
105deb0bb6SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
115deb0bb6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
125deb0bb6SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
135deb0bb6SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
145deb0bb6SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
155deb0bb6SMatthias Ringwald  *    from this software without specific prior written permission.
165deb0bb6SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
175deb0bb6SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
185deb0bb6SMatthias Ringwald  *    monetary gain.
195deb0bb6SMatthias Ringwald  *
205deb0bb6SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
215deb0bb6SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
225deb0bb6SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
235deb0bb6SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
245deb0bb6SMatthias Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
255deb0bb6SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
265deb0bb6SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
275deb0bb6SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
285deb0bb6SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
295deb0bb6SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
305deb0bb6SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
315deb0bb6SMatthias Ringwald  * SUCH DAMAGE.
325deb0bb6SMatthias Ringwald  *
335deb0bb6SMatthias Ringwald  * Please inquire about commercial licensing options at
345deb0bb6SMatthias Ringwald  * [email protected]
355deb0bb6SMatthias Ringwald  *
365deb0bb6SMatthias Ringwald  */
375deb0bb6SMatthias Ringwald 
385deb0bb6SMatthias Ringwald /**
395deb0bb6SMatthias Ringwald  * @title Volume Offset Control Service Server
405deb0bb6SMatthias Ringwald  *
415deb0bb6SMatthias Ringwald  */
425deb0bb6SMatthias Ringwald 
435deb0bb6SMatthias Ringwald #ifndef LE_AUDIO_H
445deb0bb6SMatthias Ringwald #define LE_AUDIO_H
455deb0bb6SMatthias Ringwald 
465deb0bb6SMatthias Ringwald #include <stdint.h>
475deb0bb6SMatthias Ringwald 
485deb0bb6SMatthias Ringwald #include "bluetooth.h"
495deb0bb6SMatthias Ringwald 
505deb0bb6SMatthias Ringwald #if defined __cplusplus
515deb0bb6SMatthias Ringwald extern "C" {
525deb0bb6SMatthias Ringwald #endif
535deb0bb6SMatthias Ringwald 
545deb0bb6SMatthias Ringwald #define LE_AUDIO_MAX_CODEC_CONFIG_SIZE                          19
555deb0bb6SMatthias Ringwald #define LE_CCIDS_MAX_NUM                                        10
565deb0bb6SMatthias Ringwald 
575deb0bb6SMatthias Ringwald #define LE_AUDIO_PROGRAM_INFO_MAX_LENGTH                        20
585deb0bb6SMatthias Ringwald #define LE_AUDIO_PROGRAM_INFO_URI_MAX_LENGTH                    20
595deb0bb6SMatthias Ringwald #define LE_AUDIO_EXTENDED_METADATA_MAX_LENGHT                   20
605deb0bb6SMatthias Ringwald #define LE_AUDIO_VENDOR_SPECIFIC_METADATA_MAX_LENGTH            20
615deb0bb6SMatthias Ringwald 
625deb0bb6SMatthias Ringwald // Generic Audio/Audio Location Definitions/Bitmap
635deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_NOT_ALLOWED                   0x00000000
645deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_FRONT_LEFT                    0x00000001
655deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_FRONT_RIGHT                   0x00000002
665deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_FRONT_CENTER                  0x00000004
675deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_LOW_FREQUENCY_EFFECTS1        0x00000008
685deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_BACK_LEFT                     0x00000010
695deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_BACK_RIGHT                    0x00000020
705deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_FRONT_LEFT_OF_CENTER          0x00000040
715deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_FRONT_RIGHT_OF_CENTER         0x00000080
725deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_BACK_CENTER                   0x00000100
735deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_LOW_FREQUENCY_EFFECTS2        0x00000200
745deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_SIDE_LEFT                     0x00000400
755deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_SIDE_RIGHT                    0x00000800
765deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_TOP_FRONT_LEFT                0x00001000
775deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_TOP_FRONT_RIGHT               0x00002000
785deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_TOP_FRONT_CENTER              0x00004000
795deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_TOP_CENTER                    0x00008000
805deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_TOP_BACK_LEFT                 0x00010000
815deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_TOP_BACK_RIGHT                0x00020000
825deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_TOP_SIDE_LEFT                 0x00040000
835deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_TOP_SIDE_RIGHT                0x00080000
845deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_TOP_BACK_CENTER               0x00100000
855deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_BOTTOM_FRONT_CENTER           0x00200000
865deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_BOTTOM_FRONT_LEFT             0x00400000
875deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_BOTTOM_FRONT_RIGHT            0x00800000
885deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_FRONT_LEFT_WIDE               0x01000000
895deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_FRONT_RIGHT_WIDE              0x02000000
905deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_LEFT_SURROUND                 0x04000000
915deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_RIGHT_SURROUND                0x08000000
925deb0bb6SMatthias Ringwald #define LE_AUDIO_LOCATION_MASK_RFU                           0xF0000000
935deb0bb6SMatthias Ringwald 
945deb0bb6SMatthias Ringwald // Generic Audio/Context Mask
955deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_PROHIBITED                0x0000
965deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_UNSPECIFIED               0x0001
975deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_CONVERSATIONAL            0x0002 // Conversation between humans, for example, in telephony or video calls, including traditional cellular as well as VoIP and Push-to-Talk
985deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_MEDIA                     0x0004 // Media, for example, music playback, radio, podcast or movie soundtrack, or tv audio
995deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_GAME                      0x0008 // Audio associated with video gaming, for example gaming media; gaming effects; music and in-game voice chat between participants; or a mix of all the above
1005deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_INSTRUCTIONAL             0x0010 // Instructional audio, for example, in navigation, announcements, or user guidance
1015deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_VOICE_ASSISTANTS          0x0020 // Man-machine communication, for example, with voice recognition or virtual assistants
1025deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_LIVE                      0x0040 // Live audio, for example, from a microphone where audio is perceived both through a direct acoustic path and through an LE Audio Stream
1035deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_SOUND_EFFECTS             0x0080 // Sound effects including keyboard and touch feedback; menu and user interface sounds; and other system sounds
1045deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_NOTIFICATIONS             0x0100 // Notification and reminder sounds; attention-seeking audio, for example, in beeps signaling the arrival of a message
1055deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_RINGTONE                  0x0200 // Alerts the user to an incoming call, for example, an incoming telephony or video call, including traditional cellular as well as VoIP and Push-to-Talk
1065deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_ALERTS                    0x0400 // Alarms and timers; immediate alerts, for example, in a critical battery alarm, timer expiry or alarm clock, toaster, cooker, kettle, microwave, etc.
1075deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_EMERGENCY_ALARM           0x0800 // Emergency alarm Emergency sounds, for example, fire alarms or other urgent alerts
108*d21278d0SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_ANY                       0x0FFF // Combination of all above
1095deb0bb6SMatthias Ringwald #define LE_AUDIO_CONTEXT_MASK_RFU                       0xF000
1105deb0bb6SMatthias Ringwald 
1115deb0bb6SMatthias Ringwald #define LE_AUDIO_OTC_MIN_OBJECT_ID_VALUE                0x000000000100
1125deb0bb6SMatthias Ringwald #define LE_AUDIO_OTC_MAX_OBJECT_ID_VALUE                0xFFFFFFFFFFFF
1135deb0bb6SMatthias Ringwald 
1145deb0bb6SMatthias Ringwald // ASCS: Framing for Codec Configured State
1155deb0bb6SMatthias Ringwald #define LE_AUDIO_UNFRAMED_ISOAL_MASK_PDUS_SUPPORTED             0x00
1165deb0bb6SMatthias Ringwald #define LE_AUDIO_UNFRAMED_ISOAL_MASK_PDUS_NOT_SUPPORTED         0x01
1175deb0bb6SMatthias Ringwald 
1185deb0bb6SMatthias Ringwald // ASCS: Server responds with bitmap values: PHY Bitmap for Codec Configured State
1195deb0bb6SMatthias Ringwald #define LE_AUDIO_SERVER_PHY_MASK_NO_PREFERENCE                         0x00
1205deb0bb6SMatthias Ringwald #define LE_AUDIO_SERVER_PHY_MASK_1M                                    0x01
1215deb0bb6SMatthias Ringwald #define LE_AUDIO_SERVER_PHY_MASK_2M                                    0x02
1225deb0bb6SMatthias Ringwald #define LE_AUDIO_SERVER_PHY_MASK_CODED                                 0x04
1235deb0bb6SMatthias Ringwald 
1245deb0bb6SMatthias Ringwald // ASCS: Latency for Codec Configured State
1255deb0bb6SMatthias Ringwald #define LE_AUDIO_SERVER_LATENCY_MASK_NO_PREFERENCE                     0x00
1265deb0bb6SMatthias Ringwald #define LE_AUDIO_SERVER_LATENCY_MASK_LOW                               0x01
1275deb0bb6SMatthias Ringwald #define LE_AUDIO_SERVER_LATENCY_MASK_BALANCED                          0x02
1285deb0bb6SMatthias Ringwald #define LE_AUDIO_SERVER_LATENCY_MASK_HIGH                              0x04
1295deb0bb6SMatthias Ringwald 
1305deb0bb6SMatthias Ringwald typedef enum {
1315deb0bb6SMatthias Ringwald     LE_AUDIO_ROLE_SINK = 0,
132ba1b4810SMilanka Ringwald     LE_AUDIO_ROLE_SOURCE,
133ba1b4810SMilanka Ringwald     LE_AUDIO_ROLE_INVALID
1345deb0bb6SMatthias Ringwald } le_audio_role_t;
1355deb0bb6SMatthias Ringwald 
1365deb0bb6SMatthias Ringwald // GA Codec_Specific_Configuration LTV structures
1375deb0bb6SMatthias Ringwald typedef enum {
1385deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CONFIGURATION_TYPE_UNDEFINED = 0x00,
1395deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CONFIGURATION_TYPE_SAMPLING_FREQUENCY = 0x01,
1405deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CONFIGURATION_TYPE_FRAME_DURATION,
1415deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CONFIGURATION_TYPE_AUDIO_CHANNEL_ALLOCATION,
1425deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CONFIGURATION_TYPE_OCTETS_PER_CODEC_FRAME,
1435deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CONFIGURATION_TYPE_CODEC_FRAME_BLOCKS_PER_SDU,
1445deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CONFIGURATION_TYPE_RFU
1455deb0bb6SMatthias Ringwald } le_audio_codec_configuration_type_t;
1465deb0bb6SMatthias Ringwald 
1475deb0bb6SMatthias Ringwald typedef enum {
148282847c2SMatthias Ringwald     LE_AUDIO_CODEC_CAPABILITY_TYPE_UNDEFINED = 0x00,
1495deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CAPABILITY_TYPE_SAMPLING_FREQUENCY = 0x01,
1505deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CAPABILITY_TYPE_FRAME_DURATION,
1515deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CAPABILITY_TYPE_SUPPORTED_AUDIO_CHANNEL_COUNTS,
1525deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CAPABILITY_TYPE_OCTETS_PER_CODEC_FRAME,
1535deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CAPABILITY_TYPE_CODEC_FRAME_BLOCKS_PER_SDU,
1545deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_CAPABILITY_TYPE_RFU
1555deb0bb6SMatthias Ringwald } le_audio_codec_capability_type_t;
1565deb0bb6SMatthias Ringwald 
1575deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_8000_HZ      0x0001
1585deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_11025_HZ     0x0002
1595deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_16000_HZ     0x0004
1605deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_22050_HZ     0x0008
1615deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_24000_HZ     0x0010
1625deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_32000_HZ     0x0020
1635deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_44100_HZ     0x0040
1645deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_48000_HZ     0x0080
1655deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_88200_HZ     0x0100
1665deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_96000_HZ     0x0200
1675deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_176400_HZ    0x0400
1685deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_192000_HZ    0x0800
1695deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_SAMPLING_FREQUENCY_MASK_384000_HZ    0x1000
1705deb0bb6SMatthias Ringwald 
1715deb0bb6SMatthias Ringwald typedef enum {
1725deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_INVALID = 0x00,
1735deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_8000_HZ,
1745deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_11025_HZ,
1755deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_16000_HZ,
1765deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_22050_HZ,
1775deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_24000_HZ,
1785deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_32000_HZ,
1795deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_44100_HZ,
1805deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_48000_HZ,
1815deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_88200_HZ,
1825deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_96000_HZ,
1835deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_176400_HZ,
1845deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_192000_HZ,
1855deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_384000_HZ,
1865deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_SAMPLING_FREQUENCY_INDEX_RFU
1875deb0bb6SMatthias Ringwald } le_audio_codec_sampling_frequency_index_t;
1885deb0bb6SMatthias Ringwald 
189c2a9c030SMatthias Ringwald #define LE_AUDIO_CODEC_FRAME_DURATION_MASK_7500US               0x01
190c2a9c030SMatthias Ringwald #define LE_AUDIO_CODEC_FRAME_DURATION_MASK_10000US              0x02
191c2a9c030SMatthias Ringwald #define LE_AUDIO_CODEC_FRAME_DURATION_MASK_7500US_PREFERRED     0x10
192c2a9c030SMatthias Ringwald #define LE_AUDIO_CODEC_FRAME_DURATION_MASK_10000US_PREFERRED    0x20
1935deb0bb6SMatthias Ringwald 
1945deb0bb6SMatthias Ringwald typedef enum {
19577a8d8daSMatthias Ringwald     LE_AUDIO_CODEC_FRAME_DURATION_INDEX_7500US = 0,
1965deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_FRAME_DURATION_INDEX_10000US,
1975deb0bb6SMatthias Ringwald     LE_AUDIO_CODEC_FRAME_DURATION_INDEX_RFU
1985deb0bb6SMatthias Ringwald } le_audio_codec_frame_duration_index_t;
1995deb0bb6SMatthias Ringwald 
2009ef2c435SMilanka Ringwald typedef enum {
2019ef2c435SMilanka Ringwald     LE_AUDIO_QUALITY_LOW = 0x00,
2029ef2c435SMilanka Ringwald     LE_AUDIO_QUALITY_MEDIUM,
2039ef2c435SMilanka Ringwald     LE_AUDIO_QUALITY_HIGH
2049ef2c435SMilanka Ringwald } le_audio_quality_t;
2059ef2c435SMilanka Ringwald 
2065deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_AUDIO_CHANNEL_COUNT_MASK_1            0x01
2075deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_AUDIO_CHANNEL_COUNT_MASK_2            0x02
2085deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_AUDIO_CHANNEL_COUNT_MASK_3            0x04
2095deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_AUDIO_CHANNEL_COUNT_MASK_4            0x08
2105deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_AUDIO_CHANNEL_COUNT_MASK_5            0x10
2115deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_AUDIO_CHANNEL_COUNT_MASK_6            0x20
2125deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_AUDIO_CHANNEL_COUNT_MASK_7            0x40
2135deb0bb6SMatthias Ringwald #define LE_AUDIO_CODEC_AUDIO_CHANNEL_COUNT_MASK_8            0x80
2145deb0bb6SMatthias Ringwald 
2155deb0bb6SMatthias Ringwald 
2165deb0bb6SMatthias Ringwald // GA Metadata LTV structures
2175deb0bb6SMatthias Ringwald 
2185deb0bb6SMatthias Ringwald typedef enum {
2195deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_INVALID = 0x00,
2205deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_PREFERRED_AUDIO_CONTEXTS = 0x01,
2215deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_STREAMING_AUDIO_CONTEXTS,
2225deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_PROGRAM_INFO,
2235deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_LANGUAGE,
2245deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_CCID_LIST,
2255deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_PARENTAL_RATING,
2265deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_PROGRAM_INFO_URI,
2275deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_MAPPED_EXTENDED_METADATA_BIT_POSITION,
2285deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_MAPPED_VENDOR_SPECIFIC_METADATA_BIT_POSITION,
2295deb0bb6SMatthias Ringwald     // also used to indicate invalid packet type
2305deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_RFU,
2315deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_EXTENDED_METADATA = 0xFE, // mapped on RFU
2325deb0bb6SMatthias Ringwald     LE_AUDIO_METADATA_TYPE_VENDOR_SPECIFIC_METADATA = 0xFF    // mapped on RFU+1
2335deb0bb6SMatthias Ringwald } le_audio_metadata_type_t;
2345deb0bb6SMatthias Ringwald 
2355deb0bb6SMatthias Ringwald typedef enum {
2365deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_NO_RATING = 0,
2375deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_ANY_AGE,
2385deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_AGE_2,
2395deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_AGE_3,
2405deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_AGE_4,
2415deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_AGE_6,
2425deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_AGE_7,
2435deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_AGE_8,
2445deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_AGE_9,
2455deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_AGE_10,
2465deb0bb6SMatthias Ringwald     LE_AUDIO_PARENTAL_RATING_RFU = 0x08
2475deb0bb6SMatthias Ringwald } le_audio_parental_rating_t;
2485deb0bb6SMatthias Ringwald 
2495deb0bb6SMatthias Ringwald 
2505deb0bb6SMatthias Ringwald typedef enum {
2515deb0bb6SMatthias Ringwald     LE_AUDIO_CLIENT_TARGET_LATENCY_NO_PREFERENCE = 0,
2525deb0bb6SMatthias Ringwald     LE_AUDIO_CLIENT_TARGET_LATENCY_LOW_LATENCY,
2535deb0bb6SMatthias Ringwald     LE_AUDIO_CLIENT_TARGET_LATENCY_BALANCED_LATENCY_AND_RELIABILITY,
2545deb0bb6SMatthias Ringwald     LE_AUDIO_CLIENT_TARGET_LATENCY_HIGH_RELIABILITY,
2555deb0bb6SMatthias Ringwald     LE_AUDIO_CLIENT_TARGET_LATENCY_RFU,
2565deb0bb6SMatthias Ringwald } le_audio_client_target_latency_t;
2575deb0bb6SMatthias Ringwald 
2585deb0bb6SMatthias Ringwald typedef enum {
2595deb0bb6SMatthias Ringwald     LE_AUDIO_CLIENT_TARGET_PHY_NO_PREFERENCE = 0,
2605deb0bb6SMatthias Ringwald     LE_AUDIO_CLIENT_TARGET_PHY_LOW,
2615deb0bb6SMatthias Ringwald     LE_AUDIO_CLIENT_TARGET_PHY_BALANCED,
2625deb0bb6SMatthias Ringwald     LE_AUDIO_CLIENT_TARGET_PHY_HIGH,
2635deb0bb6SMatthias Ringwald     LE_AUDIO_CLIENT_TARGET_PHY_RFU
2645deb0bb6SMatthias Ringwald } le_audio_client_target_phy_t;
2655deb0bb6SMatthias Ringwald 
2665deb0bb6SMatthias Ringwald // struct for codec id
2675deb0bb6SMatthias Ringwald typedef struct {
2685deb0bb6SMatthias Ringwald     hci_audio_coding_format_t coding_format;
2695deb0bb6SMatthias Ringwald     uint16_t company_id;
2705deb0bb6SMatthias Ringwald     uint16_t vendor_specific_codec_id;
2715deb0bb6SMatthias Ringwald } le_audio_codec_id_t;
2725deb0bb6SMatthias Ringwald 
2735deb0bb6SMatthias Ringwald 
2745deb0bb6SMatthias Ringwald typedef enum {
2755deb0bb6SMatthias Ringwald     LE_AUDIO_PA_SYNC_DO_NOT_SYNCHRONIZE_TO_PA = 0x00,
2765deb0bb6SMatthias Ringwald     LE_AUDIO_PA_SYNC_SYNCHRONIZE_TO_PA_PAST_AVAILABLE,
2775deb0bb6SMatthias Ringwald     LE_AUDIO_PA_SYNC_SYNCHRONIZE_TO_PA_PAST_NOT_AVAILABLE,
2785deb0bb6SMatthias Ringwald     LE_AUDIO_PA_SYNC_RFU
2795deb0bb6SMatthias Ringwald } le_audio_pa_sync_t;
2805deb0bb6SMatthias Ringwald 
2815deb0bb6SMatthias Ringwald typedef enum {
2825deb0bb6SMatthias Ringwald     LE_AUDIO_PA_SYNC_STATE_NOT_SYNCHRONIZED_TO_PA = 0x00,
2835deb0bb6SMatthias Ringwald     LE_AUDIO_PA_SYNC_STATE_SYNCINFO_REQUEST,
2845deb0bb6SMatthias Ringwald     LE_AUDIO_PA_SYNC_STATE_SYNCHRONIZED_TO_PA,
2855deb0bb6SMatthias Ringwald     LE_AUDIO_PA_SYNC_STATE_FAILED_TO_SYNCHRONIZE_TO_PA,
2865deb0bb6SMatthias Ringwald     LE_AUDIO_PA_SYNC_STATE_NO_PAST,
2875deb0bb6SMatthias Ringwald     LE_AUDIO_PA_SYNC_STATE_RFU
2885deb0bb6SMatthias Ringwald } le_audio_pa_sync_state_t;
2895deb0bb6SMatthias Ringwald 
2905deb0bb6SMatthias Ringwald typedef enum {
2915deb0bb6SMatthias Ringwald     LE_AUDIO_BIG_ENCRYPTION_NOT_ENCRYPTED = 0x00,
2925deb0bb6SMatthias Ringwald     LE_AUDIO_BIG_ENCRYPTION_BROADCAST_CODE_REQUIRED,
2935deb0bb6SMatthias Ringwald     LE_AUDIO_BIG_ENCRYPTION_DECRYPTING,
2945deb0bb6SMatthias Ringwald     LE_AUDIO_BIG_ENCRYPTION_BAD_CODE,
2955deb0bb6SMatthias Ringwald     LE_AUDIO_BIG_ENCRYPTION_RFU
2965deb0bb6SMatthias Ringwald } le_audio_big_encryption_t;
2975deb0bb6SMatthias Ringwald 
2985deb0bb6SMatthias Ringwald 
2995deb0bb6SMatthias Ringwald typedef struct {
3005deb0bb6SMatthias Ringwald     uint16_t metadata_mask;
3015deb0bb6SMatthias Ringwald 
3025deb0bb6SMatthias Ringwald     uint16_t preferred_audio_contexts_mask;
3035deb0bb6SMatthias Ringwald     uint16_t streaming_audio_contexts_mask;
3045deb0bb6SMatthias Ringwald 
3055deb0bb6SMatthias Ringwald     uint8_t  program_info_length;
3065deb0bb6SMatthias Ringwald     uint8_t  program_info[LE_AUDIO_PROGRAM_INFO_MAX_LENGTH];
3075deb0bb6SMatthias Ringwald 
3085deb0bb6SMatthias Ringwald     uint32_t language_code; // 3-byte, lower case language code as defined in ISO 639-3
3095deb0bb6SMatthias Ringwald 
3105deb0bb6SMatthias Ringwald     uint8_t  ccids_num;
3115deb0bb6SMatthias Ringwald     uint8_t  ccids[LE_CCIDS_MAX_NUM];
3125deb0bb6SMatthias Ringwald 
3135deb0bb6SMatthias Ringwald     le_audio_parental_rating_t parental_rating;
3145deb0bb6SMatthias Ringwald 
3155deb0bb6SMatthias Ringwald     uint8_t  program_info_uri_length;
3165deb0bb6SMatthias Ringwald     uint8_t  program_info_uri[LE_AUDIO_PROGRAM_INFO_URI_MAX_LENGTH];
3175deb0bb6SMatthias Ringwald 
3185deb0bb6SMatthias Ringwald     uint16_t extended_metadata_type;
3195deb0bb6SMatthias Ringwald     uint8_t  extended_metadata_length;
3205deb0bb6SMatthias Ringwald     uint8_t  extended_metadata[LE_AUDIO_EXTENDED_METADATA_MAX_LENGHT];
3215deb0bb6SMatthias Ringwald 
3225deb0bb6SMatthias Ringwald     uint16_t vendor_specific_company_id;
3235deb0bb6SMatthias Ringwald     uint8_t  vendor_specific_metadata_length;
3245deb0bb6SMatthias Ringwald     uint8_t  vendor_specific_metadata[LE_AUDIO_VENDOR_SPECIFIC_METADATA_MAX_LENGTH];
325*d21278d0SMatthias Ringwald 
326*d21278d0SMatthias Ringwald     uint8_t unsupported_type;
327*d21278d0SMatthias Ringwald 
3285deb0bb6SMatthias Ringwald } le_audio_metadata_t;
3295deb0bb6SMatthias Ringwald 
3309ef2c435SMilanka Ringwald typedef struct {
3319ef2c435SMilanka Ringwald     const char * name;
3329ef2c435SMilanka Ringwald     le_audio_codec_sampling_frequency_index_t sampling_frequency_index;
3339ef2c435SMilanka Ringwald     le_audio_codec_frame_duration_index_t     frame_duration_index;
3349ef2c435SMilanka Ringwald     uint16_t octets_per_frame;
3359ef2c435SMilanka Ringwald } le_audio_codec_configuration_t;
3369ef2c435SMilanka Ringwald 
3379ef2c435SMilanka Ringwald typedef struct {
3389ef2c435SMilanka Ringwald     const char * name;
3399ef2c435SMilanka Ringwald     uint16_t sdu_interval_us;
3409ef2c435SMilanka Ringwald     uint8_t  framing;
3419ef2c435SMilanka Ringwald     uint16_t max_sdu_size;
3429ef2c435SMilanka Ringwald     uint8_t  retransmission_number;
3439ef2c435SMilanka Ringwald     uint16_t max_transport_latency_ms;
3449ef2c435SMilanka Ringwald } le_audio_qos_configuration_t;
3459ef2c435SMilanka Ringwald 
3465deb0bb6SMatthias Ringwald #if defined __cplusplus
3475deb0bb6SMatthias Ringwald }
3485deb0bb6SMatthias Ringwald #endif
3495deb0bb6SMatthias Ringwald 
3505deb0bb6SMatthias Ringwald #endif
3515deb0bb6SMatthias Ringwald 
352