This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Will samples get queued if we attempt to send more than one in a row?

I'm working with the ble_app_hrs_s110_with_dfu_pca10028 (nRF51 PCA10028) example and am wondering what will happen if I attempt to send more than one sample at a time. Will only the last one ever be sent?

Does the underlying sd_ble_gatts_hvx block or queue?

Will only 2 be sent each time, or 1 and then 2 in the following snippet:

uint16_t value1 = 1;
uint16_t value1 = 2;

err_code = ble_hrs_heart_rate_measurement_send(&hrs, value1);
err_code = ble_hrs_heart_rate_measurement_send(&hrs, value2);
  • Hi

    There are sent up to 6 packets per connection interval, i.e. maximum of 6x20=120 bytes per connection interval. The softdevice will buffer up 7 packets for each characteristic. The softdevice will send six packets in a single connection event if there are six packets to send. This depends however if the central device will accept 6 packets per connection event or something less, see this thread.

    So you can call the sd_ble_gatts_hvx function multiple times and data will be buffered up until the function returns BLE_ERROR_NO_TX_BUFFERS. The application will receive BLE_EVT_TX_COMPLETE for each sent packet. Further information on softdevice buffer status is here

    Each packet will contain only one characteristic value. So to maximize data throughput, you should have your characteristic defined with a length of 20 bytes because that is the maximum data in each packet.

Related