我尝试通过将外围设备 ID 传递给连接方法来直接连接蓝牙设备。但几秒钟后它会自动断开连接并捕获块执行并显示连接错误。
connect(){
BleManager.connect('58:85:e9:5f:5f:82')
.then(() => {
// Success code
console.log('Connected');
})
.catch((error) => {
// Failure code
console.log(error);
});
}
我提到了这个链接: https ://github.com/innoveit/react-native-ble-manager