简体   繁体   English

Android蓝牙配对

[英]Android Bluetooth Pairing


Can anybody tell me how to find out which pairing technique phone used while connecting to other device? 有人可以告诉我如何找出连接到其他设备时使用的配对技术吗?
I have a Nexus S(Android 2.3.3) and a BT device(Bluetooth2.1+EDR). 我有一个Nexus S(Android 2.3.3)和一个BT设备(Bluetooth2.1 + EDR)。
When I try to pair them, I dont have to give any input(passkey). 当我尝试将它们配对时,我不必输入任何内容(密码)。 As both devices are having bluetooth 2.1, I want to know which pairing technique they used. 由于两个设备都具有蓝牙2.1,我想知道他们使用了哪种配对技术。
Can we specify the pairing technique to phone? 我们可以指定电话配对技术吗?

When both devices are 2.1 and above the Secure Simple pairing (SSP) gets used instead of the legacy pairing (legacy pairing is the one where user was required to enter same PIN on both devices to connect and most of the cases PIN used to be well known common combinations of 0000 or 1234) 当两个设备都在2.1及更高版本时,将使用安全简单配对(SSP)而不是传统配对(传统配对是要求用户在两个设备上输入相同PIN进行连接的配对,并且大多数情况下PIN以前都是正确的已知的常见组合0000或1234)

Secure simple pairing simplifies the process and gets rid of the need for PINs to be entered, instead it generates 6 digit passkeys automatically as part of the pairing process and user may only be required to verify/enter the passkey on one or more of the devices. 安全简单的配对简化了过程,并且无需输入PIN,而是作为配对过程的一部分,它会自动生成6位数字的密钥,并且可能只需要用户验证/输入一个或多个设备上的密钥即可。 。

Secure Simple Pairing (SSP) further has few different association modes and the association model to be used is determined by the display and input capabilities on the devices that are trying to pair. 安全简单配对(SSP)进一步具有几种不同的关联模式,并且要使用的关联模型由尝试配对的设备上的显示和输入功能确定。

When there is no display or input to enter 6 digits on one of the devices, then "Just works" association model gets used , in this the user input is not required during pairing. 如果在其中一台设备上没有显示或输入6位数字的输入,则使用“ Just work”关联模型,在这种情况下,配对期间不需要用户输入。 In Android it is possible to force this model is SPP applications when using the createInsecureRfcommSocketToServiceRecord() API. 在Android中,可以在使用createInsecureRfcommSocketToServiceRecord()API时将此模型强制为SPP应用程序。 This model gets used commonly when pairing with Headsets, other small devices without any display or input capability 与耳机,其他没有显示或输入功能的小型设备配对时,通常使用此模型

Other association models are : 其他关联模型是:

  • Numeric Comparison - Where a 6 digit number is shown on both devices and user is asked to confirm is they are the same. 数字比较-两台设备上均显示6位数字,并且要求用户确认是否相同。 Used when both devices has display and capable of entering Yes/No. 当两个设备都显示并且能够输入是/否时使用。

  • Passkey entry - When one of the devices has only input capability and no output display capability and the other has an output / display capability, here the user will be asked to enter the 6 digits on the input only capable device as shown on the display capable device. 密码输入-当其中一台设备仅具有输入功能而没有输出显示功能,而另一台设备具有输出/显示功能时,将要求用户在具有输入能力的设备上输入6位数字,如显示在显示屏上的功能设备。

  • Out-of-Band - Where devices exchange pairing information over a different channel (other than Bluetooth) example NFC or some other secure mechanism. 带外-设备通过不同的通道(蓝牙除外)交换配对信息的地方,例如NFC或其他某种安全机制。

You can either sniff the Bluetooth traffic or take a log to figure out which technique is being used. 您可以嗅探蓝牙流量,也可以记录日志以了解正在使用的技术。 On a Nexus-S $adb shell hcidump -XVt will show you the log. 在Nexus-S $ adb外壳上,hcidump -XVt将显示日志。 If I/O capabiltiies are being exchanged than its Bluetooth 2.1 pairing. 如果要交换I / O功能,请选择其蓝牙2.1配对。

Another option is to enable bluetoothd log in init.herring.rc file and you can figure out which pairing method is used. 另一个选项是在init.herring.rc文件中启用蓝牙登录,您可以确定使用哪种配对方法。

Its most definitely Bluetooth 2.1 pairing in your case and the problem is elsewhere. 在您的情况下,它绝对是蓝牙2.1配对的,问题出在其他地方。

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

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