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

Characteristics Larger Than 20 Bytes

I have read through the forum on this and I am still not completely clear. Here are my questions:

  1. Can I create characteristics that are larger than 20 bytes? The Bluetooth SIG has several characteristics that are longer than 20 bytes the org.bluetooth.characteristic.location_and_speed for example.
  2. Can notifications be used for characteristics longer than 20 bytes?

Thanks in advance, Darren

    1. Yes - there's a constant in the SDK which gives the maximum length for fixed and variable length characteristics. Basically it's around 255 bytes

    2. You can notify them but you'll only get MTU-3 bytes in the notification and if the client wants the rest it will have to read the characteristic afterwards with a long read. Notifications have a max payload of MTU-3 bytes and MTU is currently 23 so 20 is the max. You can set the offset of the data you are notifying when you notify it to send something other than the first 20 bytes, however nothing on the client side will tell it that offset, it just gets 20 bytes, so that's not very useful. See the Core Bluetooth spec for the details of the notification procedure's packets.

  • RK,

    Thanks for the fast response! Do you know of any examples in the SDK that show characteristics larger than 20 bytes?

Related