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

BLE advertisement using all 31 bytes for user data

Is there a way using the API to utilize all 31 bytes of advertisement data for a user application?  I'm porting an application, which sends data in advertisement packets, to the nRF52811 from another manufacturers part.  The API does validity checks on the data and therefore fails because things like flags, etc, aren't valid since they are user data.

Parents
  • Hi

    The maximum user payload is 29 bytes I'm afraid, as you need a header of 2 bytes (length and type) for each field (appearance, name, service UUID, and so on). All our BLE functions, etc., uses the SoftDevice, which the sd_ble_gap_adv_set_configure() function is a part of, so I don't think there's a way around it. Does sd_ble_gap_adv_set_configure() return an error of some kind for you?

    Best regards,

    Simon

  • I got it working, and your last post gave me the hint I needed.

    After the call to ble_advdata_encode() with 24 bytes of the data (bytes 7 - 30 of user data) in manufacturer data and sd_ble_gap_adv_set_configure(), I replace the data in the first 7 bytes of the buffer (encoded buffer passed to sd_ble_gap_adv_set_configure()) with bytes 1 - 7 of user data, the key being that I replace buffer[0] with the size (30), which works in this case because bytes 0 and 1 of user data are not used.

Reply
  • I got it working, and your last post gave me the hint I needed.

    After the call to ble_advdata_encode() with 24 bytes of the data (bytes 7 - 30 of user data) in manufacturer data and sd_ble_gap_adv_set_configure(), I replace the data in the first 7 bytes of the buffer (encoded buffer passed to sd_ble_gap_adv_set_configure()) with bytes 1 - 7 of user data, the key being that I replace buffer[0] with the size (30), which works in this case because bytes 0 and 1 of user data are not used.

Children
Related