wx.startBluetoothDevicesDiscovery(Object object)
开始搜寻附近的蓝牙外围设备。此操作比较耗费系统资源,请在搜索并连接到设备后调用 wx.stopBluetoothDevicesDiscovery 方法停止搜索。
参数Object
错误
示例代码
// 以微信硬件平台的蓝牙智能灯为例,主服务的 UUID 是 FEE7。传入这个参数,只搜索主服务 UUID 为 FEE7 的设备
wx.startBluetoothDevicesDiscovery({
services: ['FEE7'],
success(res) {
console.log(res)
}
})
wx.stopBluetoothDevicesDiscovery(Object object)
停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时,建议调用该接口停止蓝牙搜索。
**参数Object **
错误
示例代码
wx.stopBluetoothDevicesDiscovery({
success(res) {
console.log(res)
}
})
wx.openBluetoothAdapter(Object object)
初始化蓝牙模块
**参数Object **