如何解决BLE 应用程序无法通过 device.connectGatt 连接到配对设备
我制作了一个安卓应用程序,它可以连接到 BLE 设备并读取特征并获得通知。该应用程序适用于我直接从该应用程序连接的 BLE 设备。但是,当我尝试连接到已与手机蓝牙配对的设备时,出现以下错误:
2021-01-13 11:00:21.792 11478-11478/com.example.wbdmx I/BluetoothDevice: connectGatt
2021-01-13 11:00:21.793 11478-11478/com.example.wbdmx D/BluetoothGatt: connect() - device: 00:13:01:10:BB:31,auto: false
2021-01-13 11:00:21.793 11478-11478/com.example.wbdmx D/BluetoothGatt: registerApp()
2021-01-13 11:00:21.793 11478-11478/com.example.wbdmx D/BluetoothGatt: registerApp() - UUID=a48bfab1-2223-452a-b804-d988600dfbb3
2021-01-13 11:00:21.796 11478-11531/com.example.wbdmx D/OpenGLRenderer: HWUI Binary is enabled
2021-01-13 11:00:21.796 11478-11531/com.example.wbdmx D/OpenGLRenderer: disableOutlineDraw is true
2021-01-13 11:00:21.797 11478-11497/com.example.wbdmx D/BluetoothGatt: onClientRegistered() - status=0 clientIf=7
2021-01-13 11:00:21.821 11478-11478/com.example.wbdmx W/InputMethodManager: startInputReason = 1
2021-01-13 11:00:21.825 11478-11531/com.example.wbdmx D/OpenGLRenderer: HWUI Binary is enabled
2021-01-13 11:00:21.825 11478-11531/com.example.wbdmx D/OpenGLRenderer: disableOutlineDraw is true
2021-01-13 11:00:21.840 11478-11624/com.example.wbdmx D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=7 device=00:13:01:10:BB:31
2021-01-13 11:00:21.840 11478-11624/com.example.wbdmx W/onConnectionStateChange: state133
2021-01-13 11:00:22.006 11478-11531/com.example.wbdmx W/libEGL: EGLNativeWindowType 0x7a17374010 disconnect failed
2021-01-13 11:00:22.013 11478-11478/com.example.wbdmx D/ViewRootImpl[MainActivity]: surface should not be released
2021-01-13 11:00:23.400 11478-11478/com.example.wbdmx D/AwareBitmapCacher: handleInit switch not opened pid=11478
2021-01-13 11:00:23.679 11478-11531/com.example.wbdmx W/libEGL: EGLNativeWindowType 0x7a04679010 disconnect failed
即使我在我的应用程序上扫描后发现了配对的设备,我也无法连接到它的 Gatt。 要详细了解我如何连接设备,您可以查看代码 here。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。