- 当前 Bug 的表现(可附上截图)
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
onLoad: function (options) {
var _that = this
var deviceId = options.id
wx.getBLEDeviceServices({
deviceId: deviceId,
success(res) {
console.log(res)
//setTimeout(function(){
wx.getBLEDeviceCharacteristics({
// 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
deviceId: deviceId,
// 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
serviceId:res.services[2].uuid,
success(res55) {
console.log(‘device getBLEDeviceCharacteristics:’, res55)
wx.onBLECharacteristicValueChange(function (characteristic) {
console.log(characteristic)
var dv = new Int16Array(characteristic.value)
for (let j = 0; j < dv.length; j++) {
arr[j] = (dv[j] / 10).toFixed(1)
}
arr = common.resetArray(arr, dv1[0])
for (var z = 0; z < arr.length; z++) {
arr[z].push(dv1[0] * 128 + z)
_this.data.upPage[1].push(arr[z])
}
console.log(arr)
})
wx.readBLECharacteristicValue({
deviceId: deviceId,
serviceId: res6.services[0].uuid,
characteristicId: ‘0000FF50-0000-1000-8000-00805F9B34FB’,//此特征值的value是512字节长的16进制
success(res8) {
console.log(res8)
}
})
},
fail(res44){
console.log(res44)
},
complete(res22){
console.log(res.services[2].uuid)
console.log(res22)
}
})
}
})
},
小程序IOS能否直接读取一个长度为512字节的特征值(IOS不行,Android可以)