response_slot

Hi,Team,

I am developing Pawr using nrf54l15-dk.

For the Pawr  example I refer to E:\NCS\v2.8.0\zephyr\samples\bluetooth\periodic_adv_rsp and periodic_sync_rsp.

Regarding the request_cb in the periodic_adv_rsp, I want to send data to the devices for sub-event 0, response slot 0, response slot 2, response slot 3, sub-event 2, response slot 1, response slot 2, response slot 5, etc. How should I do this? At present, I can only send data to all the response slots of sub-events. I don't know how to send data to some specific response slots of devices.

Thanks.

Parents
  • Hi,

    You can spesify the response slot in the response_slot field in the bt_le_per_adv_response_params struct, as shown here

  • Hi,

    I don't want to use the structure bt_le_per_adv_response_params to set the response slots.

    Instead, I want to use the request_cb (in periodic_adv_rsp) to send data to the specified certain response slot devices.

    The sample code is as follows. How should I modify the structure bt_le_per_adv_subevent_data_params?


    Maybe the code "subevent_data_params[i].response_slot_start = 0; subevent_data_params[i].response_slot_count = NUM_RSP_SLOTS;"should be modified. But I don't know how to make the modifications.

    static void request_cb(struct bt_le_ext_adv *adv, const struct bt_le_per_adv_data_request *request)
    {
    	int err;
    	uint8_t to_send;
    	struct net_buf_simple *buf;
    
    	to_send = MIN(request->count, ARRAY_SIZE(subevent_data_params));
    
    	for (size_t i = 0; i < to_send; i++) {
    		buf = &bufs[i];
    		buf->data[buf->len - 1] = counter++;
    
    		subevent_data_params[i].subevent =
    			(request->start + i) % per_adv_params.num_subevents;
    		subevent_data_params[i].response_slot_start = 0;
    		subevent_data_params[i].response_slot_count = NUM_RSP_SLOTS;
    		subevent_data_params[i].data = buf;
    	}
    
    	err = bt_le_per_adv_set_subevent_data(adv, to_send, subevent_data_params);
    	if (err) {
    		printk("Failed to set subevent data (err %d)\n", err);
    	} else {
    		printk("Subevent data set %d\n", counter);
    	}
    }

    Thanks.

  • Hi,

    I do not have an example, but the response data is set by a call to bt_le_per_adv_set_response_data() and the second parameter is a bt_le_per_adv_response_params instance, and this let's you specify the response slot.

    dede said:

    I don't want to use the structure bt_le_per_adv_response_params to set the response slots.

    Instead, I want to use the request_cb (in periodic_adv_rsp) to send data to the specified certain response slot devices.

    I am not sure I understand. You can set the response data after getting the callback here? Why is that a problem? I do not believe there are any other suitable APIs than bt_le_per_adv_set_response_data().

Reply
  • Hi,

    I do not have an example, but the response data is set by a call to bt_le_per_adv_set_response_data() and the second parameter is a bt_le_per_adv_response_params instance, and this let's you specify the response slot.

    dede said:

    I don't want to use the structure bt_le_per_adv_response_params to set the response slots.

    Instead, I want to use the request_cb (in periodic_adv_rsp) to send data to the specified certain response slot devices.

    I am not sure I understand. You can set the response data after getting the callback here? Why is that a problem? I do not believe there are any other suitable APIs than bt_le_per_adv_set_response_data().

Children
  • Hi,

    The request_cb callback function allows you to set the response data. Please refer to the project "periodic_adv_rsp (\ncs\v2.8.0\zephyr\samples\bluetooth\periodic_adv_rsp)" for the implementation of request_cb.

    I want to enable the broadcaster to send data to some of the response slots for the specified sub-events. The scanners subscribing to these response slots will be able to receive this data, rather than all the response slots of the sub-events being able to receive the data.

    For example: The scanner devices send data to event 0, slot 0, slot 2, and slot 3, or event 2, slot 1, slot 2, and slot 5, etc. These scanner devices return the data to the broadcaster, and the other slots will not receive the data.
    In the "periodic_adv_rsp" sample of "cs\v2.8.0\zephyr\bluetooth" project, the code of the "request_cb" broadcasts the buf data to sub-event 1, response slot 0, 1, 2, 3, etc. for scanning devices. However, this is a continuous response slot. I don't know how to implement the sending of data to the discontinuous response slots of sub-events. 

    subevent_data_params[i].subevent = 1;
    subevent_data_params[i].response_slot_start = 0;
    subevent_data_params[i].response_slot_count = 3;
    subevent_data_params[i].data = buf;

    Thanks.

  • Hi,

    I think there may be some confusion here. The advertiser never end anything in response slots, it listens in response slots. The advertiser sends data in subevents and in each subevent it listens for a number of response slots. The scanner/sync listens for a set of subevents (typically just one) and responds in a response slot.

    The samples are very simple and allocates one (subevent, response slot) pair to each synced device. So there is a one-to-one mapping here which might be why you refers to "certain response slot devices"? If the PAwR network has a lot of synced devices this will not work.

    Since the response slots to listen to is specified as (start, count) there is no way to specify a discontinuous set of response slots. Instead the advertiser will have to set a larger range that includes all of the response slots you wants to listen to, including some where there will be no responses. The controller will just report to the host that it didnt receive anything in some of the response slots.

Related