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.

如何保证BLE数据的可靠性传输

BLE 1.40里有两个发送notify的函数:GATT_Notification和GATTServApp_ProcessCharCfg

那要如何保证数据的可靠性传输呢?

bStatus_t GATTServApp_ProcessCharCfg( gattCharCfg_t *charCfgTbl, uint8 *pValue,
                                        uint8 authenticated, gattAttribute_t *attrTbl,
                                        uint16 numAttrs, uint8 taskId );

最后一个taskid参数是如何使用的?

  • GATT_Notification是直接将数据发送给master,GATTServApp_ProcessCharCfg会让master调用read请求, 然后再调用到sk_ReadAttrCB()

    你想用Notification的话最好用GATT_Notification(), 这个直接发送Notification, 不会像GATTServApp_ProcessCharCfg再会让master向slave去发送一个读的请求.

    可参考帖子 http://www.deyisupport.com/question_answer/wireless_connectivity/f/45/t/23478.aspx


  • 好;

        也就是说,GATTServApp_ProcessCharCfg这个函数是实际上让master那边来读,而GATT_Notification只是slave自己发数据出去?

        那么是不是在可靠性上,GATTServApp_ProcessCharCfg这个函数要更好一些?或者说GATTServApp_ProcessCharCfg只能连接不断,就能发送成功?

        还有,GATTServApp_ProcessCharCfg这个最后的参数是怎么使用的?他会给taskid发送什么事件嘛?

  • wewei,

    这两个都能保证数据完整传输。

    蓝牙的空中包有CRC校验,只要对方收到数据有CRC错误,或者没有相应的LL ack,都会重传。

  • 您好,请问对方如果有crc错误,ble的notification会返回发送失败,还是自动就重传了呢,是不是notification返回success,主机端就一定收到了正确数据了呢?