谁知道小程序蓝牙功能怎么区分设备??

发布于 7 年前作者 yan0712203 次浏览最后编辑 7 年前来自 ask

var that = this;

wx.openBluetoothAdapter({

success: function (res) {

// success

console.log(“初始化成功”)

console.log(res);

wx.startBluetoothDevicesDiscovery({

success: function (res) {

console.log(“搜索成功”)

console.log(res);

var index = 0

// var interval = setInterval(function() {

wx.getBluetoothDevices({

success: function (res) {

console.log(“get成功”);

console.log(res);

var devices = res.devices

},

fail: function (res) {

console.log(“get失败”);

console.log(res)

},

complete: function () {

index++

if (index == 5) {

clearInterval(interval)

}

}

})

// }, 1000)

},

fail: function (res) {

console.log(“搜索失败”)

console.log(res);

},

})

},

fail: function (res) {

console.log(“初始化失败”)

console.log(res);

wx.showToast({

title: ‘没有打开蓝牙’,

})

},

})

怎么获取到的全是未知设备 我在网上看了一些例子不是这样的啊  是不是我哪里写的不对?

3 回复
yong66
yong661 楼6 年前

如果是以学习为目的的话

  1. 可以在网上买一些蓝牙开发板,学一下嵌入式开发,将其作为一个低功耗蓝牙的测试设备;

  2. 可以在安卓或 iOS 平台上开发一个蓝牙广播 App,两个系统都有提供类似的低功耗蓝牙广播 API。

shaofang
shaofang2 楼6 年前

大佬 小程序中蓝牙信号这么判断强弱的呢?(RSSI)

jun30
jun303 楼5 年前

你想要蓝牙有name或者localname那你就去找硬件开发