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

Sending more than 8bits of data over bluetooth

I'm looking into the service creation portion of BLE, and I've made it pretty far. But one problem that I'm running into is sending more than 8 bits of data at a time back to the board. The service example provided, Immediate Alert Service (IAS), can only send 8 bits at a time. I've dug fairly deep into how they send data, and I hit that 8 bit wall every time. Is this a restriction to all services or only the examples?

So in short, is there an easy way to send more data that I am missing?

Thanks in advance!

Parents
  • As you can see in the Core Specification, Volume 3, part F, sections 3.4.4 to 3.4.8, depending on the operation you do, you can transmit up to 20 (write/notify/indicate) or 22 (read) bytes in each operation over BLE.

    The only thing you have to do in your service code to do this is to make sure that the length of your characteristic is set correctly. There is a init_len and max_len field in the ble_gatts_attr_t field that sets the initial and max length of a characteristic, and additionally a vlen field in ble_gatts_attr_md_t that sets whether or not a characteristic has variable length.

    Once you have set these parameters correctly, you can send a notification with length up to 20 bytes. As Carles notes in his answer, if you receive a write event, you can access the remaining bytes without changing the header file by just indexing the data field accordingly.

Reply
  • As you can see in the Core Specification, Volume 3, part F, sections 3.4.4 to 3.4.8, depending on the operation you do, you can transmit up to 20 (write/notify/indicate) or 22 (read) bytes in each operation over BLE.

    The only thing you have to do in your service code to do this is to make sure that the length of your characteristic is set correctly. There is a init_len and max_len field in the ble_gatts_attr_t field that sets the initial and max length of a characteristic, and additionally a vlen field in ble_gatts_attr_md_t that sets whether or not a characteristic has variable length.

    Once you have set these parameters correctly, you can send a notification with length up to 20 bytes. As Carles notes in his answer, if you receive a write event, you can access the remaining bytes without changing the header file by just indexing the data field accordingly.

Children
Related