# sendSourceData ^9.4.0
直接蓝牙透传原始数据(跟代理没关系),就算开启了网关代理,也会直接通过蓝牙透传,不经过云端物模型和lua转换
# 请求参数
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
param | Object | Y | {}属性: mac:{Type: String, Default: N/A, Description: 蓝牙mac地址 } applianceId:{Type: String, Default: N/A, Description: 设备id,(可以从getDeviceInfo中读取deviceId<) data:{Type: String, Default: N/A, Description: 发给设备的电控数据 } isSync:{Type: Boolean, Default: false, Description: 10.2新增 true/false。同步/异步。不传默认false(同步返回,则通过callback直接回调,没有receiveMessageFromApp,异步则通过receiveMessageFromApp通知返回。能同步返回的前提是支持A3透传指令,不支持的传true,也会通过receiveMessageFromApp返回) } | 请求参数 |
# 接口调用示例
let param={
mac:"xxxx", //蓝牙mac地址,从getDeviceInfo中读取mac
applianceId:"xxx", //设备id, getDeviceInfo中读取deviceId
data:"xxx", // 发给设备的电控数据
isSync:false // 同步/异步 true/false
}
this.$bridge
.sendSourceData(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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 返回参数
通过监听 receiveMessageFromApp 获取
成功时返回
| Prop | Type | Default | Description |
|---|---|---|---|
messageType | String | receiveSingleBlueSourceDataInfo | H5用来判断消息类型 |
messageBody | Object | {}附表1 | APP传递的JSON对象 |
- 附表1:messageBody返回参数
| Prop | Type | Value | Description |
|---|---|---|---|
applianceId | String | Y | N/A |
mac | String | Y | N/A |
data | Object | {} | data设备回复的原始电控指令 |
TIP
该接口基于mSmart 协议,底层由singleBlueToothModule单蓝牙支持