BLE配对失败 [英] Ble pairing failed

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

问题描述

我参与一个Android应用程序,它确实BLE连接和对接公司BT芯片。该APP是BLE中心作用,而Bt基因芯片是BLE外设的角色。

I was involved an Android APP which does BLE connection and pairing with our company Bt chip. The APP is as BLE central role, while the Bt chip is as BLE peripheral role.

在该应用中使用Android 4.4或5.0智能手机上运行的BLE连接和配对效果很好。当应用程序在Android 5.1或6.0的最新版本上运行,BLE配对是由错误code终止(错误code:13),而BLE连接成功。下面是空的日志:

When the APP runs on Android 4.4 or 5.0 smart phone, the BLE connection and pairing works well. When the APP runs on Android 5.1 or the latest version 6.0, BLE pairing is terminated by error code (error code: 13), while BLE connection is succeed. Here is the air log:

4,148   0x50654c1d  0x0000  1   LL_VERSION_IND      24      2015/12/3 14:13:39.600368   
4,160   0x50654c1d  0x0001  2   LL_VERSION_IND      24   00:00:00.048473    2015/12/3 14:13:39.648841   
4,163   0x50654c1d  0x0002  1   LL_FEATURE_REQ      27   00:00:00.048522    2015/12/3 14:13:39.697363   
4,169   0x50654c1d  0x0003  2   LL_FEATURE_RSP      27   00:00:00.049066    2015/12/3 14:13:39.746429   
4,179   0x50654c1d  0x0004  1   LL_CONNECTION_UPDATE_REQ    0x000a  30   00:00:00.048436    2015/12/3 14:13:39.794865   
4,234   0x50654c1d  0x000b  1   LL_ENC_REQ      41   00:00:00.303755    2015/12/3 14:13:40.098620   
4,237   0x50654c1d  0x000c  2   LL_ENC_RSP      31   00:00:00.007727    2015/12/3 14:13:40.106347   
4,244   0x50654c1d  0x000d  2   LL_START_ENC_REQ        19   00:00:00.007500    2015/12/3 14:13:40.113847   
4,245   0x50654c1d  0x000e  M   LL_START_ENC_RSP        23   00:00:00.007273    2015/12/3 14:13:40.121120   
4,248   0x50654c1d  0x000f  S   LL_START_ENC_RSP        23   00:00:00.007726    2015/12/3 14:13:40.128846   
4,392   0x50654c1d  0x004a  M   LL_CONNECTION_UPDATE_REQ    0x0050  34   00:00:00.442275    2015/12/3 14:13:40.571121   
4,794   0x50654c1d  0x008c  M   LL_CHANNEL_MAP_REQ  0x0093  30   00:00:03.002545    2015/12/3 14:13:43.573666   
7,168   0x50654c1d  0x0131  M   LL_CHANNEL_MAP_REQ  0x0138  30   00:00:08.043797    2015/12/3 14:13:51.617463   
10,065  0x50654c1d  0x0261  M   LL_CHANNEL_MAP_REQ  0x0268  30   00:00:14.820121    2015/12/3 14:14:06.437584   
10,449  0x50654c1d  0x029d  M   LL_TERMINATE_IND        24   00:00:02.925044    2015/12/3 14:14:09.362628

我的转Bt基因宿主程序(基于转Bt基因芯片)收到 CONNECTION_PARAMETER_UPDATE_COMP_IND 事件,然后收到 LE_DEVICE_DISCONNECT_COMP_IND 事件。我想断开操作 BLE 由Android的转Bt基因栈完成。

My Bt host program (based on Bt chip) received CONNECTION_PARAMETER_UPDATE_COMP_IND event, and then received LE_DEVICE_DISCONNECT_COMP_IND event. I guess the operation of disconnect BLE is done by Android Bt stack.

在Android 4.4或5.0,有没有收到 CONNECTION_PARAMETER_UPDATE_COMP_IND 事件,那么什么是关于它的事情,我怎么可能在Android 5.1或6.0 BLE配对成功。任何帮助将AP preciated。

In Android 4.4 or 5.0, There is no CONNECTION_PARAMETER_UPDATE_COMP_IND event received, So what's the matter about it, how could I make BLE pairing success on Android 5.1 or 6.0. Any help will be appreciated.

推荐答案

有关蓝牙低功耗设备的发现和配对有被支持的两种方式。

For Bluetooth low energy devices finding and pairing there is two ways is being supported


  1. 对于奇巧版本并低于

startLeScan() 


此方法需要一个 BluetoothAdapter.LeScanCallback 作为参数

This method takes a BluetoothAdapter.LeScanCallback as a parameter

对于棒棒糖版本以上

mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();

mBluetoothLeScanner.startScan(filters, settings, mScanCallback);

和你需要定义你的回调为流得到响应

and you need to define your callback as flow to get response

private ScanCallback mScanCallback = new ScanCallback() {
@Override
public void onScanResult(int callbackType, ScanResult result) {

}

@Override
public void onBatchScanResults(List<ScanResult> results) {

}

@Override
public void onScanFailed(int errorCode) {

}
};


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

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