android M +可以拥有的最大并发Ble连接数是多少 [英] What is the max concurrent Ble connections android M+ can have

查看:813
本文介绍了android M +可以拥有的最大并发Ble连接数是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序需要同时连接9个Ble设备。
在此文章以及它写的其他任何Android 4.4+可以连接的资源中仅适用于7台设备。
M或N版本是否有新功能?
谢谢。

My app required to connect 9 Ble devices concurrently. In this article and any other resource it write that android 4.4+ can connect only to 7 devices. Is there anything new in M or N versions? Thanks.

推荐答案

连接数受常数MAX_L2CAP_LINKS和GATT_MAX_PHY_CHANNEL的限制,该常数当前(仍)设置为7。

The number of connections is limited by the constants MAX_L2CAP_LINKS and GATT_MAX_PHY_CHANNEL which is currently (still) set to 7.

如果您尝试使用autoConnect = true连接第8个设备,则由于Android M中引入的错误,堆栈将挂起并且无法再次连接,直到重新启动蓝牙为止。 autoConnect = false以连接第8个设备,您将立即获得一个onConnectionStateChange回调,而newState =已断开,并且不会尝试进行连接。

If you try to connect the 8th device with autoConnect = true, the stack will hang and fail to connect again until you restart Bluetooth due to a bug introduced in Android M. If you use autoConnect = false to connect an 8th device you will immediately get an onConnectionStateChange callback with newState = disconnected and no attempt to connect will be made.

我不知道为什么这些常数是如此之低。通常,硬件本身可以完成超过7个任务。例如,如果您自己编译AOSP并更改常量,则Nexus 6P可以完成15个任务。

I don't know why these constants are so low. Often the hardware itself can do more than 7. For example, Nexus 6P can do 15 if you compile AOSP yourself and change the constants.

三星似乎已经注意到了这个问题并增加了某些设备的常数。例如,三星Galaxy Tab A 10.1可以处理15个BLE连接而无需进行修改。

Samsung seems to have noticed the issue and increased the constants on some of their devices. For example, Samsung Galaxy Tab A 10.1 can handle 15 BLE connections without modifications.

这篇关于android M +可以拥有的最大并发Ble连接数是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆