楼主解决了吗?我的也是。自己测试没问题。上线后自己手机使用也没问题,但别人就是用不了,愁死我了。我用的云开发
小程序预上线后,只有自己可以访问吗,其他用户的请求发送不到后台?[图片][图片]
2021-07-20同,只能监听到,我想获取到发送来的值进行判断,但获取不到,大佬最终如何解决这个问题的
利用wx.onBLECharacteristicValueChange监听的值来做应答但是只能接收?/*蓝牙升级通讯协议(小程序与单片机的应答) ------------------------------------------------------------------------------------------------------------------ * 五、开始下载后小程序自动重复发送每一组数据,直到收到单片机应答信息后,开始连续下载; * 六、单片机每收到一组数据,计算校验和,如果正确则应答接收正确,否则应答接收错误; * 七、接收正确应答:2B 4F 4B CF 75 * 八、接收错误应答:2D 45 52 52 00 A4 * 九、全部下载结束后停止 ------------------------------------------------------------------------------------------------------------------ [图片] 就是我这边只能监听变化的值,却不能通过获取硬件发送过来这个值进行发送,求大佬们怎么解决这是我的部分代码 wx.onBLECharacteristicValueChange(function (res) { console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`, 99999999999999999999) console.log(ab2hex(res.value)) // ArrayBuffer转16进制字符串 console.log(res.value) that.setData({ valueChange: valueChangeData + "|" + ab2hex(res.value), //前端显示蓝牙接收数据 }) valueChangeData = valueChangeData + '|' + ab2hex(res.value); console.log("valueChangeData", valueChangeData) var a = []; a.push(valueChangeData) console.log(a, "A") var b = (a.toString()).split('|') console.log(b) valueChangeDataArray = b//定义的全局变量 // that.testSend1() // that.writePackageData1() var success = [43, 79, 75, 207, 117]; var successArrayBuffer = new Uint8Array(success).buffer; console.log(successArrayBuffer) var fail = [45, 45, 52, 52, 0, 164] var failArrayBuffer = new Uint8Array(fail).buffer; console.log(failArrayBuffer) if (ab2hex(res.value) == ab2hex(successArrayBuffer)) { console.log("接收正确应答") // that.testSend1() //that.package20Write() } else if (ab2hex(res.value) == ab2hex(failArrayBuffer)) { console.log("接收错误应答,重新回调") // that.testSend2() } }) }, testSend1() { this.writeRealData1(deviceIdConnected, serviceIdConnected, characteristicsIdConnected, sendFile) }, writeRealData1(deviceId, serviceId, characteristicId, packageData) { const arrays = packageData; console.log(arrays, "所有的1k") var valueChange = valueChangeDataArray; //监听的数组 var index; if (valueChange instanceof Array) { valueChange.splice(0, 1); if (valueChange.length % 57 == 0) { index = valueChange.length / 57 } else { index = parseInt(valueChange.length / 57) } } else if (valueChange == undefined) { index = 0 } console.log(valueChange) console.log(index, "长度") var success = "2b4f4bcf75" //监听成功的值 var fail = "2d4552520a4" //监听失败的值 const data = arrays[index] || null, self = this console.log("第", index, "包数据", data) self.writePackageData1(deviceId, serviceId, characteristicId, data) }, writePackageData1(deviceId, serviceId, characteristicId, Data) { /** hex2int(hex)字符串转16进制 */ /**concatenate(resultConstructor, ...arrays)合并arraybuffer */ /////////////////校检和 ////////////////////// function CRC(array) { var len = array.length, sum = 0; for (let i = 0; i < len; i++) { sum += array[i] } return sum.toString(16) } /////////////////////// //////////////////////// var valueChange = valueChangeDataArray; //监听的数组 console.log(valueChange) var valueChangeleng; if (valueChange instanceof Array) { valueChange.splice(0, 1); valueChangeleng = valueChange.length - parseInt(valueChange.length / 57) * 57 } else if (valueChange == undefined) { valueChangeleng = 0 } const array = Data; console.log(array, "array") var arr = [] for (let i = 0; i < array.byteLength; i += 18) { arr.push(array.slice(i, i + 18)) } var uintBuffer = new Uint8Array(arr[valueChangeleng]) console.log("uintBuffer", uintBuffer) var uintBuffers = concatenate(Uint8Array, Uint8Array.of(valueChangeleng), uintBuffer) console.log("uintBuffers", uintBuffers) var array1 = Array.from(uintBuffers) //console.log(CRC.ToCRC16(array1),"校检和") console.log(CRC(array1), "校检和") array1.push(hex2int(CRC(array1).slice(1, 3))) var arrayBuffer = new Uint8Array(array1).buffer; console.log("arrayBuffer", arrayBuffer) const data = arrayBuffer || null, self = this console.log("第", valueChangeleng, "次", "发送的数据为", data) var success = "2b4f4bcf75" //监听成功的值 var fail = "2d4552520a4" //监听失败的值 if (valueChangeleng == 0) { wx.writeBLECharacteristicValue({ deviceId, serviceId, characteristicId, value: data, success: function () { console.log("我是第一个数据包") } }) } else if (data && data instanceof ArrayBuffer && valueChange[valueChangeleng] == success) { wx.writeBLECharacteristicValue({ deviceId, serviceId, characteristicId, value: data, success: function () { console.log("success,成功") if (valueChangeleng < arr.length) { sleep(20) self.writePackageData1(deviceId, serviceId, characteristicId, Data) } } }) } else if (data && data instanceof ArrayBuffer && valueChange[valueChangeleng] == fail) { wx.writeBLECharacteristicValue({ deviceId, serviceId, characteristicId, value: data, success: function () { console.log("fail,失败") self.writePackageData1(deviceId, serviceId, characteristicId, Data, valueChangeleng - 1) } }) } },
2021-07-09已解决,切换成卫星地图后就可以了。而我恰好需要用卫星地图
地图plygons覆盖问题?怎么做到地图上的polygons覆盖下面的地图呢?即使把透明弄到100%也还是不行,想把下面的地名啥的覆盖掉 [图片]
2021-06-30老哥可以发一份这个功能的源码吗?我也想做这个类似的功能,一直不知道怎么下笔3233456044@qq.com
微信小程序map组件中的动态markers问题在项目中需要实现像摩拜单车一样的地图效果,markers就需要动态的从后台请求接口然后添加。动态的添加伞的markers的时候能够成功,但是在动态的添加地图中心点的标记的时候push方法一直报错,求大神指点 [图片] [图片] [图片] [图片]
2021-05-25