nRF5340 LE Audio: BIS switching

Hello, 

I am developing an application based on the sample project "nrf5340_audio" and would like to be able to select which gateway signal the headset receives when there are multiple gateways.

Is there an API to switch the target gateway of BIS?

Or, is there a message sequence from discovering the gateway to establishing the BIS? We are thinking of realizing a switching function by retaining the information of discovered gateways.

Regards, 

Gotoda

Parents
  • Hello Gotoda,

    This should be possible, but I need some more time to find out if there is an existing API for gateway switching.

    Thank you for your patience.

    Kind Regards,
    Maria

  • Hello again,

    I have not found an existing API for gateway switching, but I will search some more.

    Thank you for your patience.

    Kind Regards,
    Maria

  • Hi, 

    Thank you, I'll refer to the function and the thread.

    Is there a function for establishing BIS?

    Regards, 

    Gotoda

  • Hi,

    gocchan said:
    Thank you, I'll refer to the function and the thread.

    Great!

    gocchan said:
    Is there a function for establishing BIS?

    You can find all Bluetooth related code relating to BIS in the files le_audio_bis_gateway.c and le_audio_bis_headset.c from the nRF5340 Audio application.

    Kind Regards,
    Maria

  • Hello,

    I implemented it as follows.

    First, I increased the number of elements of the broadcast_sinks[] array defined in broadcast_sink.c to 2 to store 2 pieces of broadcast information. However, even with two gateways in close proximity, only one piece of information was stored.

    #define HOSI_BT_AUDIO_BROADCAST_SNK_COUNT 2
    
    static struct bt_audio_iso broadcast_sink_iso
    	[HOSI_BT_AUDIO_BROADCAST_SNK_COUNT][BROADCAST_SNK_STREAM_CNT];
    static struct bt_audio_ep broadcast_sink_eps
    	[HOSI_BT_AUDIO_BROADCAST_SNK_COUNT][BROADCAST_SNK_STREAM_CNT];
    static struct bt_audio_broadcast_sink broadcast_sinks[HOSI_BT_AUDIO_BROADCAST_SNK_COUNT];

    Next, thinking that the scan to find other gateways had stopped when it synchronized with the first gateway, I called bt_audio_broadcast_sink_scan_start() at the end of the sync_broadcast_pa() function in broadcast_sink.c. However, an error code of -120 is returned.

    static void sync_broadcast_pa(const struct bt_le_scan_recv_info *info,
    			      uint32_t broadcast_id)
    {
    	struct bt_audio_broadcast_sink_cb *listener;
    	struct bt_le_per_adv_sync_param param;
    	struct bt_audio_broadcast_sink *sink;
    	static bool pa_cb_registered;
    	int err;
    
    	if (!pa_cb_registered) {
    		static struct bt_le_per_adv_sync_cb cb = {
    			.synced = pa_synced,
    			.recv = pa_recv,
    			.term = pa_term,
    			.biginfo = biginfo_recv
    		};
    
    		bt_le_per_adv_sync_cb_register(&cb);
    
    		pa_cb_registered = true;
    	}
    
    	sink = broadcast_sink_free_get();
    	/* Should never happen as we check for free entry before
    	 * scanning
    	 */
    	__ASSERT(sink != NULL, "sink is NULL");
    
    	bt_addr_le_copy(&param.addr, info->addr);
    	param.options = 0;
    	param.sid = info->sid;
    	param.skip = PA_SYNC_SKIP;
    	param.timeout = interval_to_sync_timeout(info->interval);
    	err = bt_le_per_adv_sync_create(&param, &sink->pa_sync);
    	if (err != 0) {
    		BT_ERR("Could not sync to PA: %d", err);
    		err = bt_le_scan_stop();
    		if (err != 0 && err != -EALREADY) {
    			BT_ERR("Could not stop scan: %d", err);
    		}
    
    		SYS_SLIST_FOR_EACH_CONTAINER(&sink_cbs, listener, _node) {
    			if (listener->scan_term != NULL) {
    				listener->scan_term(err);
    			}
    		}
    	} else {
    		sink->syncing = true;
    		sink->pa_interval = info->interval;
    		sink->broadcast_id = broadcast_id;
    #if 1 /* Added. */
    		if(bt_audio_broadcast_get_array_size() < ARRAY_SIZE(broadcast_sinks))
    		{
    			err = bt_audio_broadcast_sink_scan_start(BT_LE_SCAN_PASSIVE);
    			if(err)
    			{
    				BT_ERR("bt_audio_broadcast_sink_scan_start(): %d", err);
    			}
    		}
    #endif
    	}
    }

    Is it possible to play broadcast signals from one gateway while receiving broadcast signals from another gateway?

    Regards, 

    Gotoda

  • Hello Gotoda,

    Sorry  about the delay.

    I will look into this shortly.

    Regards,
    Maria

  • Hi, 

    We have confirmed that BIS reception can be stopped and resynchronized by using bis_headset_cleanup() and bt_audio_broadcast_sink_scan_start().

    And by using the id available with the callback, it seems that we can choose which gateway to receive next.

    Resynchronization takes 2-3 seconds. I wish it was a bit more seamless, but I got it to work the way I wanted it to.

    Regards, 

    Gotoda

Reply
  • Hi, 

    We have confirmed that BIS reception can be stopped and resynchronized by using bis_headset_cleanup() and bt_audio_broadcast_sink_scan_start().

    And by using the id available with the callback, it seems that we can choose which gateway to receive next.

    Resynchronization takes 2-3 seconds. I wish it was a bit more seamless, but I got it to work the way I wanted it to.

    Regards, 

    Gotoda

Children
No Data
Related