uni.writeBLECharacteristicValue({
deviceId: params.device_id,
serviceId: params.service_id,
characteristicId: params.characteristic_id,
value: hexStringToBuffer(params.command),// 这里的value是ArrayBuffer类型
success: (res) => {
console.log('writeBLECharacteristicValue success', res.errMsg)
typeof params.exec == "function" && params.exec(res);
},
fail: (res) => {
console.log('writeBLECharacteristicValue fail:', res)
}
})
2 个回复
雪趣snow66 (作者)
Android write成功后有回调,ios没有。是uni.writeBLECharacteristicValue的回调没有不是notify
DCloud_iOS_WZT
https://uniapp.dcloud.net.cn/api/system/ble.html#writeblecharacteristicvalue 看下注意事项 是不是写入数据过长了