微信蓝牙小程序无法打开notify
发布于 7 年前 作者 zhangxiuying 9939 次浏览 来自 问答

我的蓝牙设备在原生安卓上都正常运行,在微信小程序上打开通知一直提示10007,然后看了下特征值属性,都为false,是我代码问题还是设备问题还是微信小程序暂不支持?

5 回复

我也遇到了此问题,请问楼主最终如何解决的,或是有了什么新的发现,求告知分享

notify应该连接FF02

wx.createBLEConnection({
      // deviceId: "EF801388-1005-3F51-485D-4061AE28C2E5",
      deviceId: "D8:B0:4C:EA:F6:3A",
      success: function(res) {
        wx.getBLEDeviceServices({
          // deviceId: "EF801388-1005-3F51-485D-4061AE28C2E5",
          deviceId: "D8:B0:4C:EA:F6:3A",
          //搜索设备获得的蓝牙设备 id
          success: function(res) {
            let service_id = "0003CDD0-0000-1000-8000-00805F9B0131";
            wx.getBLEDeviceCharacteristics({
              // deviceId: "EF801388-1005-3F51-485D-4061AE28C2E5",
              deviceId: "D8:B0:4C:EA:F6:3A",
              serviceId: '0003CDD0-0000-1000-8000-00805F9B0131',
              success: function(res) {
                setTimeout(function() {
                  wx.notifyBLECharacteristicValueChange({
                    // deviceId: "EF801388-1005-3F51-485D-4061AE28C2E5",
                    deviceId: "D8:B0:4C:EA:F6:3A",
                    serviceId: '0003CDD0-0000-1000-8000-00805F9B0131',
                    characteristicId: '0000ff01-0000-1000-8000-00805f9b34fb',
                    state: true,
                    success: function(res) {
                      console.error("开启通知", res)
                      wx.onBLECharacteristicValueChange(function(res) {
 
                      })
 
                    fail(res) {
                      console.error("开启通知失败")
                    },
                  })
                }, 250)
              },
            })
          },
          fail(res) {
            console.log(res.errMsg);
          },
        })
      },
      }
    })

这个问题解决了吗  我也想问是什么原因啊  我的特征值的write都是false  是设备问题还是代码问题啊

回到顶部