Android:同时 BLE 连接的限制

Android: Limit of simultaneous BLE connections(Android:同时 BLE 连接的限制)

本文介绍了Android:同时 BLE 连接的限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

we are developing an Android app which can connect to multiple heart rate sensors simultaneoulsy via Bluetooth Low Energy.

We have an implementation which is working quite well, so the code is not the problem. What drives us crazy is the limitation of parallel BLE-connections which seems to be different from device to device.

We have a few test devices here: Motorola MotoE and MotoG, a Samsung Galaxy Tab A and an HTC Nexus 9. All of them are running Android 5 or 6, original vendor versions. None of them is able to connect to more than 7 BLE HR sensors simultaneously.

Then I have tested with my private Samsung Galaxy S4, which is rooted and has Cyanogen CM12 installed. With this device I can easily connect to 12 HR sensors simultaneously which is the number we want to achieve with our app.

I have tested this both with our own app implementation and with the Nordic Semiconductor nRF Master Control Panel which I think is a pretty good generic BLE app: https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&hl=de

When I try to connect the app to a 7th BLE sensor on any of our devices, the ADB output prints the following error message: E/BluetoothLeBasicConn: Connection state changing error: 133

I did some pretty intensive googling about that whole problem, but most of the results I've found were quite old. Some people said, that the limitation came from the Bluetooth Chipset itself, others said it was a software limitation through Android.

Could you help me to find out, where the limitation is coming from?

If it is the chipset, then I would like to know, which devices we should use for supporting as many parallel connections as possible. Sadly it is very hard to find out which Bluetooth chipset is built in the different devices. Hardly any of the hardware specs I found tell anything about this.

If the limitation comes from software side, can we change it somehow without rooting phones or install modded OS?

Thank you very much!

解决方案

In case that you are still interested in it. The limit comes from BTA_GATTC_CONN_MAX (hardcoded in android) Which is set to:

  • 4 on Android 4.3 and
  • 7 on Android 4.4

There is by the way also a limit on the amount of characteristics for which you can activate notifications. (BTA_GATTC_NOTIF_REG_MAX) which is:

  • 4 on Android 4.3,
  • 7 on Android 4.4 and
  • 15 on Android 5.0

这篇关于Android:同时 BLE 连接的限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Android:同时 BLE 连接的限制

基础教程推荐