# qa.getConnectedBluetoothDevices(Object object)

根据 uuid 获取处于已连接状态的设备。

# 参数

# Object object

属性 类型
默认值
必填
说明
services Array.<string> 蓝牙设备主 service 的 uuid 列表
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数
complete function 接口调用结束的回调函数(调用成功、失败都会执行)

# object.success 回调函数

# 参数
# Object res
属性 类型 说明
devices Array.<Object> 搜索到的设备列表

res.devices 的结构

属性 类型 说明
name string 蓝牙设备名称,某些设备可能没有
deviceId string 用于区分设备的 id

# 错误

错误码 错误信息 说明
0 ok 正常
10000 not init 未初始化蓝牙适配器
10001 not available 当前蓝牙适配器不可用
10002 no device 没有找到指定设备
10003 connection fail 连接失败
10004 no service 没有找到指定服务
10005 no characteristic 没有找到指定特征值
10006 no connection 当前连接已断开
10007 property not support 当前特征值不支持此操作
10008 system error 其余所有系统上报的异常
10009 system not support 系统不支持
10012 operate time out 连接超时
10013 invalid_data 连接 deviceId 为空或者是格式不正确

# 示例代码

qa.getConnectedBluetoothDevices({
  success(res) {
    console.log(res)
  }
})
1
2
3
4
5

在线客服