- UDPSocket.send传输比较大的图片
UDPSocket.send传输3k以内的图片可以传,如果大3k或多张图片如何传输?
2019-07-01 - wx.getBLEDeviceServices出现10004的错误码
- 当前 Bug 的表现(可附上截图) - 预期表现 - 复现路径 - 提供一个最简复现 Demo //点击连接蓝牙 connectBlueTooth: function (item) { let that = this // wx.showLoading({ // title: '连接中...' // }) console.debug("连接蓝牙", item) that.data.blueToothTtem = item // console.debug("连接蓝牙", item.currentTarget.dataset.item.deviceId) wx.createBLEConnection({ // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接 deviceId: item.deviceId, timeout: 30000, success: function (res) { console.debug('连接蓝牙成功---', res) // wx.hideLoading() that.data.times = 1 setTimeout(() => { that.getBlueToothService() }, 1500) }, fail: function (res) { app.globalData.isOrderConnect = true console.debug('连接失败', res) console.log('serviceTimes次数:', that.data.serviceTimes) if(that.data.serviceTimes < 4){ that.data.serviceTimes++ if(that.data.serviceTimes === 3){ console.log('连接失败次数') wx.showToast({ title: '连接失败', complete:function(){ that.data.isConnectedBlueTooth = false; //跳转下一个页面 setTimeout(() => { that.data.serviceTimes = 1 wx.hideToast() //跳转下一个页面 that.jumpToNextPage() }, 1000) } }) } else { //重新搜索 setTimeout(() => { console.debug('再次连接失败') that.data.serviceTimes = 1 that.searchBlueTooth() }, 2000) } } if (that.data.serviceTimes >= 4){ wx.showToast({ title: '连接失败', complete: function (){ that.data.isConnectedBlueTooth = false; //跳转下一个页面 setTimeout(() => { that.data.serviceTimes = 1 wx.hideToast() //跳转下一个页面 that.jumpToNextPage() }, 1000) } }) } } }) }, getBlueToothService: function () { var that = this; //this.data.deviceId let deviceId = that.data.blueToothTtem.deviceId wx.getBLEDeviceServices({ deviceId: deviceId, success: function (res) { console.debug('获取蓝牙设备的所有服务:', JSON.stringify(res.services)); app.globalData.services = res.services that.data.times = 1 //连接蓝牙成功 that.data.isConnectedBlueTooth = true; //跳转下一个页面 setTimeout(() => { wx.hideToast() //跳转下一个页面 that.jumpToNextPage() }, 500) }, fail: function (error) { //不成功之后的次数 console.debug('重新找服务类型:', that.data.isConnectting) if (that.data.isConnectting) { that.data.serviceTimes++ console.debug('重新找服务') if (that.data.serviceTimes < 5) { //重新找服务 if (that.data.serviceTimes === 2) { setTimeout(() => { app.globalData.deviceID = '' that.data.serviceError = true //释放资源重新来 that.closeBlueTooth() }, 1500) } else if (that.data.serviceTimes === 3) { setTimeout(() => { app.globalData.deviceID = '' that.data.serviceError = true //释放资源重新来 that.closeBlueTooth() }, 2000) } else { setTimeout(() => { app.globalData.deviceID = '' that.data.serviceError = true //释放资源重新来 that.closeBlueTooth() }, 3000) } } } else { console.debug('重新连接') that.data.serviceTimes++ if (that.data.serviceTimes < 5) { //重新连接 setTimeout(() => { that.connectBlueTooth(that.data.blueToothTtem) }, 2000) } } if (that.data.serviceTimes === 5) { console.log('服务的次数:', that.data.serviceTimes) that.data.serviceTimes = 1 that.data.times = 1 wx.showToast({ title: '连接失败', icon: 'none', complete: function () { //跳转下一个页面 setTimeout(() => { wx.hideToast() //跳转下一个页面 that.jumpToNextPage() }, 1000) } }) } console.debug('所有服务error:', error) } }) }, 手机:Redmi Note 4x ,MIUI版本:MIUI 10.2. 日志上传时间:5月15号 09:38 微信号是:OnlyOne_0451 问题描述: 第一次出现了找不到服务,然后再重新来一遍(释放蓝牙资源程序,重新连接,查找服务),连续二次还是不行,请问是什么原因
2019-05-15 - 在蓝牙发送数据过程中,蓝牙设备自动断开,请问是什么原因
- 当前 Bug 的表现(可附上截图) - 预期表现 - 复现路径 - 提供一个最简复现 Demo //开启通知-硬件返回数据 notifyBLECharacteristicValueChange() { let that = this console.debug('characteristicId', that.data.notiUUID) wx.notifyBLECharacteristicValueChange({ deviceId: that.data.blueToothItem.deviceId,//设备id that.data.deviceId serviceId: that.data.serviceId,//服务uuid characteristicId: that.data.notiUUID,//特征uuid--只读 state: true,//true表示开启Notify,false关闭 success: function (res) { console.debug('通知数据的改变---成功', res) //that.openBlueTooth() setTimeout(() => { that.toStrFun() }, 2000) that.data.isProofread = false that.data.isOpenBlueTooth = false }, fail: function (res) { console.debug('通知数据的改变--失败', res) if (that.data.isProofread){ //校对时间写入失败 if(that.data.proofreadTimes < 4){ that.data.proofreadTimes ++ setTimeout(()=>{ that.toStrFun() },1000) } if(that.data.proofreadTimes === 4){ that.data.proofreadTimes = 1 that.data.isProofread = false wx.showToast({ title: '时间校对写入失败', icon:'none' }) } } //开锁数据写入失败 if (that.data.isOpenBlueTooth){ if (that.data.proofreadTimes < 4) { that.data.proofreadTimes++ setTimeout(() => { that.openBlueTooth() }, 1000) } if (that.data.proofreadTimes === 4) { that.data.proofreadTimes = 1 that.data.isProofread = false wx.showToast({ title: '开锁写入失败', icon: 'none' }) } } } }) //硬件返回数据 //that.openlockBack() }, toStrFun: function () { let that = this let UUID = that.data.UUID let serviceId = that.data.serviceId //调用锁的各种指令 that.lockOrder() console.debug('校对时间指令:', that.data.hexStrTime) console.log('校对时间',util.hex2array(that.data.hexStrTime)) // 校准时间 wx.writeBLECharacteristicValue({ // 这里的 deviceId 需要在 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取that.data.deviceId, deviceId: that.data.blueToothItem.deviceId, // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取 serviceId: serviceId, // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取 characteristicId: UUID, // 这里的value是ArrayBuffer类型hexStrTime,hexSearch value: util.hex2array(that.data.hexStrTime), success(res) { console.debug('writeBLECharacteristicValue success kkkkk', res) that.data.isProofread = true; }, fail(error){ console.debug('搜索,连接.开锁error-------', error) wx.showToast({ title: '发送时间校准失败', icon:'none' }) } }) },[图片] 蓝牙是连接上的,在发送数据的时候,蓝牙就自动断开了,请问是怎么回事。日志在5月14号10:26分上传,手机是红米:Redmi Note 4x,MIUI版本:MIUI 10.2
2019-05-14