- wx.readBLECharacteristicValue怎么接收多个特征值ID,怎么解决?
这样写读出来的数据会被覆盖掉,怎么解决,求助! if (res.characteristics[i].properties.read) { console.log("readServicweId:", myUUID); console.log("readCharacteristicsId:", res.characteristics[i].uuid); that.setData({ characteristics:[ ...that.data.readCharacteristics, { readServicweId: myUUID, readCharacteristicsId: "CEB5555A-55E1-5555-55F5-EA0736155555", } ] }) } if (res.characteristics[i].properties.write) { console.log("writeServicweId:", myUUID); console.log("writeCharacteristicsId:", res.characteristics[i].uuid); that.setData({ writeServicweId: myUUID, //writeCharacteristicsId: res.characteristics[i].uuid, writeCharacteristicsId: "BEB5555A-55E1-5555-55F5-EA0736155555",//手动设置writeCharacteristicsId为这个UUID,为了方便写死在这里 }) }
2023-09-24 - 无法接收到onBLECharacteristicValueChange回调信息?
对接低功耗中心蓝牙设备,notifyBLECharacteristicValueChange成功,writeBLECharacteristicValue也是成功,但是无法接受设备返回数据,onBLECharacteristicValueChange lanyatest10(event){ var that = this; console.log("开始接收数据"); function ab2hex(buffer) { let hexArr = Array.prototype.map.call( new Uint8Array(buffer), function(bit) { return ('00' + bit.toString(16)).slice(-2) } ) return hexArr.join(''); } wx.onBLECharacteristicValueChange(function (res) { console.log("characteristicId:" + res.characteristicId) console.log("serviceId:" + res.serviceId) console.log("deviceId" + res.deviceId) console.log("Length:" + res.value.byteLength) console.log("hexvalue:" + ab2hex(res.value)) that.setData({ info: that.data.info + ab2hex(res.value) }) }) },
2023-07-05 - 小程序仿真不报错,真机调试报错,怎么办?
小程序真机调试报错 SystemError (appServiceSDKScriptError) Cannot read property 'getGlobalWebviewIds' of undefined TypeError: Cannot read property 'getGlobalWebviewIds' of undefined
2023-06-03 - 如何连接蓝牙?
怎么使用UUID,连接设备
2023-06-02