bluetooth-lowenergyweb-bluetoothcharacteristics

Long characteristic on web bluetooth


BLE allows transmitting from 2 up to 256 bytes as the payload in a single burst. But, the long characteristics on android/ios can be read in chunks.
What happens on web-bluetooth? Can web bluetooth read long characteristics?
Does it split in chunks when the characteristic has more than 512 bytes?


Solution

  • I don't know where you have got the number 2 - 256 bytes from. The length per Read Request / Read Blob Request is determined by the current MTU (which may be up to 65535 bytes). A characteristic value can be up to 512 bytes long. You can hence never read a value longer than this since a characteristic value is not allowed to be longer than 512 bytes.

    Web Bluetooth defines that when a value is read, it shall "Use any combination of the sub-procedures in the Characteristic Value Read procedure to retrieve the value of characteristic". So yes if multiple requests are required (depends on MTU) to read the value, it will do so.