wx.getConnectedBluetoothDevices,根据 uuid 获取处于已连接状态的设备
2017-12-11
导读:基础库 1.1.0 开始支持,低版本需做 兼容处理 根据 uuid 获取处于已连接状态的设备 OBJECT参数说明: 参数 类型 必填 说明 services Array 是 蓝牙设备主 service 的 uuid 列表 success Function 是 成...
基础库 1.1.0 开始支持,低版本需做兼容处理
根据 uuid 获取处于已连接状态的设备
OBJECT参数说明:
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
services | Array | 是 | 蓝牙设备主 service 的 uuid 列表 |
success | Function | 是 | 成功则返回本机蓝牙适配器状态 |
fail | Function | 否 | 接口调用失败的回调函数 |
complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
success返回参数:
参数 | 类型 | 说明 |
---|---|---|
devices | Array | 搜索到的设备列表 |
errMsg | String | 成功:ok,错误:详细信息 |
device对象
蓝牙设备信息
参数 | 类型 | 说明 |
---|---|---|
name | String | 蓝牙设备名称,某些设备可能没有 |
deviceId | String | 用于区分设备的 id |
示例代码:
wx.getConnectedBluetoothDevices({
success: function (res) {
console.log(res)
}
})
第二部分:如何开通一个小商店