@@ -65,7 +65,7 @@ struct shell_stream unicast_streams[CONFIG_BT_MAX_CONN *
6565 MAX (UNICAST_SERVER_STREAM_COUNT , UNICAST_CLIENT_STREAM_COUNT )];
6666
6767#if defined(CONFIG_BT_BAP_UNICAST_CLIENT )
68- struct bt_bap_unicast_group * default_unicast_group ;
68+ struct unicast_group default_unicast_group ;
6969static struct bt_bap_unicast_client_cb unicast_client_cbs ;
7070#if CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0
7171struct bt_bap_ep * snks [CONFIG_BT_MAX_CONN ][CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT ];
@@ -876,7 +876,7 @@ int bap_ac_create_unicast_group(const struct bap_unicast_ac_param *param,
876876 group_param .params = pair_params ;
877877 group_param .params_count = pair_cnt ;
878878
879- return bt_bap_unicast_group_create (& group_param , & default_unicast_group );
879+ return bt_bap_unicast_group_create (& group_param , & default_unicast_group . bap_group );
880880}
881881
882882static uint8_t stream_dir (const struct bt_bap_stream * stream )
@@ -1492,7 +1492,7 @@ static int create_unicast_group(const struct shell *sh)
14921492 return err ;
14931493 }
14941494
1495- err = bt_bap_unicast_group_create (& group_param , & default_unicast_group );
1495+ err = bt_bap_unicast_group_create (& group_param , & default_unicast_group . bap_group );
14961496 if (err != 0 ) {
14971497 shell_error (sh , "Unable to create default unicast group: %d" , err );
14981498
@@ -1514,7 +1514,7 @@ static int reconfig_unicast_group(const struct shell *sh)
15141514 return err ;
15151515 }
15161516
1517- err = bt_bap_unicast_group_reconfig (default_unicast_group , & group_param );
1517+ err = bt_bap_unicast_group_reconfig (default_unicast_group . bap_group , & group_param );
15181518 if (err != 0 ) {
15191519 shell_error (sh , "Unable to create default unicast group: %d" , err );
15201520
@@ -1538,7 +1538,13 @@ static int cmd_qos(const struct shell *sh, size_t argc, char *argv[])
15381538 return - ENOEXEC ;
15391539 }
15401540
1541- if (default_unicast_group == NULL ) {
1541+ if (default_unicast_group .is_cap ) {
1542+ shell_error (sh , "Cannot perform action on CAP unicast group" );
1543+
1544+ return - ENOEXEC ;
1545+ }
1546+
1547+ if (default_unicast_group .bap_group == NULL ) {
15421548 err = create_unicast_group (sh );
15431549 if (err != 0 ) {
15441550 return err ;
@@ -1550,7 +1556,7 @@ static int cmd_qos(const struct shell *sh, size_t argc, char *argv[])
15501556 }
15511557 }
15521558
1553- err = bt_bap_stream_qos (default_conn , default_unicast_group );
1559+ err = bt_bap_stream_qos (default_conn , default_unicast_group . bap_group );
15541560 if (err ) {
15551561 shell_error (sh , "Unable to setup QoS: %d" , err );
15561562 return - ENOEXEC ;
@@ -3177,7 +3183,7 @@ static void stream_released_cb(struct bt_bap_stream *stream)
31773183 bt_shell_print ("Stream %p released\n" , stream );
31783184
31793185#if defined(CONFIG_BT_BAP_UNICAST_CLIENT )
3180- if (default_unicast_group != NULL ) {
3186+ if (default_unicast_group . bap_group != NULL && ! default_unicast_group . is_cap ) {
31813187 bool group_can_be_deleted = true;
31823188
31833189 for (size_t i = 0U ; i < ARRAY_SIZE (unicast_streams ); i ++ ) {
@@ -3202,12 +3208,12 @@ static void stream_released_cb(struct bt_bap_stream *stream)
32023208
32033209 bt_shell_print ("All streams released, deleting group\n" );
32043210
3205- err = bt_bap_unicast_group_delete (default_unicast_group );
3211+ err = bt_bap_unicast_group_delete (default_unicast_group . bap_group );
32063212
32073213 if (err != 0 ) {
32083214 bt_shell_error ("Failed to delete unicast group: %d" , err );
32093215 } else {
3210- default_unicast_group = NULL ;
3216+ default_unicast_group . bap_group = NULL ;
32113217 }
32123218 }
32133219 }
0 commit comments