@@ -281,34 +281,6 @@ static void le_audio_msg_sub_thread(void)
281281 break ;
282282
283283 case LE_AUDIO_EVT_CONFIG_RECEIVED :
284- struct bt_conn_info conn_info ;
285- uint16_t interval = 0 ;
286-
287- ret = bt_conn_get_info (msg .conn , & conn_info );
288- if (ret ) {
289- LOG_ERR ("Failed to get conn info" );
290- } else {
291- interval = BT_GAP_US_TO_CONN_INTERVAL (conn_info .le .interval_us );
292- }
293-
294- /* Only update conn param once */
295- if (((IS_ENABLED (CONFIG_BT_AUDIO_TX ) && msg .dir == BT_AUDIO_DIR_SINK ) ||
296- (!IS_ENABLED (CONFIG_BT_AUDIO_TX ) && msg .dir == BT_AUDIO_DIR_SOURCE )) &&
297- interval != CONFIG_BLE_ACL_CONN_INTERVAL_SLOW ) {
298- struct bt_le_conn_param param ;
299-
300- /* Set the ACL interval up to allow more time for ISO packets */
301- param .interval_min = CONFIG_BLE_ACL_CONN_INTERVAL_SLOW ;
302- param .interval_max = CONFIG_BLE_ACL_CONN_INTERVAL_SLOW ;
303- param .latency = CONFIG_BLE_ACL_SLAVE_LATENCY ;
304- param .timeout = CONFIG_BLE_ACL_SUP_TIMEOUT ;
305-
306- ret = bt_conn_le_param_update (msg .conn , & param );
307- if (ret ) {
308- LOG_WRN ("Failed to update conn parameters: %d" , ret );
309- }
310- }
311-
312284 LOG_DBG ("LE audio config received" );
313285
314286 ret = unicast_client_config_get (msg .stream , & bitrate_bps ,
@@ -378,6 +350,42 @@ static void le_audio_msg_sub_thread(void)
378350 /* Nothing to do. */
379351 break ;
380352
353+ case LE_AUDIO_EVT_DISCOVERY_COMPLETE :
354+ LOG_DBG ("Discovery complete event received" );
355+
356+ /* Only update conn param once */
357+ struct bt_conn_info conn_info ;
358+ uint16_t interval = 0 ;
359+
360+ ret = bt_conn_get_info (msg .conn , & conn_info );
361+ if (ret ) {
362+ LOG_ERR ("Failed to get conn info" );
363+ } else {
364+ interval = BT_GAP_US_TO_CONN_INTERVAL (conn_info .le .interval_us );
365+ }
366+
367+ if (((IS_ENABLED (CONFIG_BT_AUDIO_TX ) && msg .dir == BT_AUDIO_DIR_SINK ) ||
368+ (!IS_ENABLED (CONFIG_BT_AUDIO_TX ) && msg .dir == BT_AUDIO_DIR_SOURCE )) &&
369+ interval != CONFIG_BLE_ACL_CONN_INTERVAL_SLOW ) {
370+ struct bt_le_conn_param param ;
371+
372+ /* Set the ACL interval up to allow more time for ISO packets */
373+ param .interval_min = CONFIG_BLE_ACL_CONN_INTERVAL_SLOW ;
374+ param .interval_max = CONFIG_BLE_ACL_CONN_INTERVAL_SLOW ;
375+ param .latency = CONFIG_BLE_ACL_SLAVE_LATENCY ;
376+ param .timeout = CONFIG_BLE_ACL_SUP_TIMEOUT ;
377+
378+ ret = bt_conn_le_param_update (msg .conn , & param );
379+ if (ret ) {
380+ LOG_WRN ("Failed to update conn parameters: %d" , ret );
381+ }
382+
383+ LOG_DBG ("Updated ACL conn interval to %3.2f ms for conn 0x%p" ,
384+ 1.25 * CONFIG_BLE_ACL_CONN_INTERVAL_SLOW , msg .conn );
385+ }
386+
387+ break ;
388+
381389 default :
382390 LOG_WRN ("Unexpected/unhandled le_audio event: %d" , msg .event );
383391 break ;
0 commit comments