@@ -86,9 +86,6 @@ static atomic_t notify_rdy;
86
86
static K_SEM_DEFINE (read_buf_sem , 1 , 1 );
87
87
NET_BUF_SIMPLE_DEFINE_STATIC (read_buf , BT_ATT_MAX_ATTRIBUTE_LEN );
88
88
89
- #if defined(CONFIG_BT_PAC_SNK_LOC_NOTIFIABLE ) || defined(CONFIG_BT_PAC_SRC_LOC_NOTIFIABLE )
90
- static int pac_notify_loc (struct bt_conn * conn , enum bt_audio_dir dir );
91
- #endif /* CONFIG_BT_PAC_SNK_LOC_NOTIFIABLE || CONFIG_BT_PAC_SRC_LOC_NOTIFIABLE*/
92
89
static int pacs_gatt_notify (struct bt_conn * conn ,
93
90
const struct bt_uuid * uuid ,
94
91
const struct bt_gatt_attr * attr ,
@@ -634,28 +631,25 @@ BT_GATT_SERVICE_DEFINE(pacs_svc,
634
631
BT_PAC_SUPPORTED_CONTEXT (supported_context_read )
635
632
);
636
633
634
+ #if defined(CONFIG_BT_PAC_SNK_LOC_NOTIFIABLE ) || defined(CONFIG_BT_PAC_SRC_LOC_NOTIFIABLE )
637
635
static int pac_notify_loc (struct bt_conn * conn , enum bt_audio_dir dir )
638
636
{
639
637
uint32_t location_le ;
640
638
int err ;
641
639
const struct bt_uuid * uuid ;
642
640
643
641
switch (dir ) {
644
- case BT_AUDIO_DIR_SINK :
645
642
#if defined(CONFIG_BT_PAC_SNK_LOC_NOTIFIABLE )
643
+ case BT_AUDIO_DIR_SINK :
646
644
location_le = sys_cpu_to_le32 (pacs_snk_location );
647
645
uuid = pacs_snk_loc_uuid ;
648
646
break ;
649
- #else
650
- return - ENOTSUP ;
651
647
#endif /* CONFIG_BT_PAC_SNK_LOC_NOTIFIABLE */
652
- case BT_AUDIO_DIR_SOURCE :
653
648
#if defined(CONFIG_BT_PAC_SRC_LOC_NOTIFIABLE )
649
+ case BT_AUDIO_DIR_SOURCE :
654
650
location_le = sys_cpu_to_le32 (pacs_src_location );
655
651
uuid = pacs_src_loc_uuid ;
656
652
break ;
657
- #else
658
- return - ENOTSUP ;
659
653
#endif /* CONFIG_BT_PAC_SRC_LOC_NOTIFIABLE */
660
654
default :
661
655
return - EINVAL ;
@@ -669,7 +663,9 @@ static int pac_notify_loc(struct bt_conn *conn, enum bt_audio_dir dir)
669
663
670
664
return 0 ;
671
665
}
666
+ #endif /* CONFIG_BT_PAC_SNK_LOC_NOTIFIABLE || CONFIG_BT_PAC_SRC_LOC_NOTIFIABLE */
672
667
668
+ #if defined(CONFIG_BT_PAC_SNK_NOTIFIABLE ) || defined(CONFIG_BT_PAC_SRC_NOTIFIABLE )
673
669
static int pac_notify (struct bt_conn * conn , enum bt_audio_dir dir )
674
670
{
675
671
int err = 0 ;
@@ -716,6 +712,7 @@ static int pac_notify(struct bt_conn *conn, enum bt_audio_dir dir)
716
712
return 0 ;
717
713
}
718
714
}
715
+ #endif /* CONFIG_BT_PAC_SNK_NOTIFIABLE || CONFIG_BT_PAC_SRC_NOTIFIABLE */
719
716
720
717
static int available_contexts_notify (struct bt_conn * conn )
721
718
{
@@ -822,39 +819,45 @@ static void notify_cb(struct bt_conn *conn, void *data)
822
819
return ;
823
820
}
824
821
825
- if ( IS_ENABLED ( CONFIG_BT_PAC_SNK_NOTIFIABLE ) &&
826
- atomic_test_bit (client -> flags , FLAG_SINK_PAC_CHANGED )) {
822
+ # if defined( CONFIG_BT_PAC_SNK_NOTIFIABLE )
823
+ if ( atomic_test_bit (client -> flags , FLAG_SINK_PAC_CHANGED )) {
827
824
LOG_DBG ("Notifying Sink PAC" );
828
825
err = pac_notify (conn , BT_AUDIO_DIR_SINK );
829
826
if (!err ) {
830
827
atomic_clear_bit (client -> flags , FLAG_SINK_PAC_CHANGED );
831
828
}
832
829
}
830
+ #endif /* CONFIG_BT_PAC_SNK_NOTIFIABLE */
833
831
834
- if ( IS_ENABLED ( CONFIG_BT_PAC_SNK_LOC_NOTIFIABLE ) &&
835
- atomic_test_bit (client -> flags , FLAG_SINK_AUDIO_LOCATIONS_CHANGED )) {
832
+ # if defined( CONFIG_BT_PAC_SNK_LOC_NOTIFIABLE )
833
+ if ( atomic_test_bit (client -> flags , FLAG_SINK_AUDIO_LOCATIONS_CHANGED )) {
836
834
LOG_DBG ("Notifying Sink Audio Location" );
837
835
err = pac_notify_loc (conn , BT_AUDIO_DIR_SINK );
838
836
if (!err ) {
839
837
atomic_clear_bit (client -> flags , FLAG_SINK_AUDIO_LOCATIONS_CHANGED );
840
838
}
841
839
}
842
- if (IS_ENABLED (CONFIG_BT_PAC_SRC_NOTIFIABLE ) &&
843
- atomic_test_bit (client -> flags , FLAG_SOURCE_PAC_CHANGED )) {
840
+ #endif /* CONFIG_BT_PAC_SNK_LOC_NOTIFIABLE */
841
+
842
+ #if defined(CONFIG_BT_PAC_SRC_NOTIFIABLE )
843
+ if (atomic_test_bit (client -> flags , FLAG_SOURCE_PAC_CHANGED )) {
844
844
LOG_DBG ("Notifying Source PAC" );
845
845
err = pac_notify (conn , BT_AUDIO_DIR_SOURCE );
846
846
if (!err ) {
847
847
atomic_clear_bit (client -> flags , FLAG_SOURCE_PAC_CHANGED );
848
848
}
849
849
}
850
- if (IS_ENABLED (CONFIG_BT_PAC_SRC_LOC_NOTIFIABLE ) &&
851
- atomic_test_and_clear_bit (client -> flags , FLAG_SOURCE_AUDIO_LOCATIONS_CHANGED )) {
850
+ #endif /* CONFIG_BT_PAC_SRC_NOTIFIABLE */
851
+
852
+ #if defined(CONFIG_BT_PAC_SRC_LOC_NOTIFIABLE )
853
+ if (atomic_test_and_clear_bit (client -> flags , FLAG_SOURCE_AUDIO_LOCATIONS_CHANGED )) {
852
854
LOG_DBG ("Notifying Source Audio Location" );
853
855
err = pac_notify_loc (conn , BT_AUDIO_DIR_SOURCE );
854
856
if (!err ) {
855
857
atomic_clear_bit (client -> flags , FLAG_SOURCE_AUDIO_LOCATIONS_CHANGED );
856
858
}
857
859
}
860
+ #endif /* CONFIG_BT_PAC_SRC_LOC_NOTIFIABLE */
858
861
859
862
if (atomic_test_bit (client -> flags , FLAG_AVAILABLE_AUDIO_CONTEXT_CHANGED )) {
860
863
LOG_DBG ("Notifying Available Contexts" );
0 commit comments