完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我正在做一个应用程序,我有一个中心和多个外围设备。人们的愿望是中央向外围设备发送数据。
它经历扫描、连接、写入数据、断开连接等过程。 最初我用的是: 无应答 但有时消息被删除了。 我改为使用: CygLay-GATCt文字特征值 如果接收到响应,则此函数会导致CyByLyEvtGATCKWRIGETEYRSP。我有一个时间监视器,以便如果响应没有及时返回(80ms),我尝试用另一个调用发送第二次: 如果我第二次调用那个函数,我得到一个CyByrError的无效操作。 如果我没有得到回复,有没有办法重新发送消息?有没有更好的方法来确定写不成功并重新发送?或者我需要断开,重新连接,重新发送? 以上来自于百度翻译 以下为原文 I am working an application whereby I have a Central and multiple Peripherals. The desire is for the Central to send data to the Peripherals. It goes through a process of scan, connect, write data, disconnect, etc… Initially I was using : CyBle_GattcWriteWithoutResponse but sometimes the messages were getting dropped. I changed to using: CyBle_GattcWriteCharacteristicValue This function results in CYBLE_EVT_GATTC_WRITE_RSP if the response is received. I have a time monitor so that if the response does not come back in time (80ms), I try to send the write a second time with another call to: CyBle_GattcWriteCharacteristicValue If I call that function a second time, I get a CYBLE_ERROR_INVALID_OPERATION Is there a way to resend a message if I don’t get a response? Is there a better way to determine that a write was not successful and resend it promptly? Or do I need to disconnect, reconnect, and resend? |
|
相关推荐
1个回答
|
|
|
功能cyble_gattcwritecharacteristicvalue()将事件cyble_evt_gattc_error_rsp或cyble_evt_gattc_write_rsp取决于成功的编写特点。
你应该等待,直到你得到一个回应。 有可能,你可以尝试的功能cyble_gattcreliablewrites()可靠地写入数据。(见表表/ API参考,通过右键点击的组件在PSoC Creator IDE并选择“打开表”/“开放API文档”) 调用另一个写请求应该是美好的,但它可能是你发送的请求太快,取决于你的发射/接收窗口/定时/延时芯片前有时间超时/尝试请求。 你不应该重新尝试的请求命令。尝试撞击你的时间从80ms起来说1或2秒,如果您收到一个在尝试一种新的读写响应。如果你想做的东西是不可能发生的错误(一般invali_operation连接扫描时,广告在中央模式,等等)或者祝福不能执行该操作ATM(打一次以后可能或可能不工作)。 以上来自于百度翻译 以下为原文 The function CyBle_GattcWriteCharacteristicValue() will return the event CYBLE_EVT_GATTC_ERROR_RSP or CYBLE_EVT_GATTC_WRITE_RSP depending on successful write of the characteristic. You should be waiting until you get one of those responses. Potentially, you can try the function CyBle_GattcReliableWrites() to reliably write the data. (See the BLE datasheet/API reference by right-clicking on the BLE component in the PSoC Creator IDE and selecting the "Open Datasheet"/"Open API Documentation") Calling another write request should be fine, but it could be you are sending the request too quickly depending on your BLE Tx/Rx windows/timing/latency before the chip has time to timeout/try the request. You shouldn't have to reconnect to try a BLE request command. Try bumping your time from 80ms up to say 1 or 2 seconds to see if you are getting one of the two write responses before attempting a new write. The INVALI_OPERATION error generally occurs if you are trying to do something that is impossible (connect while scanning, advertise while in central mode, etc.) or if the BLESS can't perform that operation ATM (calling again later may or may not work). |
|
|
|
|
只有小组成员才能发言,加入小组>>
786个成员聚集在这个小组
加入小组cyUSB3014一直显示2.1,不能到3.0情况,谁遇到过
7088 浏览 0 评论
2474 浏览 1 评论
2166 浏览 1 评论
4031 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
2073 浏览 6 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
7566浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
6114浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
742浏览 2评论
710浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
7962浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 03:32 , Processed in 0.634249 second(s), Total 72, Slave 55 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
380