11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_AUDIO_H_
12#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_AUDIO_H_
33#define BT_AUDIO_BROADCAST_ID_SIZE 3
42#define BT_AUDIO_CONTEXT_TYPE_PROHIBITED 0
48#define BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED BIT(0)
54#define BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL BIT(1)
61#define BT_AUDIO_CONTEXT_TYPE_MEDIA BIT(2)
68#define BT_AUDIO_CONTEXT_TYPE_GAME BIT(3)
74#define BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL BIT(4)
80#define BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS BIT(5)
87#define BT_AUDIO_CONTEXT_TYPE_LIVE BIT(6)
94#define BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS BIT(7)
101#define BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS BIT(8)
108#define BT_AUDIO_CONTEXT_TYPE_RINGTONE BIT(9)
115#define BT_AUDIO_CONTEXT_TYPE_ALERTS BIT(10)
121#define BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM BIT(11)
126#define BT_AUDIO_CONTEXT_TYPE_ANY (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED | \
127 BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL | \
128 BT_AUDIO_CONTEXT_TYPE_MEDIA | \
129 BT_AUDIO_CONTEXT_TYPE_GAME | \
130 BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL | \
131 BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS | \
132 BT_AUDIO_CONTEXT_TYPE_LIVE | \
133 BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS | \
134 BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS | \
135 BT_AUDIO_CONTEXT_TYPE_RINGTONE | \
136 BT_AUDIO_CONTEXT_TYPE_ALERTS | \
137 BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM)
141#define BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL 0x00
142#define BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED 0x01
144#if defined(CONFIG_BT_AUDIO_BROADCAST_SINK)
145#define BROADCAST_SNK_STREAM_CNT CONFIG_BT_AUDIO_BROADCAST_SNK_STREAM_COUNT
146#define BROADCAST_SNK_SUBGROUP_CNT CONFIG_BT_AUDIO_BROADCAST_SNK_SUBGROUP_COUNT
148#define BROADCAST_SNK_STREAM_CNT 0
149#define BROADCAST_SNK_SUBGROUP_CNT 0
153struct bt_audio_unicast_group;
156struct bt_audio_broadcast_sink;
159struct bt_audio_broadcast_source;
177#define BT_CODEC_DATA(_type, _bytes...) \
179 .data = BT_DATA(_type, ((uint8_t []) { _bytes }), \
180 sizeof((uint8_t []) { _bytes })) \
192#define BT_CODEC(_id, _cid, _vid, _data, _meta) \
197 .data_count = ARRAY_SIZE(((struct bt_codec_data[]) _data)), \
199 .meta_count = ARRAY_SIZE(((struct bt_codec_data[]) _meta)), \
325#define BT_CODEC_QOS(_interval, _framing, _phy, _sdu, _rtn, _latency, \
328 .interval = _interval, \
329 .framing = _framing, \
333 .latency = _latency, \
359#define BT_CODEC_QOS_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd) \
360 BT_CODEC_QOS(_interval, BT_CODEC_QOS_UNFRAMED, BT_CODEC_QOS_2M, _sdu, \
372#define BT_CODEC_QOS_FRAMED(_interval, _sdu, _rtn, _latency, _pd) \
373 BT_CODEC_QOS(_interval, BT_CODEC_QOS_FRAMED, BT_CODEC_QOS_2M, _sdu, \
411#define BT_CODEC_QOS_PREF(_unframed_supported, _phy, _rtn, _latency, _pd_min, \
412 _pd_max, _pref_pd_min, _pref_pd_max) \
414 .unframed_supported = _unframed_supported, \
417 .latency = _latency, \
420 .pref_pd_min = _pref_pd_min, \
421 .pref_pd_max = _pref_pd_max, \
472#define BT_AUDIO_LC3_PRESET(_codec, _qos) \
479#define BT_AUDIO_LC3_UNICAST_PRESET_8_1_1 \
480 BT_AUDIO_LC3_PRESET( \
481 BT_CODEC_LC3_CONFIG_8_1, \
482 BT_CODEC_LC3_QOS_7_5_UNFRAMED(26u, 2u, 8u, 40000u) \
485#define BT_AUDIO_LC3_UNICAST_PRESET_8_2_1 \
486 BT_AUDIO_LC3_PRESET( \
487 BT_CODEC_LC3_CONFIG_8_2, \
488 BT_CODEC_LC3_QOS_10_UNFRAMED(30u, 2u, 10u, 40000u) \
491#define BT_AUDIO_LC3_UNICAST_PRESET_16_1_1 \
492 BT_AUDIO_LC3_PRESET( \
493 BT_CODEC_LC3_CONFIG_16_1, \
494 BT_CODEC_LC3_QOS_7_5_UNFRAMED(30u, 2u, 8u, 40000u) \
498#define BT_AUDIO_LC3_UNICAST_PRESET_16_2_1 \
499 BT_AUDIO_LC3_PRESET( \
500 BT_CODEC_LC3_CONFIG_16_2, \
501 BT_CODEC_LC3_QOS_10_UNFRAMED(40u, 2u, 10u, 40000u) \
504#define BT_AUDIO_LC3_UNICAST_PRESET_24_1_1 \
505 BT_AUDIO_LC3_PRESET( \
506 BT_CODEC_LC3_CONFIG_24_1, \
507 BT_CODEC_LC3_QOS_7_5_UNFRAMED(45u, 2u, 8u, 40000u) \
511#define BT_AUDIO_LC3_UNICAST_PRESET_24_2_1 \
512 BT_AUDIO_LC3_PRESET( \
513 BT_CODEC_LC3_CONFIG_24_2, \
514 BT_CODEC_LC3_QOS_10_UNFRAMED(60u, 2u, 10u, 40000u) \
517#define BT_AUDIO_LC3_UNICAST_PRESET_32_1_1 \
518 BT_AUDIO_LC3_PRESET( \
519 BT_CODEC_LC3_CONFIG_32_1, \
520 BT_CODEC_LC3_QOS_7_5_UNFRAMED(60u, 2u, 8u, 40000u) \
523#define BT_AUDIO_LC3_UNICAST_PRESET_32_2_1 \
524 BT_AUDIO_LC3_PRESET( \
525 BT_CODEC_LC3_CONFIG_32_2, \
526 BT_CODEC_LC3_QOS_10_UNFRAMED(80u, 2u, 10u, 40000u) \
529#define BT_AUDIO_LC3_UNICAST_PRESET_441_1_1 \
530 BT_AUDIO_LC3_PRESET( \
531 BT_CODEC_LC3_CONFIG_441_1, \
532 BT_CODEC_QOS(8163u, BT_CODEC_QOS_FRAMED, \
533 BT_CODEC_QOS_2M, 97u, 5u, 24u, 40000u) \
536#define BT_AUDIO_LC3_UNICAST_PRESET_441_2_1 \
537 BT_AUDIO_LC3_PRESET( \
538 BT_CODEC_LC3_CONFIG_441_2, \
539 BT_CODEC_QOS(10884u, BT_CODEC_QOS_FRAMED, \
540 BT_CODEC_QOS_2M, 130u, 5u, 31u, 40000u) \
543#define BT_AUDIO_LC3_UNICAST_PRESET_48_1_1 \
544 BT_AUDIO_LC3_PRESET( \
545 BT_CODEC_LC3_CONFIG_48_1, \
546 BT_CODEC_LC3_QOS_7_5_UNFRAMED(75u, 5u, 15u, 40000u) \
549#define BT_AUDIO_LC3_UNICAST_PRESET_48_2_1 \
550 BT_AUDIO_LC3_PRESET( \
551 BT_CODEC_LC3_CONFIG_48_2, \
552 BT_CODEC_LC3_QOS_10_UNFRAMED(100u, 5u, 20u, 40000u) \
555#define BT_AUDIO_LC3_UNICAST_PRESET_48_3_1 \
556 BT_AUDIO_LC3_PRESET( \
557 BT_CODEC_LC3_CONFIG_48_3, \
558 BT_CODEC_LC3_QOS_7_5_UNFRAMED(90u, 5u, 15u, 40000u) \
561#define BT_AUDIO_LC3_UNICAST_PRESET_48_4_1 \
562 BT_AUDIO_LC3_PRESET( \
563 BT_CODEC_LC3_CONFIG_48_4, \
564 BT_CODEC_LC3_QOS_10_UNFRAMED(120u, 5u, 20u, 40000u) \
567#define BT_AUDIO_LC3_UNICAST_PRESET_48_5_1 \
568 BT_AUDIO_LC3_PRESET( \
569 BT_CODEC_LC3_CONFIG_48_5, \
570 BT_CODEC_LC3_QOS_7_5_UNFRAMED(117u, 5u, 15u, 40000u) \
573#define BT_AUDIO_LC3_UNICAST_PRESET_48_6_1 \
574 BT_AUDIO_LC3_PRESET( \
575 BT_CODEC_LC3_CONFIG_48_6, \
576 BT_CODEC_LC3_QOS_10_UNFRAMED(155u, 5u, 20u, 40000u) \
580#define BT_AUDIO_LC3_UNICAST_PRESET_8_1_2 \
581 BT_AUDIO_LC3_PRESET( \
582 BT_CODEC_LC3_CONFIG_8_1, \
583 BT_CODEC_LC3_QOS_7_5_UNFRAMED(26u, 13u, 75u, 40000u) \
586#define BT_AUDIO_LC3_UNICAST_PRESET_8_2_2 \
587 BT_AUDIO_LC3_PRESET( \
588 BT_CODEC_LC3_CONFIG_8_2, \
589 BT_CODEC_LC3_QOS_10_UNFRAMED(30u, 13u, 95u, 40000u) \
592#define BT_AUDIO_LC3_UNICAST_PRESET_16_1_2 \
593 BT_AUDIO_LC3_PRESET( \
594 BT_CODEC_LC3_CONFIG_16_1, \
595 BT_CODEC_LC3_QOS_7_5_UNFRAMED(30u, 13u, 75u, 40000u) \
598#define BT_AUDIO_LC3_UNICAST_PRESET_16_2_2 \
599 BT_AUDIO_LC3_PRESET( \
600 BT_CODEC_LC3_CONFIG_16_2, \
601 BT_CODEC_LC3_QOS_10_UNFRAMED(40u, 13u, 95u, 40000u) \
604#define BT_AUDIO_LC3_UNICAST_PRESET_24_1_2 \
605 BT_AUDIO_LC3_PRESET( \
606 BT_CODEC_LC3_CONFIG_24_1, \
607 BT_CODEC_LC3_QOS_7_5_UNFRAMED(45u, 13u, 75u, 40000u) \
610#define BT_AUDIO_LC3_UNICAST_PRESET_24_2_2 \
611 BT_AUDIO_LC3_PRESET( \
612 BT_CODEC_LC3_CONFIG_24_2, \
613 BT_CODEC_LC3_QOS_10_UNFRAMED(60u, 13u, 95u, 40000u) \
616#define BT_AUDIO_LC3_UNICAST_PRESET_32_1_2 \
617 BT_AUDIO_LC3_PRESET( \
618 BT_CODEC_LC3_CONFIG_32_1, \
619 BT_CODEC_LC3_QOS_7_5_UNFRAMED(60u, 13u, 75u, 40000u) \
622#define BT_AUDIO_LC3_UNICAST_PRESET_32_2_2 \
623 BT_AUDIO_LC3_PRESET( \
624 BT_CODEC_LC3_CONFIG_32_2, \
625 BT_CODEC_LC3_QOS_10_UNFRAMED(80u, 13u, 95u, 40000u) \
628#define BT_AUDIO_LC3_UNICAST_PRESET_441_1_2 \
629 BT_AUDIO_LC3_PRESET( \
630 BT_CODEC_LC3_CONFIG_441_1, \
631 BT_CODEC_QOS(8163u, BT_CODEC_QOS_FRAMED, \
632 BT_CODEC_QOS_2M, 97u, 13u, 80u, 40000u) \
635#define BT_AUDIO_LC3_UNICAST_PRESET_441_2_2 \
636 BT_AUDIO_LC3_PRESET( \
637 BT_CODEC_LC3_CONFIG_441_2, \
638 BT_CODEC_QOS(10884u, BT_CODEC_QOS_FRAMED, \
639 BT_CODEC_QOS_2M, 130u, 13u, 85u, 40000u) \
642#define BT_AUDIO_LC3_UNICAST_PRESET_48_1_2 \
643 BT_AUDIO_LC3_PRESET( \
644 BT_CODEC_LC3_CONFIG_48_1, \
645 BT_CODEC_LC3_QOS_7_5_UNFRAMED(75u, 13u, 75u, 40000u) \
648#define BT_AUDIO_LC3_UNICAST_PRESET_48_2_2 \
649 BT_AUDIO_LC3_PRESET( \
650 BT_CODEC_LC3_CONFIG_48_2, \
651 BT_CODEC_LC3_QOS_10_UNFRAMED(100u, 13u, 95u, 40000u) \
654#define BT_AUDIO_LC3_UNICAST_PRESET_48_3_2 \
655 BT_AUDIO_LC3_PRESET( \
656 BT_CODEC_LC3_CONFIG_48_3, \
657 BT_CODEC_LC3_QOS_7_5_UNFRAMED(90u, 13u, 75u, 40000u) \
660#define BT_AUDIO_LC3_UNICAST_PRESET_48_4_2 \
661 BT_AUDIO_LC3_PRESET( \
662 BT_CODEC_LC3_CONFIG_48_4, \
663 BT_CODEC_LC3_QOS_10_UNFRAMED(120u, 13u, 100u, 40000u) \
666#define BT_AUDIO_LC3_UNICAST_PRESET_48_5_2 \
667 BT_AUDIO_LC3_PRESET( \
668 BT_CODEC_LC3_CONFIG_48_5, \
669 BT_CODEC_LC3_QOS_7_5_UNFRAMED(117u, 13u, 75u, 40000u) \
672#define BT_AUDIO_LC3_UNICAST_PRESET_48_6_2 \
673 BT_AUDIO_LC3_PRESET( \
674 BT_CODEC_LC3_CONFIG_48_6, \
675 BT_CODEC_LC3_QOS_10_UNFRAMED(155u, 13u, 100u, 40000u) \
679#define BT_AUDIO_LC3_BROADCAST_PRESET_8_1_1 \
680 BT_AUDIO_LC3_PRESET( \
681 BT_CODEC_LC3_CONFIG_8_1, \
682 BT_CODEC_LC3_QOS_7_5_UNFRAMED(26u, 2u, 8u, 40000u) \
685#define BT_AUDIO_LC3_BROADCAST_PRESET_8_2_1 \
686 BT_AUDIO_LC3_PRESET( \
687 BT_CODEC_LC3_CONFIG_8_2, \
688 BT_CODEC_LC3_QOS_10_UNFRAMED(30u, 2u, 10u, 40000u) \
691#define BT_AUDIO_LC3_BROADCAST_PRESET_16_1_1 \
692 BT_AUDIO_LC3_PRESET( \
693 BT_CODEC_LC3_CONFIG_16_1, \
694 BT_CODEC_LC3_QOS_7_5_UNFRAMED(30u, 2u, 8u, 40000u) \
698#define BT_AUDIO_LC3_BROADCAST_PRESET_16_2_1 \
699 BT_AUDIO_LC3_PRESET( \
700 BT_CODEC_LC3_CONFIG_16_2, \
701 BT_CODEC_LC3_QOS_10_UNFRAMED(40u, 2u, 10u, 40000u) \
704#define BT_AUDIO_LC3_BROADCAST_PRESET_24_1_1 \
705 BT_AUDIO_LC3_PRESET( \
706 BT_CODEC_LC3_CONFIG_24_1, \
707 BT_CODEC_LC3_QOS_7_5_UNFRAMED(45u, 2u, 8u, 40000u) \
711#define BT_AUDIO_LC3_BROADCAST_PRESET_24_2_1 \
712 BT_AUDIO_LC3_PRESET( \
713 BT_CODEC_LC3_CONFIG_24_2, \
714 BT_CODEC_LC3_QOS_10_UNFRAMED(60u, 2u, 10u, 40000u) \
717#define BT_AUDIO_LC3_BROADCAST_PRESET_32_1_1 \
718 BT_AUDIO_LC3_PRESET( \
719 BT_CODEC_LC3_CONFIG_32_1, \
720 BT_CODEC_LC3_QOS_7_5_UNFRAMED(60u, 2u, 8u, 40000u) \
723#define BT_AUDIO_LC3_BROADCAST_PRESET_32_2_1 \
724 BT_AUDIO_LC3_PRESET( \
725 BT_CODEC_LC3_CONFIG_32_2, \
726 BT_CODEC_LC3_QOS_10_UNFRAMED(80u, 2u, 10u, 40000u) \
729#define BT_AUDIO_LC3_BROADCAST_PRESET_441_1_1 \
730 BT_AUDIO_LC3_PRESET( \
731 BT_CODEC_LC3_CONFIG_441_1, \
732 BT_CODEC_QOS(8163u, BT_CODEC_QOS_FRAMED, \
733 BT_CODEC_QOS_2M, 97u, 4u, 24u, 40000u) \
736#define BT_AUDIO_LC3_BROADCAST_PRESET_441_2_1 \
737 BT_AUDIO_LC3_PRESET( \
738 BT_CODEC_LC3_CONFIG_441_2, \
739 BT_CODEC_QOS(10884u, BT_CODEC_QOS_FRAMED, \
740 BT_CODEC_QOS_2M, 130u, 4u, 31u, 40000u) \
743#define BT_AUDIO_LC3_BROADCAST_PRESET_48_1_1 \
744 BT_AUDIO_LC3_PRESET( \
745 BT_CODEC_LC3_CONFIG_48_1, \
746 BT_CODEC_LC3_QOS_7_5_UNFRAMED(75u, 4u, 15u, 40000u) \
749#define BT_AUDIO_LC3_BROADCAST_PRESET_48_2_1 \
750 BT_AUDIO_LC3_PRESET( \
751 BT_CODEC_LC3_CONFIG_48_2, \
752 BT_CODEC_LC3_QOS_10_UNFRAMED(100u, 4u, 20u, 40000u) \
755#define BT_AUDIO_LC3_BROADCAST_PRESET_48_3_1 \
756 BT_AUDIO_LC3_PRESET( \
757 BT_CODEC_LC3_CONFIG_48_3, \
758 BT_CODEC_LC3_QOS_7_5_UNFRAMED(90u, 4u, 15u, 40000u) \
761#define BT_AUDIO_LC3_BROADCAST_PRESET_48_4_1 \
762 BT_AUDIO_LC3_PRESET( \
763 BT_CODEC_LC3_CONFIG_48_4, \
764 BT_CODEC_LC3_QOS_10_UNFRAMED(120u, 4u, 20u, 40000u) \
767#define BT_AUDIO_LC3_BROADCAST_PRESET_48_5_1 \
768 BT_AUDIO_LC3_PRESET( \
769 BT_CODEC_LC3_CONFIG_48_5, \
770 BT_CODEC_LC3_QOS_7_5_UNFRAMED(117u, 4u, 15u, 40000u) \
773#define BT_AUDIO_LC3_BROADCAST_PRESET_48_6_1 \
774 BT_AUDIO_LC3_PRESET( \
775 BT_CODEC_LC3_CONFIG_48_6, \
776 BT_CODEC_LC3_QOS_10_UNFRAMED(155u, 4u, 20u, 40000u) \
780#define BT_AUDIO_LC3_BROADCAST_PRESET_8_1_2 \
781 BT_AUDIO_LC3_PRESET( \
782 BT_CODEC_LC3_CONFIG_8_1, \
783 BT_CODEC_LC3_QOS_7_5_UNFRAMED(26u, 4u, 45u, 40000u) \
786#define BT_AUDIO_LC3_BROADCAST_PRESET_8_2_2 \
787 BT_AUDIO_LC3_PRESET( \
788 BT_CODEC_LC3_CONFIG_8_2, \
789 BT_CODEC_LC3_QOS_10_UNFRAMED(30u, 4u, 60u, 40000u) \
792#define BT_AUDIO_LC3_BROADCAST_PRESET_16_1_2 \
793 BT_AUDIO_LC3_PRESET( \
794 BT_CODEC_LC3_CONFIG_16_1, \
795 BT_CODEC_LC3_QOS_7_5_UNFRAMED(30u, 4u, 45u, 40000u) \
799#define BT_AUDIO_LC3_BROADCAST_PRESET_16_2_2 \
800 BT_AUDIO_LC3_PRESET( \
801 BT_CODEC_LC3_CONFIG_16_2, \
802 BT_CODEC_LC3_QOS_10_UNFRAMED(40u, 4u, 60u, 40000u) \
805#define BT_AUDIO_LC3_BROADCAST_PRESET_24_1_2 \
806 BT_AUDIO_LC3_PRESET( \
807 BT_CODEC_LC3_CONFIG_24_1, \
808 BT_CODEC_LC3_QOS_7_5_UNFRAMED(45u, 4u, 45u, 40000u) \
812#define BT_AUDIO_LC3_BROADCAST_PRESET_24_2_2 \
813 BT_AUDIO_LC3_PRESET( \
814 BT_CODEC_LC3_CONFIG_24_2, \
815 BT_CODEC_LC3_QOS_10_UNFRAMED(60u, 4u, 60u, 40000u) \
818#define BT_AUDIO_LC3_BROADCAST_PRESET_32_1_2 \
819 BT_AUDIO_LC3_PRESET( \
820 BT_CODEC_LC3_CONFIG_32_1, \
821 BT_CODEC_LC3_QOS_7_5_UNFRAMED(60u, 4u, 45u, 40000u) \
824#define BT_AUDIO_LC3_BROADCAST_PRESET_32_2_2 \
825 BT_AUDIO_LC3_PRESET( \
826 BT_CODEC_LC3_CONFIG_32_2, \
827 BT_CODEC_LC3_QOS_10_UNFRAMED(80u, 4u, 60u, 40000u) \
830#define BT_AUDIO_LC3_BROADCAST_PRESET_441_1_2 \
831 BT_AUDIO_LC3_PRESET( \
832 BT_CODEC_LC3_CONFIG_441_1, \
833 BT_CODEC_QOS(8163u, BT_CODEC_QOS_FRAMED, \
834 BT_CODEC_QOS_2M, 97u, 4u, 54u, 40000u) \
837#define BT_AUDIO_LC3_BROADCAST_PRESET_441_2_2 \
838 BT_AUDIO_LC3_PRESET( \
839 BT_CODEC_LC3_CONFIG_441_2, \
840 BT_CODEC_QOS(10884u, BT_CODEC_QOS_FRAMED, \
841 BT_CODEC_QOS_2M, 130u, 4u, 60u, 40000u) \
844#define BT_AUDIO_LC3_BROADCAST_PRESET_48_1_2 \
845 BT_AUDIO_LC3_PRESET( \
846 BT_CODEC_LC3_CONFIG_48_1, \
847 BT_CODEC_LC3_QOS_7_5_UNFRAMED(75u, 4u, 50u, 40000u) \
850#define BT_AUDIO_LC3_BROADCAST_PRESET_48_2_2 \
851 BT_AUDIO_LC3_PRESET( \
852 BT_CODEC_LC3_CONFIG_48_2, \
853 BT_CODEC_LC3_QOS_10_UNFRAMED(100u, 4u, 65u, 40000u) \
856#define BT_AUDIO_LC3_BROADCAST_PRESET_48_3_2 \
857 BT_AUDIO_LC3_PRESET( \
858 BT_CODEC_LC3_CONFIG_48_3, \
859 BT_CODEC_LC3_QOS_7_5_UNFRAMED(90u, 4u, 50u, 40000u) \
862#define BT_AUDIO_LC3_BROADCAST_PRESET_48_4_2 \
863 BT_AUDIO_LC3_PRESET( \
864 BT_CODEC_LC3_CONFIG_48_4, \
865 BT_CODEC_LC3_QOS_10_UNFRAMED(120u, 4u, 65u, 40000u) \
868#define BT_AUDIO_LC3_BROADCAST_PRESET_48_5_2 \
869 BT_AUDIO_LC3_PRESET( \
870 BT_CODEC_LC3_CONFIG_48_5, \
871 BT_CODEC_LC3_QOS_7_5_UNFRAMED(117u, 4u, 50u, 40000u) \
874#define BT_AUDIO_LC3_BROADCAST_PRESET_48_6_2 \
875 BT_AUDIO_LC3_PRESET( \
876 BT_CODEC_LC3_CONFIG_48_6, \
877 BT_CODEC_LC3_QOS_10_UNFRAMED(155u, 4u, 65u, 40000u) \
893 struct bt_audio_ep *
ep;
935 const struct bt_audio_ep *ep,
1073#if defined(CONFIG_BT_PAC_SNK_LOC) || defined(CONFIG_BT_PAC_SRC_LOC)
1090 int (*publish_location)(
struct bt_conn *conn,
1094#if defined(CONFIG_BT_PAC_SNK_LOC_WRITEABLE) || defined(CONFIG_BT_PAC_SRC_LOC_WRITEABLE)
1106 int (*write_location)(
struct bt_conn *conn,
enum bt_audio_dir dir,
1140 struct bt_le_per_adv_sync *sync,
1166 void (*
syncable)(
struct bt_audio_broadcast_sink *sink,
bool encrypted);
1200#if defined(CONFIG_BT_AUDIO_UNICAST)
1276#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_AUDIO_BROADCAST_SINK)
1293#if defined(CONFIG_BT_AUDIO_UNICAST) || defined(CONFIG_BT_AUDIO_BROADCAST_SOURCE)
1372 struct bt_audio_ep *ep,
1418 struct bt_audio_ep *ep,
1450 struct bt_audio_unicast_group *group,
1571 struct bt_audio_unicast_group **unicast_group);
1659 struct bt_audio_broadcast_source **source);
1762 const uint8_t broadcast_code[16]);
Bluetooth data buffer API.
ZTEST_BMEM int index[(3)]
Definition: main.c:32
Bluetooth connection handling.
Generic Attribute Profile handling.
int bt_audio_broadcast_source_create(struct bt_audio_stream *streams[], size_t num_stream, struct bt_codec *codec, struct bt_codec_qos *qos, struct bt_audio_broadcast_source **source)
Create audio broadcast source.
int bt_audio_broadcast_sink_delete(struct bt_audio_broadcast_sink *sink)
Release a broadcast sink.
int bt_audio_broadcast_source_delete(struct bt_audio_broadcast_source *source)
Delete audio broadcast source.
void bt_audio_broadcast_sink_register_cb(struct bt_audio_broadcast_sink_cb *cb)
Register Broadcast sink callbacks *.
int bt_audio_broadcast_sink_scan_start(const struct bt_le_scan_param *param)
Start scan for broadcast sources.
int bt_audio_broadcast_sink_sync(struct bt_audio_broadcast_sink *sink, uint32_t indexes_bitfield, struct bt_audio_stream *streams[], struct bt_codec *codec, const uint8_t broadcast_code[16])
Sync to a broadcaster's audio.
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_start(struct bt_audio_broadcast_source *source)
Start audio broadcast source.
int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_group, struct bt_audio_stream *streams[], size_t num_stream)
Add streams to a unicast group as a unicast client.
int bt_audio_stream_reconfig(struct bt_audio_stream *stream, struct bt_codec *codec)
Reconfigure Audio Stream.
int bt_audio_stream_qos(struct bt_conn *conn, struct bt_audio_unicast_group *group, struct bt_codec_qos *qos)
Configure Audio Stream QoS.
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_unicast_group_delete(struct bt_audio_unicast_group *unicast_group)
Delete audio unicast group.
int bt_audio_unicast_group_create(struct bt_audio_stream *streams[], size_t num_stream, struct bt_audio_unicast_group **unicast_group)
Create audio unicast group.
int bt_audio_discover(struct bt_conn *conn, struct bt_audio_discover_params *params)
Discover remote capabilities and endpoints.
int bt_audio_unicast_group_remove_streams(struct bt_audio_unicast_group *unicast_group, struct bt_audio_stream *streams[], size_t num_stream)
Remove streams from a unicast group as a unicast client.
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:1370
int bt_audio_stream_release(struct bt_audio_stream *stream, bool cache)
Release Audio Stream.
int bt_audio_stream_send(struct bt_audio_stream *stream, struct net_buf *buf)
Send data to Audio stream.
int bt_audio_stream_stop(struct bt_audio_stream *stream)
Stop 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_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.
bt_audio_codec_parse_err
Codec parser error codes for Codec config parsing APIs.
Definition: audio.h:1804
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:1807
@ BT_AUDIO_CODEC_PARSE_ERR_TYPE_NOT_FOUND
The requested type is not present in the data set.
Definition: audio.h:1810
@ BT_AUDIO_CODEC_PARSE_ERR_INVALID_VALUE_FOUND
The value found is invalid.
Definition: audio.h:1813
@ BT_AUDIO_CODEC_PARSE_ERR_INVALID_PARAM
The parameters specified to the function call are not valid.
Definition: audio.h:1816
int bt_audio_unicast_server_register_cb(const struct bt_audio_unicast_server_cb *cb)
Register unicast server callbacks.
int bt_audio_unicast_server_location_changed(enum bt_audio_dir dir)
Notify location changed.
int bt_audio_unicast_server_unregister_cb(const struct bt_audio_unicast_server_cb *cb)
Unregister unicast server callbacks.
#define BROADCAST_SNK_SUBGROUP_CNT
Definition: audio.h:149
bt_audio_dir
Audio Capability type.
Definition: audio.h:309
#define BROADCAST_SNK_STREAM_CNT
Definition: audio.h:148
bt_audio_location
Location values for BT Audio.
Definition: audio.h:224
bt_audio_meta_type
Meta data type ids used for LTV encoded metadata.
Definition: audio.h:208
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:372
#define BT_CODEC_QOS_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd)
Helper to declare Input Unframed bt_codec_qos.
Definition: audio.h:359
@ BT_CODEC_QOS_2M
Definition: audio.h:346
@ BT_CODEC_QOS_CODED
Definition: audio.h:347
@ BT_CODEC_QOS_1M
Definition: audio.h:345
@ BT_AUDIO_DIR_SINK
Definition: audio.h:310
@ BT_AUDIO_DIR_SOURCE
Definition: audio.h:311
@ BT_AUDIO_LOCATION_FRONT_CENTER
Definition: audio.h:227
@ BT_AUDIO_LOCATION_TOP_BACK_LEFT
Definition: audio.h:241
@ BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2
Definition: audio.h:234
@ BT_AUDIO_LOCATION_TOP_SIDE_RIGHT
Definition: audio.h:244
@ BT_AUDIO_LOCATION_FRONT_RIGHT
Definition: audio.h:226
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT
Definition: audio.h:248
@ BT_AUDIO_LOCATION_BACK_RIGHT
Definition: audio.h:230
@ BT_AUDIO_LOCATION_TOP_CENTER
Definition: audio.h:240
@ BT_AUDIO_LOCATION_LEFT_SURROUND
Definition: audio.h:251
@ BT_AUDIO_LOCATION_TOP_FRONT_RIGHT
Definition: audio.h:238
@ BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER
Definition: audio.h:232
@ BT_AUDIO_LOCATION_TOP_BECK_RIGHT
Definition: audio.h:242
@ BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE
Definition: audio.h:250
@ BT_AUDIO_LOCATION_BACK_LEFT
Definition: audio.h:229
@ BT_AUDIO_LOCATION_RIGHT_SURROUND
Definition: audio.h:252
@ BT_AUDIO_LOCATION_SIDE_RIGHT
Definition: audio.h:236
@ BT_AUDIO_LOCATION_TOP_FRONT_LEFT
Definition: audio.h:237
@ BT_AUDIO_LOCATION_SIDE_LEFT
Definition: audio.h:235
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT
Definition: audio.h:247
@ BT_AUDIO_LOCATION_TOP_FRONT_CENTER
Definition: audio.h:239
@ BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1
Definition: audio.h:228
@ BT_AUDIO_LOCATION_FRONT_LEFT
Definition: audio.h:225
@ BT_AUDIO_LOCATION_FRONT_LEFT_WIDE
Definition: audio.h:249
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER
Definition: audio.h:246
@ BT_AUDIO_LOCATION_BACK_CENTER
Definition: audio.h:233
@ BT_AUDIO_LOCATION_TOP_SIDE_LEFT
Definition: audio.h:243
@ BT_AUDIO_LOCATION_TOP_BACK_CENTER
Definition: audio.h:245
@ BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER
Definition: audio.h:231
@ BT_CODEC_META_PROGRAM_INFO
Definition: audio.h:211
@ BT_CODEC_META_VENDOR_SPECIFIC
Definition: audio.h:217
@ BT_CODEC_META_LANGUAGE
Definition: audio.h:212
@ BT_CODEC_META_CCID_LIST
Definition: audio.h:213
@ BT_CODEC_META_PROGRAM_INFO_URI
Definition: audio.h:215
@ BT_CODEC_META_EXTENDED_METADATA
Definition: audio.h:216
@ BT_CODEC_META_PREFER_CONTEXT
Definition: audio.h:209
@ BT_CODEC_META_CONTEXT
Definition: audio.h:210
@ BT_CODEC_META_PARENTAL_RATING
Definition: audio.h:214
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
Bluetooth LC3 codec handling.
static ssize_t recv(int sock, void *buf, size_t max_len, int flags)
Definition: socket.h:66
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
uint8_t index
Definition: audio.h:275
struct bt_codec_data data[CONFIG_BT_CODEC_MAX_DATA_COUNT]
Definition: audio.h:285
size_t data_count
Definition: audio.h:280
size_t bis_count
Definition: audio.h:290
struct bt_audio_base_bis_data bis_data[0]
Definition: audio.h:298
struct bt_codec codec
Definition: audio.h:296
struct bt_audio_base_subgroup subgroups[0]
Definition: audio.h:305
size_t subgroup_count
Definition: audio.h:303
void(* scan_term)(int err)
Scan terminated callback.
Definition: audio.h:1181
bool(* scan_recv)(const struct bt_le_scan_recv_info *info, uint32_t broadcast_id)
Scan receive callback.
Definition: audio.h:1125
void(* syncable)(struct bt_audio_broadcast_sink *sink, bool encrypted)
Broadcast sink is syncable.
Definition: audio.h:1166
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:1139
void(* base_recv)(struct bt_audio_broadcast_sink *sink, const struct bt_audio_base *base)
Broadcast Audio Source Endpoint (BASE) received.
Definition: audio.h:1151
sys_snode_t node
Definition: audio.h:1195
void(* pa_sync_lost)(struct bt_audio_broadcast_sink *sink)
Periodic advertising synchronization lost callback.
Definition: audio.h:1192
uint8_t num_caps
Definition: audio.h:1381
uint8_t err
Definition: audio.h:1385
enum bt_audio_dir dir
Definition: audio.h:1377
uint8_t num_eps
Definition: audio.h:1383
struct bt_gatt_read_params read
Definition: audio.h:1386
struct bt_gatt_discover_params discover
Definition: audio.h:1387
bt_audio_discover_func_t func
Definition: audio.h:1379
struct bt_codec codec
Definition: audio.h:466
struct bt_codec_qos qos
Definition: audio.h:468
Stream operation.
Definition: audio.h:1199
void(* stopped)(struct bt_audio_stream *stream)
Stream stopped callback.
Definition: audio.h:1274
void(* started)(struct bt_audio_stream *stream)
Stream started callback.
Definition: audio.h:1265
Audio stream structure.
Definition: audio.h:889
struct bt_audio_stream_ops * ops
Definition: audio.h:901
sys_snode_t node
Definition: audio.h:902
struct bt_audio_unicast_group * unicast_group
Definition: audio.h:906
struct bt_audio_broadcast_sink * broadcast_sink
Definition: audio.h:908
struct bt_codec * codec
Definition: audio.h:895
void * group
Definition: audio.h:905
struct bt_conn * conn
Definition: audio.h:891
struct bt_audio_ep * ep
Definition: audio.h:893
struct bt_audio_broadcast_source * broadcast_source
Definition: audio.h:907
struct bt_iso_chan * iso
Definition: audio.h:899
struct bt_codec_qos * qos
Definition: audio.h:897
void * user_data
Definition: audio.h:912
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:955
int(* qos)(struct bt_audio_stream *stream, const struct bt_codec_qos *qos)
Stream QoS request callback.
Definition: audio.h:970
int(* start)(struct bt_audio_stream *stream)
Stream Start request callback.
Definition: audio.h:997
int(* stop)(struct bt_audio_stream *stream)
Stream Stop callback.
Definition: audio.h:1034
int(* enable)(struct bt_audio_stream *stream, const struct bt_codec_data *meta, size_t meta_count)
Stream Enable request callback.
Definition: audio.h:984
int(* disable)(struct bt_audio_stream *stream)
Stream Disable request callback.
Definition: audio.h:1023
int(* release)(struct bt_audio_stream *stream)
Stream release callback.
Definition: audio.h:1045
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:934
int(* publish_capability)(struct bt_conn *conn, uint8_t type, uint8_t index, struct bt_codec *const codec)
Publish Capability callback.
Definition: audio.h:1070
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:1010
Codec configuration structure.
Definition: audio.h:162
struct bt_data data
Definition: audio.h:163
uint8_t value[CONFIG_BT_CODEC_MAX_DATA_LEN]
Definition: audio.h:164
Audio Stream Quality of Service Preference structure.
Definition: audio.h:425
bool unframed_supported
Unframed PDUs supported.
Definition: audio.h:431
uint32_t pd_min
Minimum Presentation Delay.
Definition: audio.h:447
uint32_t pref_pd_min
Preferred minimum Presentation Delay.
Definition: audio.h:457
uint32_t pd_max
Maximum Presentation Delay.
Definition: audio.h:454
uint8_t rtn
Definition: audio.h:437
uint8_t phy
Definition: audio.h:434
uint16_t latency
Definition: audio.h:440
uint32_t pref_pd_max
Preferred maximum Presentation Delay
Definition: audio.h:460
Codec QoS structure.
Definition: audio.h:377
uint8_t phy
Definition: audio.h:379
uint8_t framing
Definition: audio.h:382
uint32_t pd
Definition: audio.h:396
uint16_t latency
Definition: audio.h:391
uint32_t interval
Definition: audio.h:394
uint8_t rtn
Definition: audio.h:385
uint16_t sdu
Definition: audio.h:388
Codec structure.
Definition: audio.h:256
struct bt_codec_data data[CONFIG_BT_CODEC_MAX_DATA_COUNT]
Definition: audio.h:266
size_t meta_count
Definition: audio.h:268
uint16_t cid
Definition: audio.h:260
size_t data_count
Definition: audio.h:264
uint8_t id
Definition: audio.h:258
uint16_t vid
Definition: audio.h:262
struct bt_codec_data meta[CONFIG_BT_CODEC_MAX_METADATA_COUNT]
Definition: audio.h:270
Bluetooth data.
Definition: bluetooth.h:342
GATT Discover Attributes parameters.
Definition: gatt.h:1337
uint8_t type
Definition: gatt.h:1357
GATT Read parameters.
Definition: gatt.h:1421
ISO Channel structure.
Definition: iso.h:114
ISO Meta Data structure for received ISO packets.
Definition: iso.h:206
Definition: bluetooth.h:1691
Definition: bluetooth.h:1728
Network buffer representation.
Definition: buf.h:915
static fdata_t data[2]
Definition: test_fifo_contexts.c:15