简体   繁体   English

如何提高Android蓝牙低功耗GATT吞吐量?

[英]How to improve Android Bluetooth Low Energy GATT throughput?

I am having performances issues when doing several consecutive GATT read using the Android BLE API. 使用Android BLE API连续读取多个GATT时,出现性能问题。

I can read about 10 packets per second just for about 5 or 6 seconds. 我每秒可以读取大约10个数据包,大约需要5到6秒钟。 After I read the ~65's packet the throughput decreases to about 1 packet each 1.5 second. 在我读取〜65的数据包后,吞吐量每1.5秒减少到大约1个数据包。

I did several tests and it seems that the internal BLE is getting really slow. 我做了几次测试,似乎内部BLE的速度真的很慢。 On that case it takes about 750ms from the Java GATT read call to the peripheral (there is no bottleneck in the peripheral) and about the same, 750ms, back to the Java API callback. 在这种情况下,从Java GATT读取调用到外围设备(外围设备没有瓶颈)大约需要750毫秒,回到Java API回调大约需要750毫秒。

It seems to me to be poor BLE stack implementation, because when I disconnect from the device (probably some resources are cleaned up) and then reconnect back I can reproduce the same issue: It reads about 10 packets/s for the first 5 or 6 seconds (~65 packet reads) only, then it becomes slow. 在我看来,BLE堆栈实现不佳,因为当我断开与设备的连接(可能清理了一些资源)然后重新连接时,我可以重现相同的问题:它在前5或6读约10个数据包/秒。秒(约65个数据包读取),然后变慢。

I tested it with Galaxy S4 and Nexus 4 devices. 我在Galaxy S4和Nexus 4设备上进行了测试。 Same with both. 两者相同。

Any suggestions on how to improve it? 关于如何改进它的任何建议?

I hope since the Jun 5 2014, you find a solution to your problem. 希望自2014年6月5日以来,您能找到解决问题的方法。 I also have the same issue. 我也有同样的问题。 The first 2 ~ 3 seconds, I receive data in ~100ms. 前2〜3秒,我在〜100ms内收到数据。 After, I receive data each ~2000ms. 之后,我每〜2000ms接收一次数据。 I test on 4.3 and above device. 我在4.3及以上版本的设备上进行了测试。

I found for Lollipop version and above the requestConnectionPriority on BluetoothGatt. 我在BluetoothGatt上找到了Lollipop版本以及在requestConnectionPriority之上。 I have't find solution for 4.* version. 我没有找到4. *版本的解决方案。 If any one have suggestion. 如果有任何建议。

Hope this help someone with bluetooth trouble on data transfer ! 希望这可以帮助在数据传输方面遇到蓝牙问题的人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM