Android BLE “Write Long Characteristic Value” 安卓蓝牙低功耗(BLE)”写入长特征值”

huangapple go评论68阅读模式
英文:

Android BLE "Write Long Characteristic Value"

问题

我需要编写一个Android应用程序,与一个BLE GATT服务器设备通信。我需要该应用程序实现《Core Bluetooth 4.2规范(Vol. 3 Part G)》中指定的“写入长特征值”过程,并想知道Android蓝牙堆栈是否实现了此过程,或者是否有任何可用的库可以帮助实现。我已经搜索了文档,但没有找到关于这个特定主题的信息。在Linux上,我已经使用pygatt(GATTTool后端)实现了一个Python脚本,它可以完美运行,所以我认为Android也应该能够做到。

我还尝试了来自Nordic的nRF应用程序,但在尝试发送比MTU大小更长的消息时,该应用程序裁剪了数据,而不是为数据块使用准备写入并在最后执行写入。我认为这是该应用程序的限制,而不是Android上的BLE堆栈限制,这就是为什么我考虑实现自己的应用程序的原因。

任何信息将不胜感激。谢谢。

英文:

I need to write an Android App to communicate with a BLE GATT server device. I need the app to implement the "Write Long Characteristic Value" procedure as specified in the Core Bluetooth 4.2 Specification (Vol. 3 Part G), and I would like to know if the Android Bluetooth stack implements this procedure or if there is any library that could help. I've been searching the documentation and found nothing about this specific subject. On Linux I have implemented a python script with pygatt (GATTTool Backend) and it works perfectly, so I would assume Android should be able to do it too.

I also tested with nRF app from Nordic, but when trying to send a message longer than the MTU size the app crops the data instead of using the prepare write for the chunks and the write executive at the end. I'm assuming this is a limitation of the app and not the BLE stack on Android, and that's why I'm thinking of implementing my own app.

Any information would be appreciated. Thanks.

答案1

得分: 1

Android原生支持长写入。只需进行普通写入,Android会在幕后将其分解。只要GATT服务器能够处理,它就应该可以工作。

英文:

Android supports long writes out of the box. Just do a normal write and under the hood Android will break it up. So as long as the GATT server can handle it, it should work.

huangapple
  • 本文由 发表于 2023年7月14日 04:27:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76683019.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定