Closed Yandrik closed 1 year ago
btw there's the same issue with the primitives. For example for a u32 char, if you write 3 bytes instead of 4.
I believe a short write packet will cause the softdevice to overwrite the first N bytes of the characteristic value. To get the value stored by the softdevice for a short write, you need to read the characteristic value instead of using the slice passed to the event.
will fail whenever the written value is smaller than four octets, and it will not do so gracefully, but instead panic directly. This PR fixes this problem. New behavior:
[0x10, 0x20, 0x30, 0x40]
via Bluetooth will setsome_characteristic
to that exact value[0x10, 0x20]
via Bluetooth will setsome_characteristic
to[0x10, 0x20, 0x00, 0x00]
, whereby all places that aren't set are zeroed