BlueUtils icon indicating copy to clipboard operation
BlueUtils copied to clipboard

搜索设备慢,而且有些设备搜索不出来

Open Achenglove opened this issue 5 years ago • 3 comments

Achenglove avatar Feb 13 '19 02:02 Achenglove

hi,你可以通过 监听 蓝牙的搜索广播 来排查问题。 [image: image.png] 现在搜索经典蓝牙设备之后还会搜索ble 蓝牙设备。你可以将其分开哦。 目前手上没有蓝牙设备哦,而且已经好久没看过这方面了。希望能帮到你😀

Acheng [email protected] 于2019年2月13日周三 上午10:36写道:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/moruoyiming/BlueUtils/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AKcqbex5EHKuKjDbIaRwrKR9PUIRfi5tks5vM3oQgaJpZM4a4eND .

moruoyiming avatar Feb 13 '19 03:02 moruoyiming

搜索出来的设备也连接不上,一直是连接失败

Achenglove avatar Feb 13 '19 03:02 Achenglove

这个是因为uuid 没有匹配上。连接蓝牙设备是需要知道蓝牙设备的通用唯一标识符,需调用 createRfcommSocketToServiceRecord(UUID)获取到BluetoothSocket,此处的UUID 必须与服务器端一致,调用connect()进行连接。 [image: image.png] 建议参考 其他比较成熟的开源 项目 。https://github.com/Jasonchenlijian/FastBle , https://github.com/xiaoyaoyou1212/BLE

Acheng [email protected] 于2019年2月13日周三 上午11:50写道:

搜索出来的设备也连接不上,一直是连接失败

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/moruoyiming/BlueUtils/issues/3#issuecomment-463046524, or mute the thread https://github.com/notifications/unsubscribe-auth/AKcqbZ6EZfJ8rDExqV4BWiKpOdJTgRJZks5vM4uIgaJpZM4a4eND .

moruoyiming avatar Feb 13 '19 04:02 moruoyiming