Android的BLE连接的时间间隔 [英] Android BLE Connection time interval

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

问题描述

我正在开发采用Android BLE API在Nexus 4 BLE的应用程序。我有几个问题/疑虑:

I am developing a BLE application on Nexus 4 using Android BLE API. I have a few questions/doubts:

1)有没有一种方法来设置/覆盖的BLE中心设备的连接或通知的时间间隔。我发现,对于Android,默认的连接时间间隔固定为7.5ms。有没有办法来改变这种连接/通知延迟间隔设置。

1) Is there a way to set/override the connection or notification interval of BLE central device. I have found that for Android, the default connection interval is fixed to 7.5ms. Is there a way to change this connection/notification delay interval settings.

来源:<一href="http://processors.wiki.ti.com/index.php/Bluetooth_SensorTag?DCMP=lprf-stdroid&HQS=lprf-stdroid-pr-wiki1#Supported_Android_devices">http://processors.wiki.ti.com/index.php/Bluetooth_SensorTag?DCMP=lprf-stdroid&HQS=lprf-stdroid-pr-wiki1#Supported_Android_devices

2)在连接到所述远程设备,我面对随机的一段时间间隔后得到断线的问题。有面向连接中断的问题,指出Android是不稳定的,当他们使用的是Android 4.3的API BLE连接的许多人。有没有什么解决方案呢?

2) On connecting to the remote device, I am facing an issue of getting disconnection after random period of time interval. There are many people facing the connection drop issue stating that android is unstable when they are using Android 4.3 API for BLE connection. Is there any solution for this?

修改

当它需要时间来重新连接,然后它的未来与一些L2CAP日志......日志下面还有什么我发现这里是

what else I observe here is when it is taking time to reconnect then it's coming with some L2CAP log ...following the log

Trying to create a new connection laststate_ BOND_NONE
D/BluetoothGatt( 9620): connect() - device: 1C:BA:81:11:CA:36, auto: true
D/BluetoothGatt( 9620): registerApp()
D/BluetoothGatt( 9620): registerApp() - UUID=1a9a0911-4d5c-41dc-8ac0-0284ef550510
D/BtGatt.GattService( 3208): registerClient() - UUID=1adsds0911-4sdsc-41dc-8ac0-0sdsdf550510
D/BtGatt.btif( 3208): btif_gattc_register_app
D/BtGatt.btif( 3208): btgattc_handle_event: Event 1000
D/BtGatt.btif( 3208): btif_gattc_upstreams_evt: Event 0
D/BtGatt.GattService( 3208): onClientRegistered() - UUID=1a9a0911-4d5c-41dc-8ac0-0284ef550510, clientIf=5
D/BluetoothGatt( 9620): onClientRegistered() - status=0 clientIf=5
D/BtGatt.GattService( 3208): clientConnect() - address=1C:BA:8C:1E:CA:36, isDirect=true
D/BtGatt.btif( 3208): btif_gattc_open
D/BtGatt.btif( 3208): btgattc_handle_event: Event 1004
D/BtGatt.btif( 3208): btif_get_device_type: Device [1c:ba:8c:1e:ca:36] type 2, addr. type 0
W/bt-l2cap( 3208): L2CAP - LE - cannot start new connection at conn st: 3

不知道如何可以清除cahce通过L2CAP十个分量?

Any idea how can clear cahce mantain by L2CAP?

推荐答案

在我所研究的机器人BLE API,我无法找到一个API,用于改变连接间隔和监督超时(也许从潜伏期为好,不记得从我的头顶)。我确实需要改变这些,必须从机做。

When I studied the Android BLE API, I could not find an API for changing the connection interval and supervision timeout (maybe slave latency as well, can't remember from the top of my head). I you do need to change these, you must do it from the slave device.

这是阿什维尼你可以忽略的答案,他说的是完全不对的。蓝牙4.0标准的主设备必须支持连接的间隔时间从7.5毫秒至4.0s。从设备可以请求连接参数的变化,并发送连接参数更新请求,则主机相应地更新连接参数。

The answer from Ashwini you can just ignore, what he says is simply not correct. A Bluetooth 4.0 compliant master device must support connection intervals from 7.5 ms up to 4.0s. The slave device may request a change in connection parameters and sends a connection parameter update request, and the master will update the connection parameter accordingly.

在另一方面,主(在你的情况下,Android设备)可能有兴趣在改变自己的连接时间,为了节省电力,而且你想连接的时间间隔更改为更轻松间隔。

On the other hand, the master (in your case the Android device) could have an interest in changing the connection interval on its own, in order to save power, and you would like to change the connection interval to a more relaxed interval.

在我看来,Android的API,甚至硬件实现在多个设备不成熟以及使用BLE,在这个意义上,BLE的目的,即将多少电在Android设备上。在未来,我相信你会看到在API层面更好的支持和主机的分工和控制器,从而使控制器可以保持连接,即使在移动设备的主CPU处于睡眠状态。这将节省大量的电力,你可以保持连接与您的BLE装置全天候不会对你的电池寿命任何重大约束。

In my opinion the Android API and even the hardware implementation on several devices are immature and using BLE, in the sense that BLE was intended, draws to much power on an Android device. In the future I believe you will see much better support on the API level and a division of the host and controller so that the controller can maintain connectivity even when the main CPU of the mobile device is sleeping. That will save a lot of power and you can maintain connectivity with your BLE devices 24/7 without any major constrain on you battery life.

这篇关于Android的BLE连接的时间间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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