# startBluetoothDiscovery ^7.6
开始扫描附近蓝牙设备
# 请求参数
- 参数描述
Prop | Type | Comment |
---|---|---|
name | String | midea//选填 |
mac | String | "xxxxxx",//选填(ios是uuid) |
duration | Number | number //持续时间, 单位:秒 |
# 接口调用示例
this.$bridge
.startBluetoothDiscovery(params)
.then(res => {
this.$alert(res)
})
.catch(err => {
this.$toast(err)
})
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# 返回参数
- 当扫描到的蓝牙设备(蓝牙信息)时,APP通知插件结果
- 扫描期间会多次通知,每发现一个记录通知一次
# 返回示例
receiveMessageFromApp({messageType:"bluetoothScanResult",
messageBody:{name:"xxx", mac:"xx"//选填,scanRecords://广播包和响应包组合的16进制字符串,rssi:设备信号强度值
}})
Callback:result{
errorCode:0//启动扫描成功 1、启动扫描频率太高、2、启动扫描失败、3、蓝牙未开启
errorMsg:"错误描述"
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11