@@ -2525,6 +2525,8 @@ int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count)
2525
2525
#endif /* CONFIG_BT_ISO_UNICAST */
2526
2526
2527
2527
#if defined(CONFIG_BT_ISO_BROADCAST )
2528
+ static sys_slist_t iso_big_cbs = SYS_SLIST_STATIC_INIT (& iso_big_cbs );
2529
+
2528
2530
static struct bt_iso_big * lookup_big_by_handle (uint8_t big_handle )
2529
2531
{
2530
2532
return & bigs [big_handle ];
@@ -2587,6 +2589,16 @@ static void big_disconnect(struct bt_iso_big *big, uint8_t reason)
2587
2589
2588
2590
bt_iso_chan_disconnected (bis , reason );
2589
2591
}
2592
+
2593
+ if (!sys_slist_is_empty (& iso_big_cbs )) {
2594
+ struct bt_iso_big_cb * listener ;
2595
+
2596
+ SYS_SLIST_FOR_EACH_CONTAINER (& iso_big_cbs , listener , _node ) {
2597
+ if (listener -> stopped != NULL ) {
2598
+ listener -> stopped (big , reason );
2599
+ }
2600
+ }
2601
+ }
2590
2602
}
2591
2603
2592
2604
static int big_init_bis (struct bt_iso_big * big , struct bt_iso_chan * * bis_channels , uint8_t num_bis ,
@@ -2617,6 +2629,25 @@ static int big_init_bis(struct bt_iso_big *big, struct bt_iso_chan **bis_channel
2617
2629
return 0 ;
2618
2630
}
2619
2631
2632
+ int bt_iso_big_register_cb (struct bt_iso_big_cb * cb )
2633
+ {
2634
+ CHECKIF (cb == NULL ) {
2635
+ LOG_DBG ("cb is NULL" );
2636
+
2637
+ return - EINVAL ;
2638
+ }
2639
+
2640
+ if (sys_slist_find (& iso_big_cbs , & cb -> _node , NULL )) {
2641
+ LOG_DBG ("cb %p is already registered" , cb );
2642
+
2643
+ return - EEXIST ;
2644
+ }
2645
+
2646
+ sys_slist_append (& iso_big_cbs , & cb -> _node );
2647
+
2648
+ return 0 ;
2649
+ }
2650
+
2620
2651
#if defined(CONFIG_BT_ISO_BROADCASTER )
2621
2652
static int hci_le_create_big (struct bt_le_ext_adv * padv , struct bt_iso_big * big ,
2622
2653
struct bt_iso_big_create_param * param )
@@ -3006,6 +3037,16 @@ void hci_le_big_complete(struct net_buf *buf)
3006
3037
store_bis_broadcaster_info (evt , & iso_conn -> iso .info );
3007
3038
bt_conn_set_state (iso_conn , BT_CONN_CONNECTED );
3008
3039
}
3040
+
3041
+ if (!sys_slist_is_empty (& iso_big_cbs )) {
3042
+ struct bt_iso_big_cb * listener ;
3043
+
3044
+ SYS_SLIST_FOR_EACH_CONTAINER (& iso_big_cbs , listener , _node ) {
3045
+ if (listener -> started != NULL ) {
3046
+ listener -> started (big );
3047
+ }
3048
+ }
3049
+ }
3009
3050
}
3010
3051
3011
3052
void hci_le_big_terminate (struct net_buf * buf )
@@ -3186,6 +3227,16 @@ void hci_le_big_sync_established(struct net_buf *buf)
3186
3227
store_bis_sync_receiver_info (evt , & iso_conn -> iso .info );
3187
3228
bt_conn_set_state (iso_conn , BT_CONN_CONNECTED );
3188
3229
}
3230
+
3231
+ if (!sys_slist_is_empty (& iso_big_cbs )) {
3232
+ struct bt_iso_big_cb * listener ;
3233
+
3234
+ SYS_SLIST_FOR_EACH_CONTAINER (& iso_big_cbs , listener , _node ) {
3235
+ if (listener -> started != NULL ) {
3236
+ listener -> started (big );
3237
+ }
3238
+ }
3239
+ }
3189
3240
}
3190
3241
3191
3242
void hci_le_big_sync_lost (struct net_buf * buf )
0 commit comments