为什么主设备采集从设备的数据不用read功能?我看大家都说用从机的notify功能。
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.
建议您先读一下之前论坛的帖子 https://www.deyisupport.com/question_answer/wireless_connectivity/bluetooth/f/103/t/22426.aspx
希望对您有所帮助!
你好,
你可以使用read,这个取决于你主机端是不是希望实时的知道从机的charactertic值已经改变,还是你不在乎,你只需要在想读的时候再去读主机。
notification的功能描述的比较好的一个说法如下所示:
说简单点,先discovery(GAPCentralRole_StartDiscovery),回调中处理simpleBLECentralStartDiscovery(),通过UUID找到对应的handle,handle就是
attribute的地址,然后就可以使用GATT_WriteCharValue()或GATT_ReadCharValue()像指定的handle发送读写操作。最后在simpleBLECentralProcessGATTMsg()处理操作结果。还有另外一种通讯方式是notification,就是server主动向Client发送数据,不同于上面这种request/response模式,附图如下。