蓝牙已经连接成功,写入数据也是成功,uni.notifyBLECharacteristicValueChange也开启成功,蓝牙 uni.onBLECharacteristicValueChange 没有回调
const notifyRes = await notifyBlueDevice(this.localDevice.deviceId,this.localDevice.serviceId,this.localDevice.characteristicList)
if(notifyRes.code==0){
setTimeout(async ()=>{
const send = await sendTextBluetooth(this.localDevice.deviceId,this.localDevice.serviceId,this.localDevice.characteristicList,'555555394142436162630A0000000000000001000000000000000001')
console.log('send-------', send)
if(send.code == 0) {
console.log('提交成功---------')
setTimeout(async ()=>{
console.log('1s后监听数据-------------------------')
const value = await bleCharacteristicValueChange()
console.log('value------', value)
},1000)
} else {
console.error('特征值改变通知启用失败');
}
},500)
} else {
uni.showToast({
title: send.errMsg,
icon: 'none',
duration: 2000
});
}