I find it quite counter-intuitive that one defines a characteristic with the characteristic macro and some type but this type is never actually used as a value since it is only used in the macro to initialize the storage capacity of the array in the StaticCell using [0; size_of::<T>()].
I would find it much more intuitive if one could use an array that has the same type as in the characteristic macro and enforce some kind of (de)serialization trait to convert it to its bytes representation as it would be used by the bluetooth stack.
It would also allow for more type safety, because one would not work with raw bytes.
We're in the process of implementing this as part of #151. The idea is that get, set and notify will require the expected type for that characteristic rather than &[u8]
I find it quite counter-intuitive that one defines a characteristic with the
characteristic
macro and some type but this type is never actually used as a value since it is only used in the macro to initialize the storage capacity of the array in theStaticCell
using[0; size_of::<T>()]
.I would find it much more intuitive if one could use an array that has the same type as in the
characteristic
macro and enforce some kind of (de)serialization trait to convert it to its bytes representation as it would be used by the bluetooth stack. It would also allow for more type safety, because one would not work with raw bytes.