//开始启动notify
let deviceId = that.iBluetooth.deviceId;
let serviceId = that.iBluetooth.serviceId;
let characteristicId = that.iBluetooth.characteristicId;
uni.notifyBLECharacteristicValueChange({
state: true, // 启用 notify 功能
deviceId,
serviceId,
characteristicId,
success: res => {
console.log('notify-succ:' + JSON.stringify(res));
that.iGlobal.uploadlog('notify-succ'+JSON.stringify(res))
uni.onBLECharacteristicValueChange((res2) => {
console.log('value-succ:' + JSON.stringify(res2));
that.iGlobal.uploadlog('value-succ'+JSON.stringify(res2))
});
},
fail: err => {
console.log('notify-failed:' + JSON.stringify(err));
that.iGlobal.uploadlog('notify-failed'+JSON.stringify(err))
}
});
GTaylor (作者)
嗯。有两个问题。
一个是写入失败,一个是接收成功,但是没有数据。
2021-07-05 20:33
DCloud_iOS_WZT
回复 GTaylor: 接收是写入成功? 还是手机读数据成功
2021-07-05 20:46