完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好-
我有一个定制设备与CyPress BLU4半导体安装和运行UARTHYTUBLULL中央代码项目(第20天)。该设备以中心模式运行。我的外围设备实际上是Android三星Galaxy S7手机,运行Java API 24。我在电话上创建了一个定制的Services,它复制了与USB BLE Gunle CyPress提供的开发工具包相同的服务。这一个:CY5670HTP://wwwyCyp.com /文档/开发-KITSBBOARDS/CY5670CySMART-UB-GELE 移动应用程序能够成功地广告和连接中央,我可以查看数据包来回发送使用我的Hollong BLE Sniffer。我的问题很简单,但我需要帮助。连接后,如何将信息发送回设备?我从BLE技术中了解到,外围设备需要将更新广播回所有连接的设备,但是我不确定CyPress代码实际上在哪里读取这个。在连接完成后,扫描数据被恢复,我只收到1个写入请求到我的描述符回调函数,称为“启用通信”。我相信这是从AppsBule.c文件,VelueEnabelotimeIsCd()函数中得到的。 我希望它能在AppuUART.C代码中的空隙HealuuARTTXCuffic(空)函数成功的BLE连接之后处理所有请求。在监视嗅探器中的日志时,似乎通信一直在PDU分组中发送,但由于任何东西都没有击中我的回调函数,所以我无法检索其中任何一个。有没有使用Cype产品的Android BLE开发的经验?欢迎大家提出意见和问题。 以上来自于百度翻译 以下为原文 Hello- I have a custom device with a Cypress BLE4 Semiconductor installed and running the UART_to_BLE_central code project (day 20). This device is running in central mode. My peripheral is actually an Android Samsung Galaxy S7 phone runing Java API 24. I have created a custom serivce on the phone that replicates the same service as the USB BLE Dongle Cypress provides with the development kit. This one: CY5670 http://www.cypress.com/documentation/development-kit***oards/cy5670-cysmart-u***-dongle The Mobile App is able to advertise and connects successfully with the central and I can view Data Packets being sent back and forth using my Hollong BLE Sniffer. My question is pretty simple but I need help with it. After connection, how do I send information back to the device? I understand from BLE technology that the Peripheral needs to broadcast updates back to all connected devices however I am not sure where the Cypress code is actually reading this. After connection is made and the Scan data is returrned I only recieve 1 Write request to my Descriptor callback function saying to "Enable Communctions". I believe this is from the app_BLE.c file, void enableNotifications() function. What I expect is for it to handle all requests after the successful BLE connection at the void HandleUartTxTraffic(void) function in app_UART.c code. While monitoring the logs from the sniffer it seems that communications is consistently being sent in the PDU packets but I am unable to retrieve any of it because nothing is hitting my callback function. Anyone have experience with Android BLE development with Cypress products? All comments and questions welcome. |
|
相关推荐
7个回答
|
|
你好,
UART BLE中央项目是关贸总协定客户。这意味着它可以在外围设备上执行读写和来自外围设备的提示通知。 因此,移动应用程序外设必须充当GATT服务器(从CyPress设备接收写入并向CyPress设备发送通知)。 不是从Android应用程序发送通知,而是尝试发送写?如果是这样,写会失败。 您需要从Android应用程序发送通知,该通知将在UART中央项目的AppsBel.c中触发CyByLyEvtGATCK-HANDLYValueNTF事件,然后由HealuuARTrxCuffic API处理。 当做, - Madhu Sudhan 以上来自于百度翻译 以下为原文 Hi, The UART BLE Central project is a GATT Client. Which means it can perform read and write on the peripheral device and accpet notifications from the peripheral. So the mobile app peripheral must act as a GATT Server (Receives write from the Cypress Device and sends notifications to the Cypress device). Instead of sending notifications from the android app, are you trying to send write? If so the write would fail. You need to send notifications from the android app which will trigger a CYBLE_EVT_GATTC_HANDLE_VALUE_NTF event in the app_ble.c of the UART Central project and is in turn handled by the HandleUartRxTraffic API. Regards, - Madhu Sudhan |
|
|
|
dfzvzs 发表于 2018-9-19 19:25 你好Madhu 这是非常有洞察力的信息,因为我确实尝试用“WordRealEnsPysPuns:CDD2”特性更新,然后更新服务。我将修改我的代码来使用NoTcCube只发送“通知”CDD1特性来发送更新。 我会让每个人都知道我的进步。 谢谢, 罗翰 以上来自于百度翻译 以下为原文 Hi Madhu- This is very insightful information, as I was indeed trying to update with the "WriteNoResponse" CDD2 characteristic and then updating the service. I will modify my code to send updates using Notifcations only which is the "Notify" CDD1 characteristic. I will keep everyone posted with my progress. Thanks, Rohan |
|
|
|
霍威电源 发表于 2018-9-19 19:41 Madhu - 你们的议会非常棒。这正是我所做的。您使用通知特性的指令工作得很好。现在我可以接收WrrECHAR请求,也可以向CyPress设备发送通知。 再次感谢你的帮助。 罗翰 以上来自于百度翻译 以下为原文 Madhu- Your counci was superb. That is exactly what I was doing. And your instruction to use the notification characteristic worked perfectly. I can now recieve writechar requests as well as send notifications to the cypress device. thank you again for your help. Rohan |
|
|
|
霍威电源 发表于 2018-9-19 19:57 Madhu - 我有一个令人费解的问题要问你。为什么我能从我的周围发送通知,中央只有一次? 由于某种原因,当我连接到设备上的。我得到一个描述符写请求从中央[ 1 ]然后我完成请求和改变的特征我的值发送回信息(cdd1)和发送notificaiton,我成功得到预期的反应。然而,当我试图发送一个通知,它失败了。我什么也收不回来。这是因为我不再得到描述符写来自客户端的请求?都是由cyble_evt_gattc_handle_value_ntf通知事件处理? 请让我知道你对此有何看法。 罗翰 以上来自于百度翻译 以下为原文 Madhu- I have a puzzling question for you. Why am able to send notifications from my Peripheral to Central only once? For some reason right after I connect to the device over BLE. I get a Descriptor Write Request from the Central [1,0] and then I complete the request and send back informaiton by changing my value in the characteritic(CDD1) and send notificaiton, I succesfully get the expected response. However, when I try to send a second notification, it fails. I recieve nothing back. Is this happening because I am no longer getting Descriptor Write requests from the client? Are all notifications handled by the CYBLE_EVT_GATTC_HANDLE_VALUE_NTF event? Please let me know what you think about this. Rohan |
|
|
|
霍威电源 发表于 2018-9-19 20:13 你好,Rohan, 在发送第二个通知之前,您是否在等待调用“OnNoTrimeTeCudio”回调函数? 当要发送多个通知时,应用程序必须在发送附加通知之前等待此回调。 请参考下面的代码示例来介绍Android外围设备。 BLE测试外围Android /APP/SRC/主/ Java/IO/GITHUB/WebBuLeToToCG/BLeestestPrimeMaster·WebButoToScG/BLE… 事实上,你需要参考这个文件-gt;BLE测试外围设备Android /Purialal.java在Master·WebBueToStcg/BLE测试外围Android·Github。 -吉安 以上来自于百度翻译 以下为原文 Hello Rohan, Are you waiting for the "onNotificationSent" callback function to be invoked before sending the second notification? When multiple notifications are to be sent, an application must wait for this callback to be received before sending additional notifications. Please refer the below code example for an android peripheral device. ble-test-peripheral-android/app/src/main/java/io/github/webbluetoothcg/bletestperipheral at master · WebBluetoothCG/ble-… Actually you need to refer this file - > ble-test-peripheral-android/Peripheral.java at master · WebBluetoothCG/ble-test-peripheral-android · GitHub -Gyan |
|
|
|
YHYDZ 发表于 2018-9-19 20:32 嗨,Gyan, 是的,我在等待这个“发送通知”回调。事实上,我在每次调用之间增加了2000毫秒的延迟,因为我意识到在每次通知之后设备都有延迟。我想知道这个问题是这个设备是如何从堆栈中读取字符的。它是从一个叫做ScangnnUm的函数读取的。我不知道我发送的字符是否在这里匹配。我在爪哇发送这个“1”。GETBYTESE(),它应该等同于[49 ]。我的问题是,一旦连接和描述符写入请求已经完成,我不确定这是否已经从CyLype EvtgGalccHydLyValueNTF句柄事件中读取。 空ScangnnUM(自动const ROM char *sgxx字符串,un签署char *ggAddR) { 无符号char in nNm=0; 无符号int ReTynNm=0; 打印字符串(SGSstring);//打印字符串 普塔格(??)“/”打印“?” D/O循环 { InNUM= GETCHARG(); 普特查格(英纳姆); 如果((NNUM和GT;47)&AMP;(InNUM和LT;58))/ /如果ASCII数 { ReTynNu=(ReTrimnN* 10)+(无符号INT)(INNUMN-48); } } 然而((嗯)!= 13);= 10);/ /直到EOL 如果(ReTrimnUngt;255)RethiNum=255;//如果大于255集=255 * SGU-ADDR =(无符号CHAR)ReTr.NUM; PtCARGG(‘n’);//打印回车 } 以上来自于百度翻译 以下为原文 Hi Gyan, Yes I am waiting for this waiting for the "onNotificationSent" callback. In fact I am adding a delay of 2000ms between each call as I realize there is a delay with the device after each notification. I wonder if the issue is how the device is reading chars from the stack. It is reading this from a function called "scang_num". I wonder if the Char I am sending is not getting matched in here. I am sending this "1".getbytes() in Java which should equate to [49]. My problem is I am not sure if this being read from the CYBLE_EVT_GATTC_HANDLE_VALUE_NTF handle event anymore, once the connection and descriptor write request has been made. void scang_num(auto const rom char *sg_string, unsigned char *sg_addr) { unsigned char in_num = 0; unsigned int ret_num = 0; printg(sg_string); //print string putcharg('?'); //print "?" do //loop { in_num = getcharg(); putcharg(in_num); if ((in_num >47) && (in_num <58) ) //if ASCII number { ret_num = (ret_num*10) + (unsigned int)(in_num-48); } } while ((in_num != 13) & (in_num != 10)); //until EOL if (ret_num > 255) ret_num = 255; //if greater than 255 set = 255 *sg_addr = (unsigned char) ret_num; putcharg('n'); //print carriage return } |
|
|
|
霍威电源 发表于 2018-9-19 20:49 你好Madhu 我解决了这个问题…我没有发送“n”新行提要或“结束语句”命令。一切都在如期进行! 谢谢, 罗翰 以上来自于百度翻译 以下为原文 Hello Madhu- I figured out the problem... I was not send the "n" new line feed or "End of statement" command. Everything is working as expected now! Thanks, Rohan |
|
|
|
只有小组成员才能发言,加入小组>>
748个成员聚集在这个小组
加入小组2054 浏览 1 评论
1809 浏览 1 评论
3620 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1746 浏览 6 评论
1499 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
481浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
335浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
400浏览 2评论
341浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
833浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-6 03:21 , Processed in 0.817767 second(s), Total 59, Slave 52 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号