Cypress技术william hill官网
直播中

陈墨

7年用户 318经验值
私信 关注
[问答]

如何使用Android Java代码与运行UART的赛普拉斯BLE设备通信到BLE Central项目?

你好-
我有一个定制设备与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)

刘辉

2018-9-19 15:24:17
你好,
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
举报

陈墨

2018-9-19 15:39:45
引用: dfzvzs 发表于 2018-9-19 19:25
你好,
UART BLE中央项目是关贸总协定客户。这意味着它可以在外围设备上执行读写和来自外围设备的提示通知。
因此,移动应用程序外设必须充当GATT服务器(从CyPress设备接收写入并向CyPress设备发送通知)。

你好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 15:56:39
引用: 霍威电源 发表于 2018-9-19 19:41
你好Madhu
这是非常有洞察力的信息,因为我确实尝试用“WordRealEnsPysPuns:CDD2”特性更新,然后更新服务。我将修改我的代码来使用NoTcCube只发送“通知”CDD1特性来发送更新。
我会让每个人都知道我的进步。

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 16:12:31
引用: 霍威电源 发表于 2018-9-19 19:57
Madhu -
你们的议会非常棒。这正是我所做的。您使用通知特性的指令工作得很好。现在我可以接收WrrECHAR请求,也可以向CyPress设备发送通知。
再次感谢你的帮助。

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
 
举报

更多回帖

发帖
×
20
完善资料,
赚取积分