Zephyr Project API  3.3.0
A Scalable Open Source RTOS
audio.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2020 Intel Corporation
7 * Copyright (c) 2020-2022 Nordic Semiconductor ASA
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_AUDIO_H_
12#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_AUDIO_H_
13
14#include <zephyr/sys/atomic.h>
22
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#define BT_AUDIO_BROADCAST_ID_SIZE 3 /* octets */
35
54};
55
59#define BT_AUDIO_CONTEXT_TYPE_ANY (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED | \
60 BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL | \
61 BT_AUDIO_CONTEXT_TYPE_MEDIA | \
62 BT_AUDIO_CONTEXT_TYPE_GAME | \
63 BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL | \
64 BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS | \
65 BT_AUDIO_CONTEXT_TYPE_LIVE | \
66 BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS | \
67 BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS | \
68 BT_AUDIO_CONTEXT_TYPE_RINGTONE | \
69 BT_AUDIO_CONTEXT_TYPE_ALERTS | \
70 BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM)
71
95};
96
101};
102
119
130
133
139
142
148
151
157
160
163
166};
167
168/* Unicast Announcement Type, Generic Audio */
169#define BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL 0x00
170#define BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED 0x01
171
172#if defined(CONFIG_BT_AUDIO_BROADCAST_SINK)
173#define BROADCAST_SNK_STREAM_CNT CONFIG_BT_AUDIO_BROADCAST_SNK_STREAM_COUNT
174#define BROADCAST_SNK_SUBGROUP_CNT CONFIG_BT_AUDIO_BROADCAST_SNK_SUBGROUP_COUNT
175#else /* !CONFIG_BT_AUDIO_BROADCAST_SINK */
176#define BROADCAST_SNK_STREAM_CNT 0
177#define BROADCAST_SNK_SUBGROUP_CNT 0
178#endif /* CONFIG_BT_AUDIO_BROADCAST_SINK*/
179
181struct bt_audio_unicast_group;
182
184struct bt_audio_broadcast_sink;
185
187struct bt_audio_broadcast_source;
188
191 struct bt_data data;
192#if defined(CONFIG_BT_CODEC_MAX_DATA_LEN)
193 uint8_t value[CONFIG_BT_CODEC_MAX_DATA_LEN];
194#endif /* CONFIG_BT_CODEC_MAX_DATA_LEN */
195};
196
207#define BT_CODEC_DATA(_type, _bytes...) \
208 { \
209 .data = BT_DATA(_type, ((uint8_t []) { _bytes }), \
210 sizeof((uint8_t []) { _bytes })) \
211 }
212
222#define BT_CODEC(_id, _cid, _vid, _data, _meta) \
223 { \
224 /* Use HCI data path as default, can be overwritten by application */ \
225 .path_id = BT_ISO_DATA_PATH_HCI, \
226 .id = _id, \
227 .cid = _cid, \
228 .vid = _vid, \
229 .data_count = ARRAY_SIZE(((struct bt_codec_data[]) _data)), \
230 .data = _data, \
231 .meta_count = ARRAY_SIZE(((struct bt_codec_data[]) _meta)), \
232 .meta = _meta, \
233 }
234
269};
270
274#define BT_AUDIO_LOCATION_ANY (BT_AUDIO_LOCATION_FRONT_LEFT | \
275 BT_AUDIO_LOCATION_FRONT_RIGHT | \
276 BT_AUDIO_LOCATION_FRONT_CENTER | \
277 BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 | \
278 BT_AUDIO_LOCATION_BACK_LEFT | \
279 BT_AUDIO_LOCATION_BACK_RIGHT | \
280 BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER | \
281 BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER | \
282 BT_AUDIO_LOCATION_BACK_CENTER | \
283 BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 | \
284 BT_AUDIO_LOCATION_SIDE_LEFT | \
285 BT_AUDIO_LOCATION_SIDE_RIGHT | \
286 BT_AUDIO_LOCATION_TOP_FRONT_LEFT | \
287 BT_AUDIO_LOCATION_TOP_FRONT_RIGHT | \
288 BT_AUDIO_LOCATION_TOP_FRONT_CENTER | \
289 BT_AUDIO_LOCATION_TOP_CENTER | \
290 BT_AUDIO_LOCATION_TOP_BACK_LEFT | \
291 BT_AUDIO_LOCATION_TOP_BACK_RIGHT | \
292 BT_AUDIO_LOCATION_TOP_SIDE_LEFT | \
293 BT_AUDIO_LOCATION_TOP_SIDE_RIGHT | \
294 BT_AUDIO_LOCATION_TOP_BACK_CENTER | \
295 BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER | \
296 BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT | \
297 BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT | \
298 BT_AUDIO_LOCATION_FRONT_LEFT_WIDE | \
299 BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE | \
300 BT_AUDIO_LOCATION_LEFT_SURROUND | \
301 BT_AUDIO_LOCATION_RIGHT_SURROUND)
302
304struct bt_codec {
317#if defined(CONFIG_BT_CODEC_MAX_DATA_COUNT)
319 size_t data_count;
321 struct bt_codec_data data[CONFIG_BT_CODEC_MAX_DATA_COUNT];
322#endif /* CONFIG_BT_CODEC_MAX_DATA_COUNT */
323#if defined(CONFIG_BT_CODEC_MAX_METADATA_COUNT)
325 size_t meta_count;
327 struct bt_codec_data meta[CONFIG_BT_CODEC_MAX_METADATA_COUNT];
328#endif /* CONFIG_BT_CODEC_MAX_METADATA_COUNT */
329};
330
332 /* Unique index of the BIS */
334#if defined(CONFIG_BT_CODEC_MAX_DATA_COUNT)
339 size_t data_count;
344 struct bt_codec_data data[CONFIG_BT_CODEC_MAX_DATA_COUNT];
345#endif /* CONFIG_BT_CODEC_MAX_DATA_COUNT */
346};
347
349 /* Number of BIS in the subgroup */
350 size_t bis_count;
357 /* Array of BIS specific data for each BIS in the subgroup */
359};
360
362 /* Number of subgroups in the BASE */
364 /* Array of subgroups in the BASE */
366};
367
372};
373
385#define BT_CODEC_QOS(_interval, _framing, _phy, _sdu, _rtn, _latency, \
386 _pd) \
387 { \
388 .interval = _interval, \
389 .framing = _framing, \
390 .phy = _phy, \
391 .sdu = _sdu, \
392 .rtn = _rtn, \
393 .latency = _latency, \
394 .pd = _pd, \
395 }
396
398enum {
401};
402
404enum {
408};
409
419#define BT_CODEC_QOS_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd) \
420 BT_CODEC_QOS(_interval, BT_CODEC_QOS_UNFRAMED, BT_CODEC_QOS_2M, _sdu, \
421 _rtn, _latency, _pd)
422
432#define BT_CODEC_QOS_FRAMED(_interval, _sdu, _rtn, _latency, _pd) \
433 BT_CODEC_QOS(_interval, BT_CODEC_QOS_FRAMED, BT_CODEC_QOS_2M, _sdu, \
434 _rtn, _latency, _pd)
435
440
443
446
449
452
457};
458
471#define BT_CODEC_QOS_PREF(_unframed_supported, _phy, _rtn, _latency, _pd_min, \
472 _pd_max, _pref_pd_min, _pref_pd_max) \
473 { \
474 .unframed_supported = _unframed_supported, \
475 .phy = _phy, \
476 .rtn = _rtn, \
477 .latency = _latency, \
478 .pd_min = _pd_min, \
479 .pd_max = _pd_max, \
480 .pref_pd_min = _pref_pd_min, \
481 .pref_pd_max = _pref_pd_max, \
482 }
483
492
495
498
501
508
515
518
521};
522
529};
530
532#define BT_AUDIO_LC3_PRESET(_codec, _qos) \
533 { \
534 .codec = _codec, \
535 .qos = _qos, \
536 }
537
538/* LC3 Unicast presets defined by table 5.2 in the BAP v1.0 specification */
539
546#define BT_AUDIO_LC3_UNICAST_PRESET_8_1_1(_loc, _stream_context) \
547 BT_AUDIO_LC3_PRESET( \
548 BT_CODEC_LC3_CONFIG_8_1(_loc, _stream_context), \
549 BT_CODEC_LC3_QOS_7_5_UNFRAMED(26u, 2u, 8u, 40000u) \
550 )
551
558#define BT_AUDIO_LC3_UNICAST_PRESET_8_2_1(_loc, _stream_context) \
559 BT_AUDIO_LC3_PRESET( \
560 BT_CODEC_LC3_CONFIG_8_2(_loc, _stream_context), \
561 BT_CODEC_LC3_QOS_10_UNFRAMED(30u, 2u, 10u, 40000u) \
562 )
563
570#define BT_AUDIO_LC3_UNICAST_PRESET_16_1_1(_loc, _stream_context) \
571 BT_AUDIO_LC3_PRESET( \
572 BT_CODEC_LC3_CONFIG_16_1(_loc, _stream_context), \
573 BT_CODEC_LC3_QOS_7_5_UNFRAMED(30u, 2u, 8u, 40000u) \
574 )
575
584#define BT_AUDIO_LC3_UNICAST_PRESET_16_2_1(_loc, _stream_context) \
585 BT_AUDIO_LC3_PRESET( \
586 BT_CODEC_LC3_CONFIG_16_2(_loc, _stream_context), \
587 BT_CODEC_LC3_QOS_10_UNFRAMED(40u, 2u, 10u, 40000u) \
588 )
589
596#define BT_AUDIO_LC3_UNICAST_PRESET_24_1_1(_loc, _stream_context) \
597 BT_AUDIO_LC3_PRESET( \
598 BT_CODEC_LC3_CONFIG_24_1(_loc, _stream_context), \
599 BT_CODEC_LC3_QOS_7_5_UNFRAMED(45u, 2u, 8u, 40000u) \
600 )
601
610#define BT_AUDIO_LC3_UNICAST_PRESET_24_2_1(_loc, _stream_context) \
611 BT_AUDIO_LC3_PRESET( \
612 BT_CODEC_LC3_CONFIG_24_2(_loc, _stream_context), \
613 BT_CODEC_LC3_QOS_10_UNFRAMED(60u, 2u, 10u, 40000u) \
614 )
615
622#define BT_AUDIO_LC3_UNICAST_PRESET_32_1_1(_loc, _stream_context) \
623 BT_AUDIO_LC3_PRESET( \
624 BT_CODEC_LC3_CONFIG_32_1(_loc, _stream_context), \
625 BT_CODEC_LC3_QOS_7_5_UNFRAMED(60u, 2u, 8u, 40000u) \
626 )
627
634#define BT_AUDIO_LC3_UNICAST_PRESET_32_2_1(_loc, _stream_context) \
635 BT_AUDIO_LC3_PRESET( \
636 BT_CODEC_LC3_CONFIG_32_2(_loc, _stream_context), \
637 BT_CODEC_LC3_QOS_10_UNFRAMED(80u, 2u, 10u, 40000u) \
638 )
639
646#define BT_AUDIO_LC3_UNICAST_PRESET_441_1_1(_loc, _stream_context) \
647 BT_AUDIO_LC3_PRESET( \
648 BT_CODEC_LC3_CONFIG_441_1(_loc, _stream_context), \
649 BT_CODEC_QOS(8163u, BT_CODEC_QOS_FRAMED, \
650 BT_CODEC_QOS_2M, 97u, 5u, 24u, 40000u) \
651 )
652
659#define BT_AUDIO_LC3_UNICAST_PRESET_441_2_1(_loc, _stream_context) \
660 BT_AUDIO_LC3_PRESET( \
661 BT_CODEC_LC3_CONFIG_441_2(_loc, _stream_context), \
662 BT_CODEC_QOS(10884u, BT_CODEC_QOS_FRAMED, \
663 BT_CODEC_QOS_2M, 130u, 5u, 31u, 40000u) \
664 )
665
672#define BT_AUDIO_LC3_UNICAST_PRESET_48_1_1(_loc, _stream_context) \
673 BT_AUDIO_LC3_PRESET( \
674 BT_CODEC_LC3_CONFIG_48_1(_loc, _stream_context), \
675 BT_CODEC_LC3_QOS_7_5_UNFRAMED(75u, 5u, 15u, 40000u) \
676 )
677
684#define BT_AUDIO_LC3_UNICAST_PRESET_48_2_1(_loc, _stream_context) \
685 BT_AUDIO_LC3_PRESET( \
686 BT_CODEC_LC3_CONFIG_48_2(_loc, _stream_context), \
687 BT_CODEC_LC3_QOS_10_UNFRAMED(100u, 5u, 20u, 40000u) \
688 )
689
696#define BT_AUDIO_LC3_UNICAST_PRESET_48_3_1(_loc, _stream_context) \
697 BT_AUDIO_LC3_PRESET( \
698 BT_CODEC_LC3_CONFIG_48_3(_loc, _stream_context), \
699 BT_CODEC_LC3_QOS_7_5_UNFRAMED(90u, 5u, 15u, 40000u) \
700 )
701
708#define BT_AUDIO_LC3_UNICAST_PRESET_48_4_1(_loc, _stream_context) \
709 BT_AUDIO_LC3_PRESET( \
710 BT_CODEC_LC3_CONFIG_48_4(_loc, _stream_context), \
711 BT_CODEC_LC3_QOS_10_UNFRAMED(120u, 5u, 20u, 40000u) \
712 )
713
720#define BT_AUDIO_LC3_UNICAST_PRESET_48_5_1(_loc, _stream_context) \
721 BT_AUDIO_LC3_PRESET( \
722 BT_CODEC_LC3_CONFIG_48_5(_loc, _stream_context), \
723 BT_CODEC_LC3_QOS_7_5_UNFRAMED(117u, 5u, 15u, 40000u) \
724 )
725
732#define BT_AUDIO_LC3_UNICAST_PRESET_48_6_1(_loc, _stream_context) \
733 BT_AUDIO_LC3_PRESET( \
734 BT_CODEC_LC3_CONFIG_48_6(_loc, _stream_context), \
735 BT_CODEC_LC3_QOS_10_UNFRAMED(155u, 5u, 20u, 40000u) \
736 )
737
744/* Following presets are for unicast high reliability audio data */
745#define BT_AUDIO_LC3_UNICAST_PRESET_8_1_2(_loc, _stream_context) \
746 BT_AUDIO_LC3_PRESET( \
747 BT_CODEC_LC3_CONFIG_8_1(_loc, _stream_context), \
748 BT_CODEC_LC3_QOS_7_5_UNFRAMED(26u, 13u, 75u, 40000u) \
749 )
750
757#define BT_AUDIO_LC3_UNICAST_PRESET_8_2_2(_loc, _stream_context) \
758 BT_AUDIO_LC3_PRESET( \
759 BT_CODEC_LC3_CONFIG_8_2(_loc, _stream_context), \
760 BT_CODEC_LC3_QOS_10_UNFRAMED(30u, 13u, 95u, 40000u) \
761 )
762
769#define BT_AUDIO_LC3_UNICAST_PRESET_16_1_2(_loc, _stream_context) \
770 BT_AUDIO_LC3_PRESET( \
771 BT_CODEC_LC3_CONFIG_16_1(_loc, _stream_context), \
772 BT_CODEC_LC3_QOS_7_5_UNFRAMED(30u, 13u, 75u, 40000u) \
773 )
774
781#define BT_AUDIO_LC3_UNICAST_PRESET_16_2_2(_loc, _stream_context) \
782 BT_AUDIO_LC3_PRESET( \
783 BT_CODEC_LC3_CONFIG_16_2(_loc, _stream_context), \
784 BT_CODEC_LC3_QOS_10_UNFRAMED(40u, 13u, 95u, 40000u) \
785 )
786
793#define BT_AUDIO_LC3_UNICAST_PRESET_24_1_2(_loc, _stream_context) \
794 BT_AUDIO_LC3_PRESET( \
795 BT_CODEC_LC3_CONFIG_24_1(_loc, _stream_context), \
796 BT_CODEC_LC3_QOS_7_5_UNFRAMED(45u, 13u, 75u, 40000u) \
797 )
798
805#define BT_AUDIO_LC3_UNICAST_PRESET_24_2_2(_loc, _stream_context) \
806 BT_AUDIO_LC3_PRESET( \
807 BT_CODEC_LC3_CONFIG_24_2(_loc, _stream_context), \
808 BT_CODEC_LC3_QOS_10_UNFRAMED(60u, 13u, 95u, 40000u) \
809 )
810
817#define BT_AUDIO_LC3_UNICAST_PRESET_32_1_2(_loc, _stream_context) \
818 BT_AUDIO_LC3_PRESET( \
819 BT_CODEC_LC3_CONFIG_32_1(_loc, _stream_context), \
820 BT_CODEC_LC3_QOS_7_5_UNFRAMED(60u, 13u, 75u, 40000u) \
821 )
822
829#define BT_AUDIO_LC3_UNICAST_PRESET_32_2_2(_loc, _stream_context) \
830 BT_AUDIO_LC3_PRESET( \
831 BT_CODEC_LC3_CONFIG_32_2(_loc, _stream_context), \
832 BT_CODEC_LC3_QOS_10_UNFRAMED(80u, 13u, 95u, 40000u) \
833 )
834
841#define BT_AUDIO_LC3_UNICAST_PRESET_441_1_2(_loc, _stream_context) \
842 BT_AUDIO_LC3_PRESET( \
843 BT_CODEC_LC3_CONFIG_441_1(_loc, _stream_context), \
844 BT_CODEC_QOS(8163u, BT_CODEC_QOS_FRAMED, \
845 BT_CODEC_QOS_2M, 97u, 13u, 80u, 40000u) \
846 )
847
854#define BT_AUDIO_LC3_UNICAST_PRESET_441_2_2(_loc, _stream_context) \
855 BT_AUDIO_LC3_PRESET( \
856 BT_CODEC_LC3_CONFIG_441_2(_loc, _stream_context), \
857 BT_CODEC_QOS(10884u, BT_CODEC_QOS_FRAMED, \
858 BT_CODEC_QOS_2M, 130u, 13u, 85u, 40000u) \
859 )
860
867#define BT_AUDIO_LC3_UNICAST_PRESET_48_1_2(_loc, _stream_context) \
868 BT_AUDIO_LC3_PRESET( \
869 BT_CODEC_LC3_CONFIG_48_1(_loc, _stream_context), \
870 BT_CODEC_LC3_QOS_7_5_UNFRAMED(75u, 13u, 75u, 40000u) \
871 )
872
879#define BT_AUDIO_LC3_UNICAST_PRESET_48_2_2(_loc, _stream_context) \
880 BT_AUDIO_LC3_PRESET( \
881 BT_CODEC_LC3_CONFIG_48_2(_loc, _stream_context), \
882 BT_CODEC_LC3_QOS_10_UNFRAMED(100u, 13u, 95u, 40000u) \
883 )
884
891#define BT_AUDIO_LC3_UNICAST_PRESET_48_3_2(_loc, _stream_context) \
892 BT_AUDIO_LC3_PRESET( \
893 BT_CODEC_LC3_CONFIG_48_3(_loc, _stream_context), \
894 BT_CODEC_LC3_QOS_7_5_UNFRAMED(90u, 13u, 75u, 40000u) \
895 )
896
903#define BT_AUDIO_LC3_UNICAST_PRESET_48_4_2(_loc, _stream_context) \
904 BT_AUDIO_LC3_PRESET( \
905 BT_CODEC_LC3_CONFIG_48_4(_loc, _stream_context), \
906 BT_CODEC_LC3_QOS_10_UNFRAMED(120u, 13u, 100u, 40000u) \
907 )
908
915#define BT_AUDIO_LC3_UNICAST_PRESET_48_5_2(_loc, _stream_context) \
916 BT_AUDIO_LC3_PRESET( \
917 BT_CODEC_LC3_CONFIG_48_5(_loc, _stream_context), \
918 BT_CODEC_LC3_QOS_7_5_UNFRAMED(117u, 13u, 75u, 40000u) \
919 )
920
927#define BT_AUDIO_LC3_UNICAST_PRESET_48_6_2(_loc, _stream_context) \
928 BT_AUDIO_LC3_PRESET( \
929 BT_CODEC_LC3_CONFIG_48_6(_loc, _stream_context), \
930 BT_CODEC_LC3_QOS_10_UNFRAMED(155u, 13u, 100u, 40000u) \
931 )
932
939/* LC3 Broadcast presets defined by table 6.4 in the BAP v1.0 specification */
940#define BT_AUDIO_LC3_BROADCAST_PRESET_8_1_1(_loc, _stream_context) \
941 BT_AUDIO_LC3_PRESET( \
942 BT_CODEC_LC3_CONFIG_8_1(_loc, _stream_context), \
943 BT_CODEC_LC3_QOS_7_5_UNFRAMED(26u, 2u, 8u, 40000u) \
944 )
945
952#define BT_AUDIO_LC3_BROADCAST_PRESET_8_2_1(_loc, _stream_context) \
953 BT_AUDIO_LC3_PRESET( \
954 BT_CODEC_LC3_CONFIG_8_2(_loc, _stream_context), \
955 BT_CODEC_LC3_QOS_10_UNFRAMED(30u, 2u, 10u, 40000u) \
956 )
957
964#define BT_AUDIO_LC3_BROADCAST_PRESET_16_1_1(_loc, _stream_context) \
965 BT_AUDIO_LC3_PRESET( \
966 BT_CODEC_LC3_CONFIG_16_1(_loc, _stream_context), \
967 BT_CODEC_LC3_QOS_7_5_UNFRAMED(30u, 2u, 8u, 40000u) \
968 )
969
978#define BT_AUDIO_LC3_BROADCAST_PRESET_16_2_1(_loc, _stream_context) \
979 BT_AUDIO_LC3_PRESET( \
980 BT_CODEC_LC3_CONFIG_16_2(_loc, _stream_context), \
981 BT_CODEC_LC3_QOS_10_UNFRAMED(40u, 2u, 10u, 40000u) \
982 )
983
990#define BT_AUDIO_LC3_BROADCAST_PRESET_24_1_1(_loc, _stream_context) \
991 BT_AUDIO_LC3_PRESET( \
992 BT_CODEC_LC3_CONFIG_24_1(_loc, _stream_context), \
993 BT_CODEC_LC3_QOS_7_5_UNFRAMED(45u, 2u, 8u, 40000u) \
994 )
995
1004#define BT_AUDIO_LC3_BROADCAST_PRESET_24_2_1(_loc, _stream_context) \
1005 BT_AUDIO_LC3_PRESET( \
1006 BT_CODEC_LC3_CONFIG_24_2(_loc, _stream_context), \
1007 BT_CODEC_LC3_QOS_10_UNFRAMED(60u, 2u, 10u, 40000u) \
1008 )
1009
1016#define BT_AUDIO_LC3_BROADCAST_PRESET_32_1_1(_loc, _stream_context) \
1017 BT_AUDIO_LC3_PRESET( \
1018 BT_CODEC_LC3_CONFIG_32_1(_loc, _stream_context), \
1019 BT_CODEC_LC3_QOS_7_5_UNFRAMED(60u, 2u, 8u, 40000u) \
1020 )
1021
1028#define BT_AUDIO_LC3_BROADCAST_PRESET_32_2_1(_loc, _stream_context) \
1029 BT_AUDIO_LC3_PRESET( \
1030 BT_CODEC_LC3_CONFIG_32_2(_loc, _stream_context), \
1031 BT_CODEC_LC3_QOS_10_UNFRAMED(80u, 2u, 10u, 40000u) \
1032 )
1033
1040#define BT_AUDIO_LC3_BROADCAST_PRESET_441_1_1(_loc, _stream_context) \
1041 BT_AUDIO_LC3_PRESET( \
1042 BT_CODEC_LC3_CONFIG_441_1(_loc, _stream_context), \
1043 BT_CODEC_QOS(8163u, BT_CODEC_QOS_FRAMED, \
1044 BT_CODEC_QOS_2M, 97u, 4u, 24u, 40000u) \
1045 )
1046
1053#define BT_AUDIO_LC3_BROADCAST_PRESET_441_2_1(_loc, _stream_context) \
1054 BT_AUDIO_LC3_PRESET( \
1055 BT_CODEC_LC3_CONFIG_441_2(_loc, _stream_context), \
1056 BT_CODEC_QOS(10884u, BT_CODEC_QOS_FRAMED, \
1057 BT_CODEC_QOS_2M, 130u, 4u, 31u, 40000u) \
1058 )
1059
1066#define BT_AUDIO_LC3_BROADCAST_PRESET_48_1_1(_loc, _stream_context) \
1067 BT_AUDIO_LC3_PRESET( \
1068 BT_CODEC_LC3_CONFIG_48_1(_loc, _stream_context), \
1069 BT_CODEC_LC3_QOS_7_5_UNFRAMED(75u, 4u, 15u, 40000u) \
1070 )
1071
1078#define BT_AUDIO_LC3_BROADCAST_PRESET_48_2_1(_loc, _stream_context) \
1079 BT_AUDIO_LC3_PRESET( \
1080 BT_CODEC_LC3_CONFIG_48_2(_loc, _stream_context), \
1081 BT_CODEC_LC3_QOS_10_UNFRAMED(100u, 4u, 20u, 40000u) \
1082 )
1083
1090#define BT_AUDIO_LC3_BROADCAST_PRESET_48_3_1(_loc, _stream_context) \
1091 BT_AUDIO_LC3_PRESET( \
1092 BT_CODEC_LC3_CONFIG_48_3(_loc, _stream_context), \
1093 BT_CODEC_LC3_QOS_7_5_UNFRAMED(90u, 4u, 15u, 40000u) \
1094 )
1095
1102#define BT_AUDIO_LC3_BROADCAST_PRESET_48_4_1(_loc, _stream_context) \
1103 BT_AUDIO_LC3_PRESET( \
1104 BT_CODEC_LC3_CONFIG_48_4(_loc, _stream_context), \
1105 BT_CODEC_LC3_QOS_10_UNFRAMED(120u, 4u, 20u, 40000u) \
1106 )
1107
1114#define BT_AUDIO_LC3_BROADCAST_PRESET_48_5_1(_loc, _stream_context) \
1115 BT_AUDIO_LC3_PRESET( \
1116 BT_CODEC_LC3_CONFIG_48_5(_loc, _stream_context), \
1117 BT_CODEC_LC3_QOS_7_5_UNFRAMED(117u, 4u, 15u, 40000u) \
1118 )
1119
1126#define BT_AUDIO_LC3_BROADCAST_PRESET_48_6_1(_loc, _stream_context) \
1127 BT_AUDIO_LC3_PRESET( \
1128 BT_CODEC_LC3_CONFIG_48_6(_loc, _stream_context), \
1129 BT_CODEC_LC3_QOS_10_UNFRAMED(155u, 4u, 20u, 40000u) \
1130 )
1131
1138/* Following presets are for broadcast high reliability audio data */
1139#define BT_AUDIO_LC3_BROADCAST_PRESET_8_1_2(_loc, _stream_context) \
1140 BT_AUDIO_LC3_PRESET( \
1141 BT_CODEC_LC3_CONFIG_8_1(_loc, _stream_context), \
1142 BT_CODEC_LC3_QOS_7_5_UNFRAMED(26u, 4u, 45u, 40000u) \
1143 )
1144
1151#define BT_AUDIO_LC3_BROADCAST_PRESET_8_2_2(_loc, _stream_context) \
1152 BT_AUDIO_LC3_PRESET( \
1153 BT_CODEC_LC3_CONFIG_8_2(_loc, _stream_context), \
1154 BT_CODEC_LC3_QOS_10_UNFRAMED(30u, 4u, 60u, 40000u) \
1155 )
1156
1163#define BT_AUDIO_LC3_BROADCAST_PRESET_16_1_2(_loc, _stream_context) \
1164 BT_AUDIO_LC3_PRESET( \
1165 BT_CODEC_LC3_CONFIG_16_1(_loc, _stream_context), \
1166 BT_CODEC_LC3_QOS_7_5_UNFRAMED(30u, 4u, 45u, 40000u) \
1167 )
1168
1177#define BT_AUDIO_LC3_BROADCAST_PRESET_16_2_2(_loc, _stream_context) \
1178 BT_AUDIO_LC3_PRESET( \
1179 BT_CODEC_LC3_CONFIG_16_2(_loc, _stream_context), \
1180 BT_CODEC_LC3_QOS_10_UNFRAMED(40u, 4u, 60u, 40000u) \
1181 )
1182
1189#define BT_AUDIO_LC3_BROADCAST_PRESET_24_1_2(_loc, _stream_context) \
1190 BT_AUDIO_LC3_PRESET( \
1191 BT_CODEC_LC3_CONFIG_24_1(_loc, _stream_context), \
1192 BT_CODEC_LC3_QOS_7_5_UNFRAMED(45u, 4u, 45u, 40000u) \
1193 )
1194
1203#define BT_AUDIO_LC3_BROADCAST_PRESET_24_2_2(_loc, _stream_context) \
1204 BT_AUDIO_LC3_PRESET( \
1205 BT_CODEC_LC3_CONFIG_24_2(_loc, _stream_context), \
1206 BT_CODEC_LC3_QOS_10_UNFRAMED(60u, 4u, 60u, 40000u) \
1207 )
1208
1215#define BT_AUDIO_LC3_BROADCAST_PRESET_32_1_2(_loc, _stream_context) \
1216 BT_AUDIO_LC3_PRESET( \
1217 BT_CODEC_LC3_CONFIG_32_1(_loc, _stream_context), \
1218 BT_CODEC_LC3_QOS_7_5_UNFRAMED(60u, 4u, 45u, 40000u) \
1219 )
1220
1227#define BT_AUDIO_LC3_BROADCAST_PRESET_32_2_2(_loc, _stream_context) \
1228 BT_AUDIO_LC3_PRESET( \
1229 BT_CODEC_LC3_CONFIG_32_2(_loc, _stream_context), \
1230 BT_CODEC_LC3_QOS_10_UNFRAMED(80u, 4u, 60u, 40000u) \
1231 )
1232
1239#define BT_AUDIO_LC3_BROADCAST_PRESET_441_1_2(_loc, _stream_context) \
1240 BT_AUDIO_LC3_PRESET( \
1241 BT_CODEC_LC3_CONFIG_441_1(_loc, _stream_context), \
1242 BT_CODEC_QOS(8163u, BT_CODEC_QOS_FRAMED, \
1243 BT_CODEC_QOS_2M, 97u, 4u, 54u, 40000u) \
1244 )
1245
1252#define BT_AUDIO_LC3_BROADCAST_PRESET_441_2_2(_loc, _stream_context) \
1253 BT_AUDIO_LC3_PRESET( \
1254 BT_CODEC_LC3_CONFIG_441_2(_loc, _stream_context), \
1255 BT_CODEC_QOS(10884u, BT_CODEC_QOS_FRAMED, \
1256 BT_CODEC_QOS_2M, 130u, 4u, 60u, 40000u) \
1257 )
1258
1265#define BT_AUDIO_LC3_BROADCAST_PRESET_48_1_2(_loc, _stream_context) \
1266 BT_AUDIO_LC3_PRESET( \
1267 BT_CODEC_LC3_CONFIG_48_1(_loc, _stream_context), \
1268 BT_CODEC_LC3_QOS_7_5_UNFRAMED(75u, 4u, 50u, 40000u) \
1269 )
1270
1277#define BT_AUDIO_LC3_BROADCAST_PRESET_48_2_2(_loc, _stream_context) \
1278 BT_AUDIO_LC3_PRESET( \
1279 BT_CODEC_LC3_CONFIG_48_2(_loc, _stream_context), \
1280 BT_CODEC_LC3_QOS_10_UNFRAMED(100u, 4u, 65u, 40000u) \
1281 )
1282
1289#define BT_AUDIO_LC3_BROADCAST_PRESET_48_3_2(_loc, _stream_context) \
1290 BT_AUDIO_LC3_PRESET( \
1291 BT_CODEC_LC3_CONFIG_48_3(_loc, _stream_context), \
1292 BT_CODEC_LC3_QOS_7_5_UNFRAMED(90u, 4u, 50u, 40000u) \
1293 )
1294
1301#define BT_AUDIO_LC3_BROADCAST_PRESET_48_4_2(_loc, _stream_context) \
1302 BT_AUDIO_LC3_PRESET( \
1303 BT_CODEC_LC3_CONFIG_48_4(_loc, _stream_context), \
1304 BT_CODEC_LC3_QOS_10_UNFRAMED(120u, 4u, 65u, 40000u) \
1305 )
1306
1313#define BT_AUDIO_LC3_BROADCAST_PRESET_48_5_2(_loc, _stream_context) \
1314 BT_AUDIO_LC3_PRESET( \
1315 BT_CODEC_LC3_CONFIG_48_5(_loc, _stream_context), \
1316 BT_CODEC_LC3_QOS_7_5_UNFRAMED(117u, 4u, 50u, 40000u) \
1317 )
1318
1325#define BT_AUDIO_LC3_BROADCAST_PRESET_48_6_2(_loc, _stream_context) \
1326 BT_AUDIO_LC3_PRESET( \
1327 BT_CODEC_LC3_CONFIG_48_6(_loc, _stream_context), \
1328 BT_CODEC_LC3_QOS_10_UNFRAMED(155u, 4u, 65u, 40000u) \
1329 )
1330
1343
1345 struct bt_conn *conn;
1346
1348 struct bt_audio_ep *ep;
1349
1352
1355
1358
1360 struct bt_audio_iso *audio_iso;
1361
1362 union {
1363 void *group;
1364 struct bt_audio_unicast_group *unicast_group;
1365 struct bt_audio_broadcast_source *broadcast_source;
1366 struct bt_audio_broadcast_sink *broadcast_sink;
1367 };
1368
1371
1372 /* Internally used list node */
1373 sys_snode_t _node;
1374};
1375
1389 void (*location)(struct bt_conn *conn, enum bt_audio_dir dir,
1390 enum bt_audio_location loc);
1391
1403 void (*available_contexts)(struct bt_conn *conn,
1404 enum bt_audio_context snk_ctx,
1405 enum bt_audio_context src_ctx);
1406};
1407
1418
1438 int (*config)(struct bt_conn *conn,
1439 const struct bt_audio_ep *ep,
1440 enum bt_audio_dir dir,
1441 const struct bt_codec *codec,
1442 struct bt_audio_stream **stream,
1443 struct bt_codec_qos_pref *const pref);
1444
1459 int (*reconfig)(struct bt_audio_stream *stream,
1460 enum bt_audio_dir dir,
1461 const struct bt_codec *codec,
1462 struct bt_codec_qos_pref *const pref);
1463
1474 int (*qos)(struct bt_audio_stream *stream,
1475 const struct bt_codec_qos *qos);
1476
1488 int (*enable)(struct bt_audio_stream *stream,
1489 const struct bt_codec_data *meta,
1490 size_t meta_count);
1491
1501 int (*start)(struct bt_audio_stream *stream);
1502
1514 int (*metadata)(struct bt_audio_stream *stream,
1515 const struct bt_codec_data *meta,
1516 size_t meta_count);
1517
1527 int (*disable)(struct bt_audio_stream *stream);
1528
1538 int (*stop)(struct bt_audio_stream *stream);
1539
1549 int (*release)(struct bt_audio_stream *stream);
1550};
1551
1566 bool (*scan_recv)(const struct bt_le_scan_recv_info *info,
1567 struct net_buf_simple *ad,
1568 uint32_t broadcast_id);
1569
1581 void (*pa_synced)(struct bt_audio_broadcast_sink *sink,
1582 struct bt_le_per_adv_sync *sync,
1583 uint32_t broadcast_id);
1584
1593 void (*base_recv)(struct bt_audio_broadcast_sink *sink,
1594 const struct bt_audio_base *base);
1595
1608 void (*syncable)(struct bt_audio_broadcast_sink *sink, bool encrypted);
1609
1623 void (*scan_term)(int err);
1624
1634 void (*pa_sync_lost)(struct bt_audio_broadcast_sink *sink);
1635
1636 /* Internally used list node */
1637 sys_snode_t _node;
1638};
1639
1642#if defined(CONFIG_BT_AUDIO_UNICAST)
1651 void (*configured)(struct bt_audio_stream *stream,
1652 const struct bt_codec_qos_pref *pref);
1653
1661 void (*qos_set)(struct bt_audio_stream *stream);
1662
1670 void (*enabled)(struct bt_audio_stream *stream);
1671
1679 void (*metadata_updated)(struct bt_audio_stream *stream);
1680
1688 void (*disabled)(struct bt_audio_stream *stream);
1689
1697 void (*released)(struct bt_audio_stream *stream);
1698#endif /* CONFIG_BT_AUDIO_UNICAST */
1699
1707 void (*started)(struct bt_audio_stream *stream);
1708
1716 void (*stopped)(struct bt_audio_stream *stream);
1717
1718#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_AUDIO_BROADCAST_SINK)
1730 void (*recv)(struct bt_audio_stream *stream,
1731 const struct bt_iso_recv_info *info,
1732 struct net_buf *buf);
1733#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_AUDIO_BROADCAST_SINK */
1734
1735#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
1745 void (*sent)(struct bt_audio_stream *stream);
1746#endif /* CONFIG_BT_AUDIO_UNICAST || CONFIG_BT_AUDIO_BROADCAST_SOURCE */
1747
1748};
1749
1758 struct bt_audio_stream_ops *ops);
1775
1786 /* End of group bt_audio_server */
1788
1796
1802typedef void (*bt_audio_discover_func_t)(struct bt_conn *conn,
1803 struct bt_codec *codec,
1804 struct bt_audio_ep *ep,
1805 struct bt_audio_discover_params *params);
1806
1820};
1821
1833int bt_audio_discover(struct bt_conn *conn,
1834 struct bt_audio_discover_params *params);
1835
1848int bt_audio_stream_config(struct bt_conn *conn,
1849 struct bt_audio_stream *stream,
1850 struct bt_audio_ep *ep,
1851 struct bt_codec *codec);
1852
1866 struct bt_codec *codec);
1867
1880int bt_audio_stream_qos(struct bt_conn *conn,
1881 struct bt_audio_unicast_group *group);
1882
1897 struct bt_codec_data *meta,
1898 size_t meta_count);
1899
1912 struct bt_codec_data *meta,
1913 size_t meta_count);
1914
1928
1943
1957
1973
1994int bt_audio_stream_send(struct bt_audio_stream *stream, struct net_buf *buf,
1995 uint16_t seq_num, uint32_t ts);
1996
2000
2003};
2004
2013
2016};
2017
2021
2024
2033};
2034
2047 struct bt_audio_unicast_group **unicast_group);
2048
2071int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_group,
2073 size_t num_param);
2074
2084int bt_audio_unicast_group_delete(struct bt_audio_unicast_group *unicast_group);
2085 /* End of group bt_audio_client */
2087
2088
2098
2104
2107};
2108
2112
2115
2118};
2119
2123
2126
2129
2138
2141
2153};
2154
2173 struct bt_audio_broadcast_source **source);
2174
2186int bt_audio_broadcast_source_reconfig(struct bt_audio_broadcast_source *source,
2187 struct bt_codec *codec,
2188 struct bt_codec_qos *qos);
2189
2202int bt_audio_broadcast_source_update_metadata(struct bt_audio_broadcast_source *source,
2203 const struct bt_codec_data meta[],
2204 size_t meta_count);
2205
2218int bt_audio_broadcast_source_start(struct bt_audio_broadcast_source *source,
2219 struct bt_le_ext_adv *adv);
2220
2231int bt_audio_broadcast_source_stop(struct bt_audio_broadcast_source *source);
2232
2243int bt_audio_broadcast_source_delete(struct bt_audio_broadcast_source *source);
2244
2259int bt_audio_broadcast_source_get_id(const struct bt_audio_broadcast_source *source,
2260 uint32_t *const broadcast_id);
2261
2277int bt_audio_broadcast_source_get_base(struct bt_audio_broadcast_source *source,
2278 struct net_buf_simple *base_buf);
2279
2285
2299
2308
2331int bt_audio_broadcast_sink_sync(struct bt_audio_broadcast_sink *sink,
2332 uint32_t indexes_bitfield,
2333 struct bt_audio_stream *streams[],
2334 const uint8_t broadcast_code[16]);
2335
2346int bt_audio_broadcast_sink_stop(struct bt_audio_broadcast_sink *sink);
2347
2359int bt_audio_broadcast_sink_delete(struct bt_audio_broadcast_sink *sink);
2360 /* End of bt_audio_broadcast */
2362
2363
2377
2380
2383
2386
2389};
2390
2398int bt_codec_cfg_get_freq(const struct bt_codec *codec);
2399
2408
2423int bt_codec_cfg_get_chan_allocation_val(const struct bt_codec *codec, uint32_t *chan_allocation);
2424
2442
2462int bt_codec_cfg_get_frame_blocks_per_sdu(const struct bt_codec *codec, bool fallback_to_default);
2463
2479bool bt_codec_get_val(const struct bt_codec *codec,
2480 uint8_t type,
2481 const struct bt_codec_data **data);
2482 /* End of bt_audio_codec_cfg */
2484
2485#ifdef __cplusplus
2486}
2487#endif
2488 /* end of bt_audio */
2490
2491#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_H_ */
Header for Bluetooth BAP.
#define BT_BAP_BROADCAST_CODE_SIZE
Definition: bap.h:23
Bluetooth data buffer API.
Bluetooth connection handling.
Generic Attribute Profile handling.
static ssize_t recv(int sock, void *buf, size_t max_len, int flags)
Definition: socket.h:744
int bt_audio_broadcast_sink_delete(struct bt_audio_broadcast_sink *sink)
Release a broadcast sink.
int bt_audio_broadcast_source_update_metadata(struct bt_audio_broadcast_source *source, const struct bt_codec_data meta[], size_t meta_count)
Modify the metadata of an audio broadcast source.
int bt_audio_broadcast_source_delete(struct bt_audio_broadcast_source *source)
Delete audio broadcast source.
int bt_audio_broadcast_source_get_base(struct bt_audio_broadcast_source *source, struct net_buf_simple *base_buf)
Get the Broadcast Audio Stream Endpoint of a broadcast source.
void bt_audio_broadcast_sink_register_cb(struct bt_audio_broadcast_sink_cb *cb)
Register Broadcast sink callbacks *.
int bt_audio_broadcast_source_start(struct bt_audio_broadcast_source *source, struct bt_le_ext_adv *adv)
Start audio broadcast source.
int bt_audio_broadcast_sink_scan_start(const struct bt_le_scan_param *param)
Start scan for broadcast sources.
int bt_audio_broadcast_source_get_id(const struct bt_audio_broadcast_source *source, uint32_t *const broadcast_id)
Get the broadcast ID of a broadcast source.
int bt_audio_broadcast_sink_stop(struct bt_audio_broadcast_sink *sink)
Stop audio broadcast sink.
int bt_audio_broadcast_sink_scan_stop(void)
Stop scan for broadcast sources.
int bt_audio_broadcast_source_reconfig(struct bt_audio_broadcast_source *source, struct bt_codec *codec, struct bt_codec_qos *qos)
Reconfigure audio broadcast source.
int bt_audio_broadcast_source_stop(struct bt_audio_broadcast_source *source)
Stop audio broadcast source.
int bt_audio_broadcast_source_create(struct bt_audio_broadcast_source_create_param *param, struct bt_audio_broadcast_source **source)
Create audio broadcast source.
int bt_audio_broadcast_sink_sync(struct bt_audio_broadcast_sink *sink, uint32_t indexes_bitfield, struct bt_audio_stream *streams[], const uint8_t broadcast_code[16])
Sync to a broadcaster's audio.
int bt_audio_stream_release(struct bt_audio_stream *stream)
Release Audio Stream.
int bt_audio_stream_reconfig(struct bt_audio_stream *stream, struct bt_codec *codec)
Reconfigure Audio Stream.
int bt_audio_stream_enable(struct bt_audio_stream *stream, struct bt_codec_data *meta, size_t meta_count)
Enable Audio Stream.
int bt_audio_stream_start(struct bt_audio_stream *stream)
Start Audio Stream.
int bt_audio_stream_qos(struct bt_conn *conn, struct bt_audio_unicast_group *group)
Configure Audio Stream QoS.
int bt_audio_unicast_group_delete(struct bt_audio_unicast_group *unicast_group)
Delete audio unicast group.
int bt_audio_discover(struct bt_conn *conn, struct bt_audio_discover_params *params)
Discover remote capabilities and endpoints.
void(* bt_audio_discover_func_t)(struct bt_conn *conn, struct bt_codec *codec, struct bt_audio_ep *ep, struct bt_audio_discover_params *params)
Discover Audio capabilities and endpoints callback function.
Definition: audio.h:1802
int bt_audio_stream_stop(struct bt_audio_stream *stream)
Stop Audio Stream.
int bt_audio_stream_send(struct bt_audio_stream *stream, struct net_buf *buf, uint16_t seq_num, uint32_t ts)
Send data to Audio stream.
int bt_audio_stream_config(struct bt_conn *conn, struct bt_audio_stream *stream, struct bt_audio_ep *ep, struct bt_codec *codec)
Configure Audio Stream.
int bt_audio_unicast_group_create(struct bt_audio_unicast_group_param *param, struct bt_audio_unicast_group **unicast_group)
Create audio unicast group.
int bt_audio_stream_disable(struct bt_audio_stream *stream)
Disable Audio Stream.
int bt_audio_stream_metadata(struct bt_audio_stream *stream, struct bt_codec_data *meta, size_t meta_count)
Change Audio Stream Metadata.
int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_group, struct bt_audio_unicast_group_stream_pair_param params[], size_t num_param)
Add streams to a unicast group as a unicast client.
bt_audio_codec_parse_err
Codec parser error codes for Codec config parsing APIs.
Definition: audio.h:2376
int bt_codec_cfg_get_octets_per_frame(const struct bt_codec *codec)
Extract frame size in octets from BT codec config.
int bt_codec_cfg_get_frame_blocks_per_sdu(const struct bt_codec *codec, bool fallback_to_default)
Extract number of audio frame blockss in each SDU from BT codec config.
bool bt_codec_get_val(const struct bt_codec *codec, uint8_t type, const struct bt_codec_data **data)
Lookup a specific value based on type.
int bt_codec_cfg_get_freq(const struct bt_codec *codec)
Extract the frequency from a codec configuration.
int bt_codec_cfg_get_frame_duration_us(const struct bt_codec *codec)
Extract frame duration from BT codec config.
int bt_codec_cfg_get_chan_allocation_val(const struct bt_codec *codec, uint32_t *chan_allocation)
Extract channel allocation from BT codec config.
@ BT_AUDIO_CODEC_PARSE_ERR_SUCCESS
The requested type is not present in the data set.
Definition: audio.h:2379
@ BT_AUDIO_CODEC_PARSE_ERR_TYPE_NOT_FOUND
The requested type is not present in the data set.
Definition: audio.h:2382
@ BT_AUDIO_CODEC_PARSE_ERR_INVALID_VALUE_FOUND
The value found is invalid.
Definition: audio.h:2385
@ BT_AUDIO_CODEC_PARSE_ERR_INVALID_PARAM
The parameters specified to the function call are not valid.
Definition: audio.h:2388
int bt_audio_unicast_server_register_cb(const struct bt_audio_unicast_server_cb *cb)
Register unicast server callbacks.
int bt_audio_unicast_server_unregister_cb(const struct bt_audio_unicast_server_cb *cb)
Unregister unicast server callbacks.
bt_audio_active_state
Audio Active State defined by the Generic Audio assigned numbers (bluetooth.com).
Definition: audio.h:98
int bt_audio_unicast_client_register_cb(const struct bt_audio_unicast_client_cb *cb)
Register unicast client callbacks.
#define BROADCAST_SNK_SUBGROUP_CNT
Definition: audio.h:177
bt_audio_dir
Audio Capability type.
Definition: audio.h:369
#define BROADCAST_SNK_STREAM_CNT
Definition: audio.h:176
bt_audio_location
Location values for BT Audio.
Definition: audio.h:239
bt_audio_parental_rating
Parental rating defined by the Generic Audio assigned numbers (bluetooth.com).
Definition: audio.h:78
void bt_audio_stream_cb_register(struct bt_audio_stream *stream, struct bt_audio_stream_ops *ops)
Register Audio callbacks for a stream.
#define BT_CODEC_QOS_FRAMED(_interval, _sdu, _rtn, _latency, _pd)
Helper to declare Input Framed bt_codec_qos.
Definition: audio.h:432
#define BT_CODEC_QOS_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd)
Helper to declare Input Unframed bt_codec_qos.
Definition: audio.h:419
bt_audio_metadata_type
Codec metadata type IDs.
Definition: audio.h:108
bt_audio_context
Audio Context Type for Generic Audio.
Definition: audio.h:40
@ BT_AUDIO_ACTIVE_STATE_ENABLED
Definition: audio.h:100
@ BT_AUDIO_ACTIVE_STATE_DISABLED
Definition: audio.h:99
@ BT_CODEC_QOS_2M
Definition: audio.h:406
@ BT_CODEC_QOS_CODED
Definition: audio.h:407
@ BT_CODEC_QOS_1M
Definition: audio.h:405
@ BT_AUDIO_DIR_SINK
Definition: audio.h:370
@ BT_AUDIO_DIR_SOURCE
Definition: audio.h:371
@ BT_AUDIO_LOCATION_FRONT_CENTER
Definition: audio.h:243
@ BT_AUDIO_LOCATION_TOP_BACK_LEFT
Definition: audio.h:257
@ BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2
Definition: audio.h:250
@ BT_AUDIO_LOCATION_TOP_SIDE_RIGHT
Definition: audio.h:260
@ BT_AUDIO_LOCATION_FRONT_RIGHT
Definition: audio.h:242
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT
Definition: audio.h:264
@ BT_AUDIO_LOCATION_BACK_RIGHT
Definition: audio.h:246
@ BT_AUDIO_LOCATION_TOP_CENTER
Definition: audio.h:256
@ BT_AUDIO_LOCATION_LEFT_SURROUND
Definition: audio.h:267
@ BT_AUDIO_LOCATION_TOP_FRONT_RIGHT
Definition: audio.h:254
@ BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER
Definition: audio.h:248
@ BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE
Definition: audio.h:266
@ BT_AUDIO_LOCATION_TOP_BACK_RIGHT
Definition: audio.h:258
@ BT_AUDIO_LOCATION_BACK_LEFT
Definition: audio.h:245
@ BT_AUDIO_LOCATION_RIGHT_SURROUND
Definition: audio.h:268
@ BT_AUDIO_LOCATION_SIDE_RIGHT
Definition: audio.h:252
@ BT_AUDIO_LOCATION_TOP_FRONT_LEFT
Definition: audio.h:253
@ BT_AUDIO_LOCATION_SIDE_LEFT
Definition: audio.h:251
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT
Definition: audio.h:263
@ BT_AUDIO_LOCATION_TOP_FRONT_CENTER
Definition: audio.h:255
@ BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1
Definition: audio.h:244
@ BT_AUDIO_LOCATION_FRONT_LEFT
Definition: audio.h:241
@ BT_AUDIO_LOCATION_FRONT_LEFT_WIDE
Definition: audio.h:265
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER
Definition: audio.h:262
@ BT_AUDIO_LOCATION_PROHIBITED
Definition: audio.h:240
@ BT_AUDIO_LOCATION_BACK_CENTER
Definition: audio.h:249
@ BT_AUDIO_LOCATION_TOP_SIDE_LEFT
Definition: audio.h:259
@ BT_AUDIO_LOCATION_TOP_BACK_CENTER
Definition: audio.h:261
@ BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER
Definition: audio.h:247
@ BT_AUDIO_PARENTAL_RATING_AGE_18_OR_ABOVE
Definition: audio.h:94
@ BT_AUDIO_PARENTAL_RATING_AGE_15_OR_ABOVE
Definition: audio.h:91
@ BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE
Definition: audio.h:86
@ BT_AUDIO_PARENTAL_RATING_AGE_7_OR_ABOVE
Definition: audio.h:83
@ BT_AUDIO_PARENTAL_RATING_AGE_16_OR_ABOVE
Definition: audio.h:92
@ BT_AUDIO_PARENTAL_RATING_AGE_17_OR_ABOVE
Definition: audio.h:93
@ BT_AUDIO_PARENTAL_RATING_AGE_5_OR_ABOVE
Definition: audio.h:81
@ BT_AUDIO_PARENTAL_RATING_AGE_8_OR_ABOVE
Definition: audio.h:84
@ BT_AUDIO_PARENTAL_RATING_AGE_13_OR_ABOVE
Definition: audio.h:89
@ BT_AUDIO_PARENTAL_RATING_AGE_9_OR_ABOVE
Definition: audio.h:85
@ BT_AUDIO_PARENTAL_RATING_AGE_11_OR_ABOVE
Definition: audio.h:87
@ BT_AUDIO_PARENTAL_RATING_AGE_12_OR_ABOVE
Definition: audio.h:88
@ BT_AUDIO_PARENTAL_RATING_AGE_6_OR_ABOVE
Definition: audio.h:82
@ BT_AUDIO_PARENTAL_RATING_AGE_ANY
Definition: audio.h:80
@ BT_AUDIO_PARENTAL_RATING_NO_RATING
Definition: audio.h:79
@ BT_AUDIO_PARENTAL_RATING_AGE_14_OR_ABOVE
Definition: audio.h:90
@ BT_AUDIO_METADATA_TYPE_PROGRAM_INFO
Definition: audio.h:132
@ BT_AUDIO_METADATA_TYPE_EXTENDED
Definition: audio.h:162
@ BT_AUDIO_METADATA_TYPE_VENDOR
Definition: audio.h:165
@ BT_AUDIO_METADATA_TYPE_CCID_LIST
Definition: audio.h:141
@ BT_AUDIO_METADATA_TYPE_BROADCAST_IMMEDIATE
Definition: audio.h:159
@ BT_AUDIO_METADATA_TYPE_PROGRAM_INFO_URI
Definition: audio.h:150
@ BT_AUDIO_METADATA_TYPE_PARENTAL_RATING
Parental rating.
Definition: audio.h:147
@ BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT
Streaming audio context.
Definition: audio.h:129
@ BT_AUDIO_METADATA_TYPE_PREF_CONTEXT
Preferred audio context.
Definition: audio.h:118
@ BT_AUDIO_METADATA_TYPE_STREAM_LANG
Stream language.
Definition: audio.h:138
@ BT_AUDIO_METADATA_TYPE_AUDIO_STATE
Audio active state.
Definition: audio.h:156
@ BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS
Definition: audio.h:50
@ BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM
Definition: audio.h:53
@ BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL
Definition: audio.h:46
@ BT_AUDIO_CONTEXT_TYPE_PROHIBITED
Definition: audio.h:41
@ BT_AUDIO_CONTEXT_TYPE_RINGTONE
Definition: audio.h:51
@ BT_AUDIO_CONTEXT_TYPE_LIVE
Definition: audio.h:48
@ BT_AUDIO_CONTEXT_TYPE_MEDIA
Definition: audio.h:44
@ BT_AUDIO_CONTEXT_TYPE_GAME
Definition: audio.h:45
@ BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS
Definition: audio.h:49
@ BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS
Definition: audio.h:47
@ BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL
Definition: audio.h:43
@ BT_AUDIO_CONTEXT_TYPE_ALERTS
Definition: audio.h:52
@ BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED
Definition: audio.h:42
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
Bluetooth ISO handling.
Bluetooth LC3 codec handling.
struct _snode sys_snode_t
Definition: slist.h:33
#define bool
Definition: stdbool.h:13
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Definition: audio.h:331
uint8_t index
Definition: audio.h:333
Definition: audio.h:348
size_t bis_count
Definition: audio.h:350
struct bt_audio_base_bis_data bis_data[0]
Definition: audio.h:358
struct bt_codec codec
Definition: audio.h:356
Definition: audio.h:361
struct bt_audio_base_subgroup subgroups[0]
Definition: audio.h:365
size_t subgroup_count
Definition: audio.h:363
Definition: audio.h:1553
void(* scan_term)(int err)
Scan terminated callback.
Definition: audio.h:1623
bool(* scan_recv)(const struct bt_le_scan_recv_info *info, struct net_buf_simple *ad, uint32_t broadcast_id)
Scan receive callback.
Definition: audio.h:1566
void(* syncable)(struct bt_audio_broadcast_sink *sink, bool encrypted)
Broadcast sink is syncable.
Definition: audio.h:1608
void(* pa_synced)(struct bt_audio_broadcast_sink *sink, struct bt_le_per_adv_sync *sync, uint32_t broadcast_id)
Periodic advertising sync callback.
Definition: audio.h:1581
void(* base_recv)(struct bt_audio_broadcast_sink *sink, const struct bt_audio_base *base)
Broadcast Audio Source Endpoint (BASE) received.
Definition: audio.h:1593
void(* pa_sync_lost)(struct bt_audio_broadcast_sink *sink)
Periodic advertising synchronization lost callback.
Definition: audio.h:1634
struct bt_audio_broadcast_source_subgroup_param * params
Definition: audio.h:2125
struct bt_codec_qos * qos
Definition: audio.h:2128
uint8_t broadcast_code[BT_BAP_BROADCAST_CODE_SIZE]
Broadcast code.
Definition: audio.h:2152
size_t params_count
Definition: audio.h:2122
bool encryption
Definition: audio.h:2140
uint8_t packing
Broadcast Source packing mode.
Definition: audio.h:2137
struct bt_audio_stream * stream
Definition: audio.h:2097
size_t data_count
Definition: audio.h:2103
struct bt_codec_data * data
Definition: audio.h:2106
struct bt_codec * codec
Definition: audio.h:2117
size_t params_count
Definition: audio.h:2111
struct bt_audio_broadcast_source_stream_param * params
Definition: audio.h:2114
Definition: audio.h:1807
uint8_t num_caps
Definition: audio.h:1813
uint8_t err
Definition: audio.h:1817
enum bt_audio_dir dir
Definition: audio.h:1809
uint8_t num_eps
Definition: audio.h:1815
struct bt_gatt_read_params read
Definition: audio.h:1818
struct bt_gatt_discover_params discover
Definition: audio.h:1819
bt_audio_discover_func_t func
Definition: audio.h:1811
Definition: audio.h:524
struct bt_codec codec
Definition: audio.h:526
struct bt_codec_qos qos
Definition: audio.h:528
Stream operation.
Definition: audio.h:1641
void(* stopped)(struct bt_audio_stream *stream)
Stream stopped callback.
Definition: audio.h:1716
void(* started)(struct bt_audio_stream *stream)
Stream started callback.
Definition: audio.h:1707
Audio stream structure.
Definition: audio.h:1340
struct bt_audio_stream_ops * ops
Definition: audio.h:1357
struct bt_audio_unicast_group * unicast_group
Definition: audio.h:1364
struct bt_audio_broadcast_sink * broadcast_sink
Definition: audio.h:1366
struct bt_codec * codec
Definition: audio.h:1351
enum bt_audio_dir dir
Definition: audio.h:1342
void * group
Definition: audio.h:1363
struct bt_conn * conn
Definition: audio.h:1345
struct bt_audio_ep * ep
Definition: audio.h:1348
struct bt_audio_broadcast_source * broadcast_source
Definition: audio.h:1365
struct bt_audio_iso * audio_iso
Definition: audio.h:1360
struct bt_codec_qos * qos
Definition: audio.h:1354
void * user_data
Definition: audio.h:1370
Definition: audio.h:1377
void(* available_contexts)(struct bt_conn *conn, enum bt_audio_context snk_ctx, enum bt_audio_context src_ctx)
Remote Unicast Server Available Contexts.
Definition: audio.h:1403
void(* location)(struct bt_conn *conn, enum bt_audio_dir dir, enum bt_audio_location loc)
Remote Unicast Server Audio Locations.
Definition: audio.h:1389
Definition: audio.h:2018
uint8_t packing
Unicast Group packing mode.
Definition: audio.h:2032
size_t params_count
Definition: audio.h:2020
struct bt_audio_unicast_group_stream_pair_param * params
Definition: audio.h:2023
Parameter struct for the unicast group functions.
Definition: audio.h:2010
struct bt_audio_unicast_group_stream_param * tx_param
Definition: audio.h:2015
struct bt_audio_unicast_group_stream_param * rx_param
Definition: audio.h:2012
Definition: audio.h:1997
struct bt_audio_stream * stream
Definition: audio.h:1999
struct bt_codec_qos * qos
Definition: audio.h:2002
Definition: audio.h:1420
int(* reconfig)(struct bt_audio_stream *stream, enum bt_audio_dir dir, const struct bt_codec *codec, struct bt_codec_qos_pref *const pref)
Stream reconfig request callback.
Definition: audio.h:1459
int(* qos)(struct bt_audio_stream *stream, const struct bt_codec_qos *qos)
Stream QoS request callback.
Definition: audio.h:1474
int(* start)(struct bt_audio_stream *stream)
Stream Start request callback.
Definition: audio.h:1501
int(* stop)(struct bt_audio_stream *stream)
Stream Stop callback.
Definition: audio.h:1538
int(* enable)(struct bt_audio_stream *stream, const struct bt_codec_data *meta, size_t meta_count)
Stream Enable request callback.
Definition: audio.h:1488
int(* disable)(struct bt_audio_stream *stream)
Stream Disable request callback.
Definition: audio.h:1527
int(* release)(struct bt_audio_stream *stream)
Stream release callback.
Definition: audio.h:1549
int(* config)(struct bt_conn *conn, const struct bt_audio_ep *ep, enum bt_audio_dir dir, const struct bt_codec *codec, struct bt_audio_stream **stream, struct bt_codec_qos_pref *const pref)
Endpoint config request callback.
Definition: audio.h:1438
int(* metadata)(struct bt_audio_stream *stream, const struct bt_codec_data *meta, size_t meta_count)
Stream Metadata update request callback.
Definition: audio.h:1514
Codec configuration structure.
Definition: audio.h:190
struct bt_data data
Definition: audio.h:191
Audio Stream Quality of Service Preference structure.
Definition: audio.h:485
bool unframed_supported
Unframed PDUs supported.
Definition: audio.h:491
uint32_t pd_min
Minimum Presentation Delay.
Definition: audio.h:507
uint32_t pref_pd_min
Preferred minimum Presentation Delay.
Definition: audio.h:517
uint32_t pd_max
Maximum Presentation Delay.
Definition: audio.h:514
uint8_t rtn
Definition: audio.h:497
uint8_t phy
Definition: audio.h:494
uint16_t latency
Definition: audio.h:500
uint32_t pref_pd_max
Preferred maximum Presentation Delay
Definition: audio.h:520
Codec QoS structure.
Definition: audio.h:437
uint8_t phy
Definition: audio.h:439
uint8_t framing
Definition: audio.h:442
uint32_t pd
Definition: audio.h:456
uint16_t latency
Definition: audio.h:451
uint32_t interval
Definition: audio.h:454
uint8_t rtn
Definition: audio.h:445
uint16_t sdu
Definition: audio.h:448
Codec structure.
Definition: audio.h:304
uint16_t cid
Definition: audio.h:314
uint8_t id
Definition: audio.h:312
uint16_t vid
Definition: audio.h:316
uint8_t path_id
Definition: audio.h:310
Bluetooth data.
Definition: bluetooth.h:356
GATT Discover Attributes parameters.
Definition: gatt.h:1430
GATT Read parameters.
Definition: gatt.h:1518
ISO Meta Data structure for received ISO packets.
Definition: iso.h:222
Definition: bluetooth.h:1752
Definition: bluetooth.h:1789
Simple network buffer representation.
Definition: buf.h:82
Network buffer representation.
Definition: buf.h:905
static fdata_t data[2]
Definition: test_fifo_contexts.c:15