简体   繁体   English

BLE <-> Android、iOS 设备通信是否需要绑定?

[英]Is Bonding required for BLE <-> Android, iOS device communication?

We have a BLE device and android/ios app for communication with the device.我们有一个 BLE 设备和 android/ios 应用程序用于与设备通信。

The requirement is to have an android/ios app connect to the device without any pairing request.要求是在没有任何配对请求的情况下将 android/ios 应用程序连接到设备。 No security is required on the device.设备上不需要安全性。

Hereafter a few questions around this:以下围绕这个问题提出几个问题:

  • Q1. Q1。 Is it possible at all to have an android/ios app connect to a BLE device without a pairing request?是否有可能在没有配对请求的情况下将 android/ios 应用程序连接到 BLE 设备?
  • Q2. Q2。 Does the bonding required for the BLE communication? BLE 通信是否需要绑定?
  • Q3. Q3。 What is the downside of having the device with no bonding?没有绑定的设备有什么缺点? Is it going to drop the connection while the app is running?应用程序运行时是否会断开连接?
  • Q4. Q4。 Who is the initiator or pairing dialog, the app, or the device?谁是发起者或配对对话、应用程序或设备?
  • Q5. Q5。 When having the device with Just Works security protocol, with no bonding and no MITM protection, should we see a pairing dialog?当设备具有 Just Works 安全协议、没有绑定和 MITM 保护时,我们应该看到配对对话框吗?

Please see answers to your questions below:-请在下面查看您的问题的答案:-

  • A1. A1。 Yes it is possible to do this because pairing and connection are two separate actions.是的,可以这样做,因为配对和连接是两个独立的操作。 Connection is when you establish a communication channel with a remote device, while pairing is when you exchange security keys with the device and have the option of encrypting that connection.连接是您与远程设备建立通信通道,而配对是您与设备交换安全密钥并可以选择加密该连接。
  • A2. A2。 No, pairing/bonding is not required for BLE communication but it is preferred in order to have extra features and extra security on that connection.不,BLE 通信不需要配对/绑定,但它是首选,以便在该连接上具有额外的功能和额外的安全性。
  • A3. A3。 No, having no bonding does not affect the stability of your connection/communication.不,没有绑定不会影响您的连接/通信的稳定性。 There are a few downsides which include less security on the connection and also potential inability to find the device if privacy is implemented.有一些缺点,包括连接的安全性较低,如果实施隐私,也可能无法找到设备。 More details are provided in the link below.下面的链接中提供了更多详细信息。
  • A4. A4。 The app is the initiator of the pairing dialog.该应用程序是配对对话框的发起者。 Specifically, the central device (the one that initiates the connection) is the one that is responsible for initiating pairing.具体来说,中央设备(发起连接的设备)是负责发起配对的设备。 When this central device requests to pair to the remote device, the pairing dialog is shown.当此中央设备请求与远程设备配对时,将显示配对对话框。
  • A5. A5。 I believe this is dependent on the OS type (Android/iOS) and the version number of that OS, but generally speaking the pairing dialog should not pop up because as the name suggests, it should just work.我相信这取决于操作系统类型(Android/iOS)和该操作系统的版本号,但一般来说,配对对话框不应该弹出,因为顾名思义,它应该可以正常工作。 Pairing dialog pops up when MITM protection is requested.请求 MITM 保护时会弹出配对对话框。

You can find more details about pairing/bonding and general BLE communication is the answer below:-您可以找到有关配对/绑定和一般 BLE 通信的更多详细信息,答案如下:-

Should one create a bond with a Bluetooth LE device 是否应该与蓝牙 LE 设备建立联系

I would also recommend trying the nRF Connect app on both iOS and Android to see the difference between connection and bonding and to verify that you can have normal connections without pairing.我还建议在 iOS 和 Android 上尝试nRF Connect应用程序,以查看连接和绑定之间的区别,并验证无需配对即可正常连接。

Based on what we got working and based on the answers to this question.基于我们所做的工作以及对这个问题的回答。

  • A1 : Yes, it's possible if no MITM is set and the Security scheme is set to Just Works, which means no security at all. A1 : 是的,如果没有设置 MITM 并且安全方案设置为 Just Works,这是可能的,这意味着根本没有安全性。
  • A2 : Bonding is not required for BLE communication. A2 : BLE 通信不需要绑定。 If the BLE device can't store the Bond information, it may lead to some issues as we got in our case.如果 BLE 设备无法存储 Bond 信息,则可能会导致我们遇到的一些问题。 If the BLE device is able to store and use Bond information then it's recommended to Bond.如果 BLE 设备能够存储和使用 Bond 信息,那么建议使用 Bond。
  • A3 : The Connection will not be closed. A3 : 连接不会关闭。 The only downside we got is that now it takes a little more time to reconnect.我们得到的唯一缺点是现在重新连接需要更多时间。
  • A4 : The app is initiating the connection, but the dialog is shown only if the BLE device requests some type of security, it can be MITM, encryption, pin. A4 : 应用程序正在启动连接,但仅当 BLE 设备请求某种类型的安全性时才会显示对话框,它可以是 MITM、加密、pin。 Short answer, the pairing dialog can be avoided by changing the settings on the BLE device.简短的回答,可以通过更改 BLE 设备上的设置来避免配对对话框。
  • A5 : When having the device with Just Works security protocol, with no bonding and no MITM protection the pairing dialog should not be presented. A5 :当设备具有 Just Works 安全协议、没有绑定和 MITM 保护时,不应显示配对对话框。 We got no pairing dialog experience on both iOS and Android.我们在 iOS 和 Android 上都没有配对对话经验。

To add to Youssif's answer:添加到优素福的答案:

A3: one difference is that connection setup will be faster since bonding allows the GATT db cache to be used. A3:一个区别是连接设置会更快,因为绑定允许使用 GATT db 缓存。 Otherwise service rediscovery must be done on every connection (if the service changed characteristic is present).否则,必须在每个连接上进行服务重新发现(如果存在服务更改特征)。

A4: on Android you can call createBond to start pairing, but on iOS there is no API for the security, so either you need to interact with a characteristic that sends an error that pairing is needed, or the remote device can send a Security Request to initiate pairing. A4:在 Android 上,您可以调用createBond开始配对,但在 iOS 上没有 API 用于安全性,因此您需要与可以发送错误请求的远程设备交互,或者需要配对安全性,开始配对。

A5: iOS shows a dialog "accept / abort" for just works, Android doesn't. A5:iOS 显示一个对话框“接受/中止”,以便正常工作,Android 没有。

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

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