我设置一个具有可读可写属性的Characteristic,其Value为20 个字节的数组。当我主机写不满20个字节时,写入从机的值后面就会随意添加字符,请问是咋回事呢?
如下是我从机Uart打印出来的数据,我写入123,打印出来如下图:
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我设置一个具有可读可写属性的Characteristic,其Value为20 个字节的数组。当我主机写不满20个字节时,写入从机的值后面就会随意添加字符,请问是咋回事呢?
我设置一个具有可读可写属性的Characteristic,其Value为20 个字节的数组。当我主机写不满20个字节时,写入从机的值后面就会随意添加字符,请问是咋回事呢?
这个不太推荐,你要知道你到底有几个数据,而不是直接拷贝20个,这样是会出现这个情况,你要strlen或者sizeof试试