|
91 | 91 | #define BLE_AUDIO_LOCATION_LEFT_SURROUND (1ULL << 23)
|
92 | 92 | #define BLE_AUDIO_LOCATION_RIGHT_SURROUND (1ULL << 24)
|
93 | 93 |
|
94 |
| -#define BLE_AUDIO_CODEC_SAMPLING_FREQ_TYPE 0x01 |
95 |
| -#define BLE_AUDIO_CODEC_FRAME_DURATION_TYPE 0x02 |
96 |
| -#define BLE_AUDIO_CODEC_AUDIO_CHANNEL_ALLOCATION_TYPE 0x03 |
97 |
| -#define BLE_AUDIO_CODEC_OCTETS_PER_CODEC_FRAME_TYPE 0x04 |
98 |
| -#define BLE_AUDIO_CODEC_FRAME_BLOCKS_PER_SDU_TYPE 0x05 |
| 94 | +#define BLE_AUDIO_CODEC_CONF_SAMPLING_FREQ_TYPE 0x01 |
| 95 | +#define BLE_AUDIO_CODEC_CONF_FRAME_DURATION_TYPE 0x02 |
| 96 | +#define BLE_AUDIO_CODEC_CONF_AUDIO_CHANNEL_ALLOCATION_TYPE 0x03 |
| 97 | +#define BLE_AUDIO_CODEC_CONF_OCTETS_PER_CODEC_FRAME_TYPE 0x04 |
| 98 | +#define BLE_AUDIO_CODEC_CONF_FRAME_BLOCKS_PER_SDU_TYPE 0x05 |
99 | 99 |
|
| 100 | +#define BLE_AUDIO_CODEC_CAPS_SAMPLING_FREQS_TYPE 0x01 |
| 101 | +#define BLE_AUDIO_CODEC_CAPS_FRAME_DURATIONS_TYPE 0x02 |
| 102 | +#define BLE_AUDIO_CODEC_CAPS_SUP_AUDIO_CHANNEL_COUNTS_TYPE 0x03 |
| 103 | +#define BLE_AUDIO_CODEC_CAPS_OCTETS_PER_CODEC_FRAME_TYPE 0x04 |
| 104 | +#define BLE_AUDIO_CODEC_CAPS_FRAMES_PER_SDU_TYPE 0x05 |
| 105 | + |
| 106 | +#define BLE_AUDIO_CONTEXT_TYPE_PROHIBITED 0x0000 |
| 107 | +#define BLE_AUDIO_CONTEXT_TYPE_UNSPECIFIED 0x0001 |
| 108 | +#define BLE_AUDIO_CONTEXT_TYPE_CONVERSATIONAL 0x0002 |
| 109 | +#define BLE_AUDIO_CONTEXT_TYPE_MEDIA 0x0004 |
| 110 | +#define BLE_AUDIO_CONTEXT_TYPE_GAME 0x0008 |
| 111 | +#define BLE_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL 0x0010 |
| 112 | +#define BLE_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS 0x0020 |
| 113 | +#define BLE_AUDIO_CONTEXT_TYPE_LIVE 0x0040 |
| 114 | +#define BLE_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS 0x0080 |
| 115 | +#define BLE_AUDIO_CONTEXT_TYPE_NOTIFICATIONS 0x0100 |
| 116 | +#define BLE_AUDIO_CONTEXT_TYPE_RINGTONE 0x0200 |
| 117 | +#define BLE_AUDIO_CONTEXT_TYPE_ALERTS 0x0400 |
| 118 | +#define BLE_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM 0x0800 |
| 119 | + |
| 120 | +#define BLE_AUDIO_CODEC_SUPPORTED_FRAME_DURATION_7_5_MS 0x0001 |
| 121 | +#define BLE_AUDIO_CODEC_SUPPORTED_FRAME_DURATION_10_MS 0x0002 |
| 122 | +#define BLE_AUDIO_CODEC_PREFERED_FRAME_DURATION_7_5_MS 0x0004 |
| 123 | +#define BLE_AUDIO_CODEC_PREFERED_FRAME_DURATION_10_MS 0x0008 |
| 124 | + |
| 125 | +#define BLE_AUDIO_CODEC_SUPPORTED_CHANNEL_COUNT_1 0x0001 |
| 126 | +#define BLE_AUDIO_CODEC_SUPPORTED_CHANNEL_COUNT_2 0x0002 |
| 127 | +#define BLE_AUDIO_CODEC_SUPPORTED_CHANNEL_COUNT_3 0x0004 |
| 128 | +#define BLE_AUDIO_CODEC_SUPPORTED_CHANNEL_COUNT_4 0x0008 |
| 129 | +#define BLE_AUDIO_CODEC_SUPPORTED_CHANNEL_COUNT_5 0x0010 |
| 130 | +#define BLE_AUDIO_CODEC_SUPPORTED_CHANNEL_COUNT_6 0x0020 |
| 131 | +#define BLE_AUDIO_CODEC_SUPPORTED_CHANNEL_COUNT_7 0x0040 |
| 132 | +#define BLE_AUDIO_CODEC_SUPPORTED_CHANNEL_COUNT_8 0x0080 |
100 | 133 | /**
|
101 | 134 | * @brief Helper macro used to build LTV array of Codec_Specific_Configuration.
|
102 | 135 | *
|
|
117 | 150 | _octets_per_codec_frame, \
|
118 | 151 | _codec_frame_blocks_per_sdu) \
|
119 | 152 | { \
|
120 |
| - 2, BLE_AUDIO_CODEC_SAMPLING_FREQ_TYPE, _sampling_freq, \ |
121 |
| - 2, BLE_AUDIO_CODEC_FRAME_DURATION_TYPE, _frame_duration, \ |
122 |
| - OPTIONAL_FIELD(5, BLE_AUDIO_CODEC_AUDIO_CHANNEL_ALLOCATION_TYPE, \ |
| 153 | + 2, BLE_AUDIO_CODEC_CAPS_SAMPLING_FREQS_TYPE, _sampling_freq, \ |
| 154 | + 2, BLE_AUDIO_CODEC_CAPS_FRAME_DURATIONS_TYPE, _frame_duration, \ |
| 155 | + OPTIONAL_FIELD(5, BLE_AUDIO_CODEC_CONF_AUDIO_CHANNEL_ALLOCATION_TYPE, \ |
123 | 156 | _audio_channel_alloc) \
|
124 |
| - 3, BLE_AUDIO_CODEC_OCTETS_PER_CODEC_FRAME_TYPE, \ |
| 157 | + 3, BLE_AUDIO_CODEC_CONF_OCTETS_PER_CODEC_FRAME_TYPE, \ |
125 | 158 | (_octets_per_codec_frame), ((_octets_per_codec_frame) >> 8), \
|
126 |
| - OPTIONAL_FIELD(2, BLE_AUDIO_CODEC_FRAME_BLOCKS_PER_SDU_TYPE, \ |
| 159 | + OPTIONAL_FIELD(2, BLE_AUDIO_CODEC_CONF_FRAME_BLOCKS_PER_SDU_TYPE, \ |
127 | 160 | _codec_frame_blocks_per_sdu) \
|
128 | 161 | }
|
129 | 162 |
|
| 163 | +/** |
| 164 | + * @brief Helper macro used to build LTV array of Codec_Specific_Capabilities. |
| 165 | + * |
| 166 | + * @param _sampling_freq Supported_Sampling_Frequencies - |
| 167 | + * single octet value |
| 168 | + * @param _frame_duration Supported_Frame_Durations - single |
| 169 | + * octet value |
| 170 | + * @param _audio_channel_counts Supported_Audio_Channel_Counts - |
| 171 | + * single octet value |
| 172 | + * @param _min_octets_per_codec_frame minimum value of |
| 173 | + * Supported_Octets_Per_Codec_Frame - |
| 174 | + * two octet value |
| 175 | + * @param _max_octets_per_codec_frame maximum value of |
| 176 | + * Supported_Octets_Per_Codec_Frame - |
| 177 | + * two octet value |
| 178 | + * @param _codec_frames_per_sdu Supported_Max_Codec_Frames_Per_SDU - |
| 179 | + * single octet value |
| 180 | + * |
| 181 | + * @return Pointer to a `ble_uuid16_t` structure. |
| 182 | + */ |
| 183 | +#define BLE_AUDIO_BUILD_CODEC_CAPS(_sampling_freq, \ |
| 184 | + _frame_duration, \ |
| 185 | + _audio_channel_counts, \ |
| 186 | + _min_octets_per_codec_frame, \ |
| 187 | + _max_octets_per_codec_frame, \ |
| 188 | + _codec_frames_per_sdu) \ |
| 189 | + { \ |
| 190 | + 2, BLE_AUDIO_CODEC_CAPS_SAMPLING_FREQS_TYPE, _sampling_freq, \ |
| 191 | + 2, BLE_AUDIO_CODEC_CAPS_FRAME_DURATIONS_TYPE, _frame_duration, \ |
| 192 | + OPTIONAL_FIELD(5, BLE_AUDIO_CODEC_CAPS_SUP_AUDIO_CHANNEL_COUNTS_TYPE, \ |
| 193 | + _audio_channel_counts) \ |
| 194 | + 3, BLE_AUDIO_CODEC_CAPS_OCTETS_PER_CODEC_FRAME_TYPE, \ |
| 195 | + (_min_octets_per_codec_frame), ((_min_octets_per_codec_frame) >> 8), \ |
| 196 | + (_max_octets_per_codec_frame), ((_max_octets_per_codec_frame) >> 8), \ |
| 197 | + OPTIONAL_FIELD(2, BLE_AUDIO_CODEC_CAPS_FRAMES_PER_SDU_TYPE, \ |
| 198 | + _codec_frames_per_sdu) \ |
| 199 | + } |
| 200 | + |
130 | 201 | struct ble_audio_codec_id {
|
131 | 202 | /** Coding Fromat */
|
132 | 203 | uint8_t format;
|
|
0 commit comments