简体   繁体   English

Android物联网与BLE

[英]Android things pairing with BLE

I have a raspi3 with android things on it and I want to connect to a BLE device that requires a user authentication for bounding. 我上面装有android东西的raspi3,我想连接到需要用户身份验证才能绑定的BLE设备。

On a phone, after having set a characteristic on the BLE device, I am able to receive the Broadcast event 在电话上,在BLE设备上设置了特征后,我可以接收广播事件

BluetoothDevice.ACTION_PAIRING_REQUEST

and in the meantime a dialog from android system opens asking me to accept the bluetooth connection (it has pairing variant = 3 (PAIRING_VARIANT_CONSENT)). 并且与此同时,来自android系统的对话框打开,要求我接受蓝牙连接(其配对变量= 3(PAIRING_VARIANT_CONSENT))。 When I accept it on the dialog everything goes nice and I connect to the device. 当我在对话框上接受它时,一切都很好,然后我连接到设备。

In my android things device I don't receive any ACTION_PAIRING_REQUEST event and my connection drops as soon as I write the characteristic on the BLE device. 在我的android事物设备中,我没有收到任何ACTION_PAIRING_REQUEST事件,并且在BLE设备上写入特征后,连接就断开了。 Is there any way to have the accept process on android things? 有什么办法可以让Android事物接受流程吗?

You can use the Android Things BluetoothConnectionManager to initiate device pairing or respond to incoming pairing requests with a BluetoothPairingCallback . 您可以使用Android Things BluetoothConnectionManager初始化设备配对或通过BluetoothPairingCallback响应传入的配对请求。 See the Bluetooth API guide for more details on device pairing. 有关设备配对的更多详细信息,请参见Bluetooth API指南

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

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