Appearance
获取当前连接的设备
方法名
getConnectedDevice
用法
- 用法如下:js
module.getConnectedDevice({ //成功返回函数 success: (res) => { console.log(res); }, //失败返回函数 fail: (res) => { console.log(res) }, //接口调用完成返回函数,不管成功还是失败都会返回 complete: (res) => { console.log(res) } })jsmodule.getConnectedDevice({ //成功执行的函数 success: (res) => { console.log(res) }, //失败执行的函数 fail: (res) => { console.log(res) }, //接口调用完成返回函数,不管成功还是失败都会返回 complete: (res) => { console.log(res) } }) - 参数说明
参数名 参数类型 是否必填 默认值 参数描述 success Function 否 无 执行成功的函数 fail Function 否 无 执行失败的函数 complete Function 否 无 执行完成的函数,不管成功还是失败都会执行
回调
- 示例json
{ "data": { "result": { "name": "HONOR 200 Pro", "address": "94:F6:F2:39:1C:28", "bondState": 12 } }, "message": "", "code": 0 } - 回调说明:
参数名 参数类型 参数描述 message String 消息提示 data Object 数据对象 data.result Object 连接的设备对象 data.result.name String 设备名称 data.result.address String 设备地址 data.result.bondState Integer 绑定状态,10:未配对,11:正在配对,12:已配对 code Integer 返回类型,0.成功,其他:失败
