- ios蓝牙接口无法获取advertisData,安卓可以获取到
- 当前 Bug 的表现(可附上截图) 这是API返回的数据 [图片] 在ios下打印出来的数据,连advertisData没有都没有返回 [图片] 在安卓下是可以打印出advertisData [图片] 想问一下,为什么回调函数在ios跟安卓两端表现不一致 - 预期表现 - 复现路径 - 提供一个最简复现 Demo
2019-06-23 - 小程序蓝牙advertisData获取不到前半部分数据
就是最简单的wx.getBluetoothDevices里返回的advertisData,只能获取蓝牙发送的后半部分数据,前半部分的数据获取不到,而且serviceData获取不到。
2018-04-08 - 小程序蓝牙接收监听数据丢失
使用小程序蓝牙notifyBLECharacteristicValueChange方法接收数据,数据不完整,每次请求接收的数据都不同(设备上存储的是同一份数据),中间可能会少几组数据,并且接收的速度很慢 [图片]
2019-04-27 - 小程序获取蓝牙的实时广播数据
最经开发小程序+蓝牙,需要获取蓝牙设备的广播数据,设备是没100ms发送一次广播,调用蓝牙组件接口,正常情况下每次500ms搜索一次列表,获取设备的广播数据应该是不一样的,但是多次请求都会返回相同的数据。是不是该方法自带有缓存,导致数据返回结果相同?在网上找了好久,都没有解决方案。怎么解决这个BUG? wx.stopBluetoothDevicesDiscovery(OBJECT)wx.getBluetoothDevices(OBJECT)wx.stopBluetoothDevicesDiscovery(OBJECT) [图片]
2018-08-24 - 安卓手机上onBLECharacteristicValueChange不能触发
- 当前 Bug 的表现(可附上截图) 在Android手机上,成功调用wx.notifyBLECharacteristicValueChange后,调用wx.writeBLECharacteristicValue不能触发wx.onBLECharacteristicValueChange设置的回调函数,但在iOS手机上能够触发回调函数。 - 预期表现 回调函数被触发 - 复现路径 调试环境:小米6 Pro,Android 8.1.0,微信6.7.3 第一步,定义回调方法: const onBleCharRead = res => { ... } 第二步,调用wx.onBLECharacteristicValueChange(onBleCharRead)设置回调监听 第三步,调用wx.notifyBLECharacteristicValueChange方法启用指定characteristic的notify功能(提示成功) 第四步,调用wx.readBLECharacteristicValue方法读取另外一个characteristic的数据(此时onBleCharRead回调被触发) 第五步,调用wx.writeBLECharacteristicValue方法向指定的characteristic些数据(数据长度20字节) 进行第五步时onBleCharRead一直不会被触发,尝试过在write之前延迟一段时间(最长1s),但仍然不能解决问题。 相关日志如下: [图片]
2018-12-22 - wx.onBLECharacteristicValueChange 在安卓无回调
help,wx.onBLECharacteristicValueChange 在android上无法接受返回值,notify开启是成功的,有趣的是在iOS下面一切正常,问了好多人,又说开启notify之后立即就调用了write会发生问题,尝试了延迟和重发依旧没有任何返回值,下图是测试返回的结果 ···························································································································· [图片] 上图是在ios设备的截图,能接收到返回值 ·································································································· [图片] 这实在android设备的,没有返回值 ··································································································· - 求问技术支持,这问题该如何解决,是否有解决方案,下面贴出我的代码,帮忙看看是不是我写的有问题 [代码]Page({[代码] [代码] [代码][代码]/** 页面的初始数据 */[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]deviceId: [代码][代码]'FD:76:74:35:99:92'[代码][代码],[代码][代码] [代码][代码]serviceId: [代码][代码]''[代码][代码],[代码][代码] [代码][代码]services: [],[代码][代码] [代码][代码]writeCharacteristicsId: [代码][代码]""[代码][代码], [代码][代码]// 可写特征值uuid[代码][代码] [代码][代码]readCharacteristicsId: [代码][代码]""[代码][代码], [代码][代码]// 可读特征值uuid[代码][代码] [代码][代码]notifyCharacteristicsId: [代码][代码]""[代码][代码], [代码][代码]// 通知特征值uuid[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]/** 生命周期函数--监听页面加载 */[代码][代码] [代码][代码]onLoad: [代码][代码]function[代码] [代码](opt) {[代码][代码] [代码][代码]//初始化蓝牙适配器[代码][代码] [代码][代码]wx.openBluetoothAdapter({[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]"初始化蓝牙适配器成功"[代码][代码], res);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码](err) {[代码][代码] [代码][代码]console.log([代码][代码]"初始化失败"[代码][代码], err)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码] [代码] [代码][代码]//监听蓝牙适配器状态变化事件[代码][代码] [代码][代码]wx.onBluetoothAdapterStateChange(res => {[代码][代码] [代码][代码]console.log([代码][代码]"状态变化"[代码][代码], res)[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]start: [代码][代码]function[代码][代码]() {[代码][代码] [代码][代码]let that = [代码][代码]this[代码][代码];[代码] [代码] [代码][代码]console.log([代码][代码]'监听设备的连接状态'[代码][代码]);[代码] [代码] [代码][代码]/** 连接设备 */[代码][代码] [代码][代码]wx.createBLEConnection({[代码][代码] [代码][代码]deviceId: that.data.deviceId,[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'连接设备'[代码][代码], res);[代码] [代码] [代码][代码]/** 监听设备的连接状态 */[代码][代码] [代码][代码]wx.onBLEConnectionStateChanged([代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log(`device ${res.deviceId} state has changed, connected: ${res.connected}`)[代码][代码] [代码][代码]});[代码] [代码] [代码][代码]/** 连接成功,后开始获取设备的服务列表 */[代码][代码] [代码][代码]wx.getBLEDeviceServices({[代码][代码] [代码][代码]deviceId: that.data.deviceId,[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'device services:'[代码][代码], res);[代码] [代码] [代码][代码]that.setData({ services: res.services, serviceId: res.services[0].uuid }, () => {[代码] [代码] [代码][代码]wx.getBLEDeviceCharacteristics({[代码][代码] [代码][代码]deviceId: that.data.deviceId,[代码][代码] [代码][代码]serviceId: that.data.serviceId,[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'device getBLEDeviceCharacteristics:'[代码][代码], res.characteristics);[代码] [代码] [代码][代码]for[代码] [代码]([代码][代码]var[代码] [代码]i = 0; i < res.characteristics.length; i++) {[代码][代码] [代码][代码]if[代码] [代码](res.characteristics[i].properties.notify) {[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]notifyCharacteristicsId: res.characteristics[i].uuid[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]if[代码] [代码](res.characteristics[i].properties.write) {[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]writeCharacteristicsId: res.characteristics[i].uuid[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]if[代码] [代码](res.characteristics[i].properties.read) {[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]readCharacteristicsId: res.characteristics[i].uuid[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]/** 顺序开发设备特征notifiy */[代码][代码] [代码][代码]wx.notifyBLECharacteristicValueChanged({[代码][代码] [代码][代码]deviceId: that.data.deviceId,[代码][代码] [代码][代码]serviceId: that.data.serviceId,[代码][代码] [代码][代码]characteristicId: that.data.notifyCharacteristicsId,[代码][代码] [代码][代码]state: [代码][代码]true[代码][代码],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'notifyBLECharacteristicValueChanged success'[代码][代码], res);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码](res) { console.log([代码][代码]'notifyBLECharacteristicValueChanged fail :'[代码][代码], res) },[代码][代码] [代码][代码]complete: [代码][代码]function[代码] [代码](res) { }[代码][代码] [代码][代码]});[代码] [代码] [代码][代码]/** 回调获取 设备发过来的数据 */[代码][代码] [代码][代码]wx.onBLECharacteristicValueChange([代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'characteristic value comed:'[代码][代码], res.value);[代码][代码] [代码][代码]//{value: ArrayBuffer, deviceId: "D8:00:D2:4F:24:17", serviceId: "ba11f08c-5f14-0b0d-1080-007cbe238851-0x600000460240", characteristicId: "0000cd04-0000-1000-8000-00805f9b34fb-0x60800069fb80"}[代码] [代码] [代码][代码]let buffer = res.value[代码][代码] [代码][代码]let dataView = [代码][代码]new[代码] [代码]DataView(buffer)[代码][代码] [代码][代码]let dataResult = [][代码][代码] [代码][代码]for[代码] [代码](let i = 0; i < dataView.byteLength; i++) {[代码][代码] [代码][代码]dataResult.push(dataView.getUint8(i).toString(16))[代码][代码] [代码][代码]}[代码][代码] [代码][代码]const result = dataResult[代码][代码] [代码][代码]console.log(result);[代码][代码] [代码][代码]});[代码] [代码] [代码][代码]/** 发送开锁命令 */[代码][代码] [代码][代码]that.send();[代码] [代码] [代码][代码]}, fail: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log(res);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码] [代码] [代码][代码]});[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'失败'[代码][代码], res);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]/** 发送 数据到设备中 */[代码][代码] [代码][代码]send: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]let that = [代码][代码]this[代码][代码], hex = [代码][代码]'100031B0000018FFFFFFFF0000008900'[代码][代码];[代码][代码] [代码][代码]const typedArray = [代码][代码]new[代码] [代码]Uint8Array(hex.match(/[\da-f]{2}/gi).map([代码][代码]function[代码] [代码](h) { [代码][代码]return[代码] [代码]parseInt(h, 16) }))[代码][代码] [代码][代码]console.log(typedArray);[代码][代码] [代码][代码]const buffer1 = typedArray.buffer[代码][代码] [代码][代码]console.log(buffer1)[代码] [代码] [代码][代码]wx.writeBLECharacteristicValue({[代码][代码] [代码][代码]deviceId: that.data.deviceId,[代码][代码] [代码][代码]serviceId: that.data.serviceId,[代码][代码] [代码][代码]characteristicId: that.data.writeCharacteristicsId,[代码][代码] [代码][代码]value: buffer1,[代码] [代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]"success 指令发送成功"[代码][代码]);[代码][代码] [代码][代码]console.log(res);[代码] [代码] [代码][代码]/** 读取设备 */[代码][代码] [代码][代码]// setTimeout(() => {[代码][代码] [代码][代码]// wx.readBLECharacteristicValue({[代码][代码] [代码][代码]// deviceId: that.data.deviceId,[代码][代码] [代码][代码]// serviceId: that.data.serviceId,[代码][代码] [代码][代码]// characteristicId: that.data.readCharacteristicsId,[代码][代码] [代码][代码]// success: function (res) {[代码][代码] [代码][代码]// console.log('readBLECharacteristicValue:', res);[代码][代码] [代码][代码]// }[代码][代码] [代码][代码]// })[代码][代码] [代码][代码]// }, 3000)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码](res) { console.log(res); }[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]/** 生命周期函数--监听页面初次渲染完成 */[代码][代码] [代码][代码]onReady: [代码][代码]function[代码] [代码]() { },[代码] [代码] [代码][代码]/** 生命周期函数--监听页面显示 */[代码][代码] [代码][代码]onShow: [代码][代码]function[代码] [代码]() { },[代码] [代码] [代码][代码]/** 生命周期函数--监听页面隐藏 */[代码][代码] [代码][代码]onHide: [代码][代码]function[代码] [代码]() { },[代码] [代码] [代码][代码]/** 生命周期函数--监听页面卸载, 同时断开蓝牙 */[代码][代码] [代码][代码]onUnload: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]let me = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]wx.closeBLEConnection({[代码][代码] [代码][代码]deviceId: me.data.deviceId,[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]"蓝牙断开"[代码][代码], res)[代码][代码] [代码][代码]me.setData({ deviceId: [代码][代码]""[代码][代码], })[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码] [代码]})[代码] 在线等。
2019-01-08 - 自定义公众号菜单跳转到小程序的路径部分,参数是怎么带的,在小程序是怎么获取的
自定义公众号菜单跳转到的小程序路径部分,参数是怎么带的,在小程序是怎么获取的。。。。在线等,很急,谢谢了
2017-12-19 - 自定义公众号菜单跳转到小程序的小程序路径部分,可否传参
微信公众平台->自定义菜单->跳转小程序->小程序路径部分可否传参数给小程序
2017-07-11 - 微信公众号推送跳转至小程序指定页面
按照微信公众号模板消息API设置完 小程序APPID以及path参数之后 点击收到的推送,能打开配置的小程序,但是打开的是小程序的首页 请问公众号模板消息推送时,其小程序的path参数如何赋值 我们目前是如下方式编码,但无效 [代码] "miniprogram":{ "appid":"wxb6c4a1776384c210", "path":"pages/Discuss/DiscussInfo/DiscussInfo?DicGroupId=39" }, [代码][代码] [代码]
2018-04-03 - 微信小程序可以跳转到所关联的公众号里面吗?
- 需求的场景描述(希望解决的问题): 微信小程序跳转到关联的公众号 - 希望提供的能力: 微信小程序跳转到关联的公众号
2018-04-16