# startBlueScan ^6.8

开启蓝牙扫描

# 请求参数

Prop Type Default Comment
name String N/A wireless network名称
mac String N/A 云端返回,ios 扫描不到,废弃(二代蓝牙可以扫描到)
duration Number N/A 扫描持续时间

# 接口调用示例

const params = {
  duration: 12, //扫描持续时间,
  name: '',
  mac: '', //云端返回,ios 扫描不到,废弃(二代蓝牙可以扫描到)
}
this.$bridge
  .startBlueScan(params)
  .then(res => {
    this.$alert(res)
  })
  .catch(err => {
    this.$toast(err)
  })
1
2
3
4
5
6
7
8
9
10
11
12
13

# 获取接口返回结果

this.$bridge
  .addEventListener('singleBlueScanResult', res=>console.log(res))
1
2

# 返回参数

  • 成功时返回
Prop Type Default Description
messageBody Object N/A 消息体
authStatus String N/A (7.3.0)0代表未确权,1,代表已确权(combo模组有用)
messageType String N/A singleBlueScanResult
moduleType String N/A (7.3.0)0代表单蓝牙模组,1,ble+wireless双模组。不传默认单蓝牙模组
  • messageBody 对象属性
Prop Type Default Description
mac String N/A
name String N/A
authStatus String N/A 0或者1
moduleType Number N/A 0或者1
  • 失败时返回
Prop Type Default Description
errorMessage String N/A 错误消息
errorCode Number N/A 错误码
更新时间: 10/27/2022, 2:33:23 PM