# startBlueScan ^5.9.0

开始扫描蓝牙

建议:扫描到设备之后再建立蓝牙连接

超时之后的返回和停止蓝牙扫描接口返回一致

# 请求参数

Prop Type Required Default Description
param Object Y {}
属性:
name:{
Type: String,
Default: N/A,
Description: 蓝牙名称 (可以使用getDeviceInfo中返回的ssid字段)
}
mac:{
Type: String,
Default: N/A,
Description: 蓝牙mac地址((可以使用getDeviceInfo中返回的mac字段))
}
duration:{
Type: Number,
Default: N/A,
Description: 扫描持续时间(单位:秒)
}
请求参数

# 接口调用示例


参数支持2种方式:



eg1:ssid过滤,支持发现一个设备

let param={
name:"midea_xx_xxxx",

duration: 10//自定义数值

}

eg2:mac过滤,支持发现一个设备

let param={

mac:"xxxxxxxxxxxx",

duration: 10//自定义数值

}

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
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

# 返回参数

Prop Type Default Description
messageType String singleBlueScanResult H5用来判断消息类型
messageBody Object {}
属性:
name:{
Type: String,
Default: N/A,
Description: 名称
}

属性:
mac:{
Type: String,
Default: N/A,
Description: mac地址
}

属性:
moduleType:{
Type: number,
Default: 0,
Description: 模组类型 0:代表单蓝牙模组,1:combo双模组
}

属性:
authStatus:{
Type: number,
Default: 0,
Description: 设备确权状态 0:代表未确权,1:代表已确权(combo模组使用,并且已确权的设备才能控制)
}
APP传递的JSON对象

TIP

该接口基于mSmart 协议,底层由singleBlueToothModule单蓝牙支持

Last Updated: 3/9/2022, 1:42:52 PM