# getDeviceInfo ^6.8
获取设备信息,如果设备id没指定则是获取当前设备的信息
# 调用方式
getDeviceInfo(params)
1
返回 Promise,使用 then/catch 或 await 处理结果。 接收单个业务参数;是否需要传参按下方参数表约定,无业务参数时可省略。具体字段及返回数据由宿主原生约定。
# 请求参数
| Prop | Type | Default | Comment |
|---|---|---|---|
applianceCode | String | N/A | 家电id |
# 接口调用示例
this.$bridge.getDeviceInfo()
1
# 返回参数
- 成功时返回
| Prop | Type | Default | Description |
|---|---|---|---|
canBleTransport | String | N/A | 是否支持数传,"1"支持, "0"不支持,不传不做任何处理 |
deviceName | String | N/A | 设备名 |
homeName | String | N/A | 家庭名 |
roomName | String | N/A | 所属房间名称 |
masterId | String | N/A | 设备所属网关ID |
deviceSn | String | N/A | 设备SN |
devicedSn8 | String | N/A | 设备SN8码,蓝牙设备的mac |
smartProductId | string | N/A | 设备的spid |
productId | String | N/A | 产品id |
productModel | String | N/A | 产品型号 |
enterpriseCode | String | N/A | 企业码, 11.2版本以上 |
deviceId | String | N/A | 设备ID |
ssid | String | N/A | 用于蓝牙名称 |
deviceType | String | N/A | 设备类型 |
roomId | String | N/A | 所属房间ID |
deviceBtToken | String | N/A | 蓝牙设备的校验Token |
deviceSubType | String | N/A | 设备子类型 |
isOnline | String | N/A | 设备是否在线,"1":在线,"0":离线 |
moduleType | String | N/A | "0", 代表单蓝牙模组,"1",ble+wireless network双模组(蓝牙直连控制) |
mac | String | N/A | 设备的mac地址,mesh ble 等设备 才会有该字段 |
deviceIcon | String | N/A | 设备icon |
subDeviceIcon ^8.1 | String | N/A | 子设备icon 原生8.1版本新增 |
supportNetworkBridge | number | N/A | 0 不支持网桥功能,1支持网桥功能 |
singleBleDevice | number | N/A | 0 普通设备 1单蓝牙子设备(已挂靠到网桥)7.10新增 |
- 失败时返回
| Prop | Type | Default | Description |
|---|---|---|---|
errorMessage | String | N/A | 错误消息 |
errorCode | Number | N/A | 错误码 -1 查找不到设备 |
# 接口返回示例
this.$bridge.getDeviceInfo().then(res => {
const { deviceId, isShareDevice, deviceType, deviceSn8, deviceName } = res;
// 设备id: deviceId
// 是否为设备主人: isShareDevice
// 设备类型: deviceType (可能不包含'0x')
// sn8: deviceSn8
// 设备名称: deviceName
})
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8