I wasn't able to figure this one out from the documentation:
when do I set attr_md.vlen
to 1 or 0? What are the implications?
Thanks M
I wasn't able to figure this one out from the documentation:
when do I set attr_md.vlen
to 1 or 0? What are the implications?
Thanks M
The vlen field can be set to mark a characteristic as variable length. A characteristic can either be of constant length (vlen = 0), or of variable length (vlen = 1).
E.g. for the UART characteristics, it makes sense to have vlen = 1, since you may want to transmit any size of data from 1 to 20 bytes. But, e.g. for the Temperature Type, which is a fixed length characteristic (it has 8 bits and every bit is fixed),vlen should be 0.
Hi Moritz. It will then read the length of the whole characteristic. For the UART example it will therefore read 20 bytes, even though you maybe just sent 5 bytes. The 15 other bytes will be garbage values. If you want to send more data, you should instead create a new characteristic.
Hi Moritz. It will then read the length of the whole characteristic. For the UART example it will therefore read 20 bytes, even though you maybe just sent 5 bytes. The 15 other bytes will be garbage values. If you want to send more data, you should instead create a new characteristic.