# Control类型控件配置说明
- [Control类型控件配置说明](#section7914183213491)
- [Display控件](#section16681645104918)
- [Enum控件](#section566910277516)
- [Reversal控件](#section162211550155113)
- [Increase\_Decrease控件](#section1092141210525)
- [Progress控件](#section04131030125215)
- [Multifunction控件](#section1114919529527)
## Control类型控件配置说明
Control类型控件一共有六个,分别是Display类型控件、Enum类型控件、Reversal类型控件、Progress类型控件、IncreaseDecrease类型控件和Multifunction类型控件。
## Display控件
Display控件用于信息展示,支持显示两个或者三个区域内容,支持左右对齐(不带分割线)或者居中(带分割线)。
每个区域内容支持文字, 或者文字加图片(图片显示大小为 24vp \*24vp),文字颜色支持自定义,颜色和图片支持根据数据范围来选择。
示例图:

对应样例:
```
{
"gravity": "default",
"heightType": "default",
"name": "电量",
"span": 1,
"uiList": [
{
"subType": "text",
"textDisplay": {
"down": {},
"upLeft": {
"description": {
"path": "bluetoothConnectStatus/bluetoothConnectStatus",
"value": [
{
"scope": "0",
"target": "未连接"
},
{
"scope": "1",
"target": "已连接"
}
]
},
"type": "dynamicText",
"value": "${bluetoothConnectStatus/bluetoothConnectStatus}"
},
"upRight": {}
}
},
{
"icon": {
"path": "infoDisplay/battery",
"value": [
{
"defaultTarget ": "/template/pic/battery_10_default.png",
"disableTarget ": "/template/pic/battery_10_default.png",
"scope": "-10",
"target": "/template/pic/battery_10_default.png"
},
{
"defaultTarget ": "/template/pic/battery_20_default.png",
"disableTarget ": "/template/pic/battery_20_default.png",
"scope": "10-20",
"target": "/template/pic/battery_20_default.png"
},
{
"defaultTarget ": "/template/pic/battery_30_default.png",
"disableTarget ": "/template/pic/battery_30_default.png",
"scope": "20-30",
"target": "/template/pic/battery_30_default.png"
},
{
"defaultTarget ": "/template/pic/battery_40_default.png",
"disableTarget ": "/template/pic/battery_40_default.png",
"scope": "30-40",
"target": "/template/pic/battery_40_default.png"
},
{
"defaultTarget ": "/template/pic/battery_50_default.png",
"disableTarget ": "/template/pic/battery_50_default.png",
"scope": "40-50",
"target": "/template/pic/battery_50_default.png"
},
{
"defaultTarget ": "/template/pic/battery_60_default.png",
"disableTarget ": "/template/pic/battery_60_default.png",
"scope": "50-60",
"target": "/template/pic/battery_60_default.png"
},
{
"defaultTarget ": "/template/pic/battery_70_default.png",
"disableTarget ": "/template/pic/battery_70_default.png",
"scope": "60-70",
"target": "/template/pic/battery_70_default.png"
},
{
"defaultTarget ": "/template/pic/battery_80_default.png",
"disableTarget ": "/template/pic/battery_80_default.png",
"scope": "70-80",
"target": "/template/pic/battery_80_default.png"
},
{
"defaultTarget ": "/template/pic/battery_90_default.png",
"disableTarget ": "/template/pic/battery_90_default.png",
"scope": "80-90",
"target": "/template/pic/battery_90_default.png"
},
{
"defaultTarget ": "/template/pic/battery_99_default.png",
"disableTarget ": "/template/pic/battery_99_default.png",
"scope": "90-100",
"target": "/template/pic/battery_99_default.png"
},
{
"defaultTarget ": "/template/pic/battery_100_default.png",
"disableTarget ": "/template/pic/battery_100_default.png",
"scope": "100-",
"target": "/template/pic/battery_100_default.png"
}
]
},
"iconText": {
"type": "dynamicText",
"value": "${infoDisplay/battery}%",
"range": "100-0"
},
"subType": "iconTextHorizontal"
}
],
"uiType": "DISPLAY"
}
```
相关的参数,定义如下:
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
name
|
必选
|
String (1-128)
|
当前控件显示名称
|
例如:“电量”。
|
span
|
必选
|
float
|
跨度
|
根据手机设置控件的宽度占比,为1表示占满普通手机的宽。
|
uiType
|
必选
|
String(1-128)
|
控件风格
|
控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
|
heightType
|
可选
|
String(1-128)
|
高度类型
|
“default”,“low”;默认为“default”。
|
gravity
|
可选
|
String(1-128)
|
子视图位置样式
|
样式分为:”default”,” “centerDivider”。默认为“default”,位置样式为俩边靠,无分隔线。” centerDivider”为等分居中且带分隔线。
|
uiList
|
必选
|
DisplayItem[]
|
子视图列表
|
子视图列表,具体根据实际显示需要配置对应个数的显示控件。
|
子属性DisplayItem
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
subType
|
必选
|
String(1-128)
|
子类型
|
纯文本,图标,图标+文本“text”,“icon”,“iconTextVertical”, “iconTextHorizontal”。
|
icon
|
可选
|
DynamicContent
|
动态颜色、图标,文本,根据path路径下数据的范围动态匹配对应的值。同时写icon和text时,形成icon上,文字下的上下结构
|
示例代码如下:
"icon": {
"defaultIcon": "",
"path": "battery/useDay",
"disableIcon": "",
"value": [
{
"scope": "-50",
"target": ""
},
{
"scope": "50-100",
"target": ""
},
{
"scope": "100-",
"target": ""
}
]
}
|
iconText
|
可选
|
NormalText/DynamicText
|
图标描述文本
|
"iconText":{
"color": "",
"type": "normalText",
"value": "电量"
}
|
textDisplay
|
可选
|
DiaplayContent
|
文字模板,分为上左,上右和下。3处文字根据实际需求填写,分为普通文本类型NormalText和动态文本类型DynamicText
|
"textDisplay": {
"down": {},
"upLeft": {
"description": {
"path": "bluetoothConnectStatus/bluetoothConnectStatus",
"value": [
{
"scope": "0",
"target": "未连接"
},
{
"scope": "1",
"target": "已连接"
}
]
},
"type": "dynamicText",
"value": "${bluetoothConnectStatus/bluetoothConnectStatus}"
},
"upRight": {}
}
|
子属性DynamicContent
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
path
|
必选
|
String (1-128)
|
动态内容条件值,可能需要动态获取设备数据填充
|
例如:“bluetoothConnectStatus/bluetoothConnectStatus” ,表示当前设备状态的值。
|
value
|
必选
|
Variation
|
动态范围值
|
{ "scope": "0", "target": "未连接" }。
|
子属性Variation
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
scope
|
必选
|
String (1-128)
|
条件范围
|
用“-”区分范围,有五种类型: 1,-50:表示小于等于50的值 2,50-100;表示大于50小于等于100; 3,100-:表示大于100的值 4,"scope": "-"时,表示可以匹配任意场景。 5,50:表示等于50。
|
target
|
必选
|
String (1-128)
|
条件对应的值
|
可能是颜色值,资源值等,例如:"11FCFC",图标url。
|
defaultTarget
|
可选
|
String (1-128)
|
默认图标url
|
默认图标url。
|
disableTarget
|
可选
|
String (1-128)
|
不可用图标url
|
不可用图标url。
|
子属性NormalText
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
type
|
必选
|
String (1-128)
|
类型字段
|
固定为NormalText。
|
value
|
必选
|
String (1-128)
|
当前控件显示名称
|
固定值,例如:"value": "电量"。
|
color
|
可选
|
String (1-128)
|
当前控件显示颜色
|
固定值,例如:"11FCFC"。
|
子属性DynamicText
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
type
|
必选
|
String (1-128)
|
类型字段
|
固定为DynamicText。
|
value
|
必选
|
String (1-128)
|
当前控件显示名称
|
例如:“${bluetoothConnectStatus/bluetoothConnectStatus}”注意:此处${}表示占位符,内部数据需要根据设备上报结果进行动态匹配。
|
ratio
|
可选
|
float
|
补偿因子
|
例如:牙刷的电量是0.5,实际页面显示为百分数,显示内容为50%,那么补偿因子为0.01,再选中页面数值后,控制的过程中,要再次除以补偿因子,进行命令下发。
|
color
|
可选
|
DynamicContent
|
当前控件显示颜色,动态值
|
"color": {
"path": "battery/useDay",
"value": [
{
"scope": "-50",
"target": "11FCFC"
},
{
"scope": "50-100",
"target": "22FCFC"
},
{
"scope": "100-",
"target": "33FCFC"
}
]
}
|
description
|
可选
|
DynamicContent
|
当前控件描述转换,动态值
|
"description": {
"path": "bluetoothConnectStatus/bluetoothConnectStatus",
"value": [
{
"scope": "0",
"target": "未连接"
},
{
"scope": "1",
"target": "已连接"
}
]
}
|
## Enum控件
Enum控件用于类型选择,支持显示一行或两行区域内容,每行里面有一到四个区域内容,内容之间带分割线。每个区域内容由图片和文字构成,图片在上方,文字在下方。每个区域内容可以点击,点击后将会根据用户设置切换为对应的图片,表示此区域状态改变。如下方阅读区域,图片切换为蓝色,表示处于激活状态。
示例图:

对应样例:
```
{
"gravity": "centerDivider",
"heightType": "default",
"name": "模式",
"span": 1,
"command": [
{
"characteristic": "mode",
"enumInfo": [
{
"displayItem":{
"icon": {
"path": "lightMode/mode",
"value": [
{
"defaultTarget": "/ic_read_nor.png",
"scope": "-",
"target": "/ic_read_on.png"
}
],
"valueNight": [
{
"defaultTarget": "/ic_read_nor_dark.png",
"scope": "-",
"target": "/ic_read_on_dark.png"
}
]
},
"iconText": {
"type": "normalText",
"value": "阅读"
},
"subType": "iconTextVertical"
},
"value": 2
},
{
"displayItem": {
"icon": {
"path": "lightMode/mode",
"value": [
{
"defaultTarget": "/ic_write_nor.png",
"scope": "-",
"target": "/ic_write_on.png"
}
],
"valueNight": [
{
"defaultTarget": "/ic_write_nor_dark.png",
"scope": "-",
"target": "/ic_write_on_dark.png"
}
]
},
"iconText": {
"type": "normalText",
"value": "书写"
},
"subType": "iconTextVertical"
},
"value": 3
},
{
"displayItem": {
"icon": {
"path": "lightMode/mode",
"value": [
{
"defaultTarget": "/ic_computer_nor.png",
"scope": "-",
"target": "/ic_computer_on.png"
}
],
"valueNight": [
{
"defaultTarget": "/ic_computer_nor_dark.png",
"scope": "-",
"target": "/ic_computer_on_dark.png"
}
]
},
"iconText": {
"type": "normalText",
"value": "电脑"
},
"subType": "iconTextVertical"
},
"value": 4
},
{
"displayItem": {
"icon": {
"path": "lightMode/mode",
"value": [
{
"defaultTarget": "/ic_favorite_nor.png",
"scope": "-",
"target": "/ic_favorite_on.png"
}
],
"valueNight": [
{
"defaultTarget": "/ic_favorite_nor_dark.png",
"scope": "-",
"target": "/ic_favorite_on_dark.png"
}
]
},
"iconText": {
"type": "normalText",
"value": "最爱"
},
"subType": "iconTextVertical"
},
"value": 5
}
],
"sid": "lightMode"
}
],
"uiType": "ENUM"
}
```
相关的参数,定义如下:
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
name
|
必选
|
String (1-128)
|
当前控件显示名称
|
例如:“亮度”。
|
span
|
必选
|
float
|
跨度
|
根据手机设置控件的宽度占比,为1表示占满普通手机的宽。
|
uiType
|
必选
|
String(1-128)
|
控件风格
|
控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
|
tag
|
可选
|
String(1-128)
|
标记
|
扩展字段,用作标记特殊控件处理。
|
heightType
|
可选
|
String(1-128)
|
高度类型
|
“default”,“low”;默认为“default”。
|
command
|
必选
|
Command[]
|
控件对应的动作数组
|
ACTION_NORMAL在前面,ACTION_ENUM在后面,下发命令为串行下发,先发完所有的ACTION_NORMAL再发ACTION_ENUM。
|
gravity
|
可选
|
String(1-128)
|
子视图位置样式
|
样式分为:”default”,” center”,“centerDivider”。默认为“default”,位置样式为俩边靠,无分隔线。” center”为等分居中,” centerDivider”为等分居中且带分隔线。
|
NormalCommand
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
sid
|
必选
|
String (1-32)
|
命令对应的服务
|
例如:“lightMode”。
|
characteristic
|
必选
|
String (1-32)
|
命令对应的属性
|
例如:“mode”。
|
value
|
必选
|
int
|
下发命令值
|
例如:"value": 1。
|
EnumCommand
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
sid
|
必选
|
String (1-32)
|
命令对应的服务
|
例如:“lightMode”。
|
characteristic
|
必选
|
String (1-32)
|
命令对应的属性
|
例如:“mode”。
|
value
|
必选
|
int
|
下发命令值
|
例如:"value": 1。
|
EnumInfo
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
displayItem
|
可选
|
DisplayItem
|
通用展示子视图
|
通用展示子视图。
|
value
|
必选
|
int
|
命令对应的服务属性值
|
例如:4。
|
disable
|
可选
|
String[]
|
命令触发后禁用的标签数组
|
例如:["亮度"],例如:台灯关闭的时候,禁用亮度调节。
|
## Reversal控件
Reversal控件用于开关选择,支持显示两个或三个区域。每个区域可显示内容如下表所示。文字颜色支持自定义,颜色和图片支持需根据数据范围来选择。右边的区域内容只可用于显示开关图片。
**表 1** Reversal控件开关选择内容介绍
区域
|
可显示内容
|
是否必须
|
左边区域
|
文字或者文字加图片(图片显示大小固定为 24vp *24vp)
|
必选
|
中间区域
|
文字或者文字加图片(图片显示大小固定为 24vp *24vp)
|
可选
|
右边区域
|
图片(图片显示大小固定为 24vp *24vp)
|
可选
|
示例图:

对应样例:
```
{
"gravity": "default",
"heightType": "default",
"name": "电源",
"span": 1,
"command": [
{
"characteristic": "on",
"reversal": [
{
"disableIcon": "/ic_power_nor.png",
"icon": "/ic_on.png",
"disableIconNight": "/ic_power_nor_dark.png",
"iconNight": "/ic_on_dark.png",
"value": 1
},
{
"disable": {
"name": [
"模式",
"亮度"
]
},
"disableIcon": "/ic_power_nor.png",
"icon": "/ic_off.png",
"disableIconNight": "/ic_power_nor_dark.png",
"iconNight": "/ic_off_dark.png",
"value": 0
}
],
"sid": "switch"
}
],
"displayItemOne": {
"subType": "text",
"textDisplay": {
"down": {},
"upLeft": {
"description": {
"path": "switch/on",
"value": [
{
"scope": "0",
"target": "已关闭"
},
{
"scope": "1",
"target": "已开启"
}
]
},
"type": "dynamicText",
"value": "${switch/on}"
},
"upRight": {}
}
},
"uiType": "REVERSAL"
}
```
相关的参数,定义如下:
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
name
|
必选
|
String (1-128)
|
当前控件显示名称
|
例如:“Battery”。
|
span
|
必选
|
float
|
跨度
|
根据手机设置控件的宽度占比,为1表示占满普通手机的宽。0.5表示占普通手机一半的宽。
|
uiType
|
必选
|
String(1-128)
|
控件风格
|
控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
|
tag
|
可选
|
String(1-128)
|
标记
|
扩展字段,用作标记特殊控件处理。
|
heightType
|
可选
|
String(1-128)
|
高度类型
|
高度类型为:“default”,“low”;默认为“default”。
|
displayItemOne
|
必选
|
DisplayItem
|
通用展示子视图
|
排第一个的展示视图
|
displayItemTwo
|
可选
|
DisplayItem
|
通用展示子视图
|
可选,用于一排显示3个的情况,前俩个显示通用视图,第3个为反转开关。
|
command
|
必选
|
ReversalCommand[]
|
控件对应的动作数组
|
-
|
gravity
|
可选
|
String(1-128)
|
子视图位置样式
|
样式分为:”default”,” center”,“centerDivider”。默认为“default”,位置样式为俩边靠,无分隔线。” center”为等分居中,” centerDivider”为等分居中且带分隔线。
|
ReversalCommand
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
sid
|
必选
|
String (1-32)
|
命令对应的服务
|
例如:“switch”。
|
characteristic
|
必选
|
String (1-32)
|
命令对应的属性
|
例如:“on”。
|
reversal
|
必选
|
Reversal[]
|
反转命令属性
|
数组,对应switch/on的不同属性值,控制的时候,可以相互切换。
|
Reversal
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
value
|
可选
|
int
|
命令下发对应的属性值
|
表示开关值。
|
icon
|
必选
|
String (1-128)
|
命令对应的图像标签
|
命令对应的图标url。
|
disableIcon
|
可选
|
String (1-128)
|
不可用图标url
|
不可用图标url。
|
disable
|
可选
|
String[]
|
命令触发后禁用的标签数组
|
例如:["亮度"],例如:台灯关闭的时候,禁用亮度调节。
|
dialogList
|
可选
|
String[]
|
命令触发后会弹出的对话框列表
|
dialogList里面的值对应dialog的id值。
|
Property
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
path
|
必选
|
String (1-32)
|
属性路径
|
例如:"switch/on",其中switch表示服务,on表示属性。
|
value
|
必选
|
String (1-32)
|
属性值
|
例如:1,表示path的值为1。
|
## Increase\_Decrease控件
Increase\_Decrease控件用于增加或减少数据,支持显示三个区域内容。左边区域内容是减少按钮,右边区域内容是增加按钮,中间区域内容用于显示操作的数据,点击增加或减少按钮可以改变中间的数据。
示例图:

对应样例:
```
{
"name": "湿度",
"span": 1,
"gravity": "default",
"uiType": "INCREASE_DECREASE",
"heightType": "low",
"displayItem": {
"subType": "text",
"textDisplay": {
"down": {},
"upLeft": {
"type": "normalText",
"value": "目标湿度"
},
"upRight": {}
}
},
"command": [
{
"sid": "temperature",
"characteristic": "temperature",
"max": 36,
"min": 17,
"ratio": 1,
"step": 1,
"defaultValue": 26,
"disableIconDecrease": "",
"iconDecrease": "",
"disableIconIncrease": "",
"iconIncrease": ""
}
]
}
```
相关的参数,定义如下:
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
name
|
必选
|
String (1-128)
|
当前控件显示名称
|
例如:“湿度”。
|
span
|
必选
|
float
|
跨度
|
根据手机设置控件的宽度占比,为1表示占满普通手机的宽。
|
uiType
|
必选
|
String(1-128)
|
控件风格
|
控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
|
tag
|
可选
|
String(1-128)
|
标记
|
扩展字段,用作标记特殊控件处理。
|
heightType
|
可选
|
String(1-128)
|
高度类型
|
“default”,“low”;默认为“default”。
|
displayItem
|
可选
|
DisplayItem
|
通用展示子视图
|
中间的展示视图。
|
command
|
必选
|
IncreaseDecreaseCommand[]
|
控件对应的动作数组
|
-
|
gravity
|
可选
|
String(1-128)
|
子视图位置样式
|
样式分为:”default”,” center”,“centerDivider”。默认为“default”,位置样式为俩边靠,无分隔线。” center”为等分居中,” centerDivider”为等分居中且带分隔线。
|
IncreaseDecreaseCommand
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
sid
|
必选
|
String (1-32)
|
命令对应的服务
|
例如:“humidity”。
|
characteristic
|
必选
|
String (1-32)
|
命令对应的属性
|
例如:“humidity”。
|
max
|
必选
|
int
|
范围最大值
|
例如:湿度最大值为100。
|
min
|
必选
|
int
|
范围最小值
|
例如:湿度最小值为0。
|
ratio
|
可选
|
float
|
补偿因子
|
例如:检测到的湿度为0.5,实际显示的湿度为50,那么补偿因子为0.01,再选中页面数值后,控制的过程中,要再次除以补偿因子,进行命令下发。
|
step
|
必选
|
int
|
步进值
|
每次变化的值。
|
iconDecrease
|
必选
|
String
|
减少的图标
|
减少的图标。
|
disableIconDecrease
|
必选
|
String
|
减少的不可用图标
|
减少的不可用图标。
|
iconIncrease
|
必选
|
String
|
增加的图标
|
增加的图标。
|
disableIconIncrease
|
必选
|
String
|
增加的不可用图标
|
增加的不可用图标。
|
defaultValue
|
可选
|
int
|
默认值
|
-
|
disable
|
可选
|
String[]
|
命令触发后禁用的标签数组
|
例如:["亮度"],例如:台灯关闭的时候,禁用亮度调节。
|
## Progress控件
Progress控件用于控制进度,支持显示两个区域内容,左边区域内容是对当前进度的描述,支持文字,或者文字加图片(图片显示大小为 24vp \*24vp),文字颜色支持自定义,颜色和图片支持根据数据范围来选择。右边的区域用于显示进度条。
示例图:

对应样例:
```
{
"gravity": "default",
"heightType": "low",
"name": "亮度",
"span": 1,
"command": [
{
"characteristic": "brightness",
"defaultValue": 100,
"max" : 255,
"min": 0,
"radio" : 1,
"sid": "brightness"
}
],
"displayItemLeft": {
"subType": "text",
"textDisplay": {
"down": {
"color": {
"path" : "brightness/brightness",
"value" : [{
"scope": "-",
"target": "007DFF"
}]
},
"ratio": "0.392156",
"type": "dynamicText",
"value": "${brightness/brightness}%"
},
"upLeft": {
"type": "normalText",
"value": "亮度"
},
"upRight": {}
}
},
"uiType": "PROGRESS"
}
```
相关的参数,定义如下:
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
name
|
必选
|
String (1-128)
|
当前控件显示名称
|
例如:“亮度”。
|
span
|
必选
|
float
|
跨度
|
根据手机设置控件的宽度占比,为1表示占满普通手机的宽。
|
uiType
|
必选
|
String(1-128)
|
控件风格
|
控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
|
heightType
|
可选
|
String(1-128)
|
高度类型
|
高度类型为:“default”,“low”;默认为“default”
|
displayItem
|
可选
|
DisplayItem
|
通用展示子视图
|
中间的展示视图。
|
command
|
必选
|
ProgressCommand[]
|
控件对应的动作数组
|
-
|
ProgressCommand
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
sid
|
必选
|
String (1-32)
|
命令对应的服务
|
例如:“brightness”。
|
characteristic
|
必选
|
String (1-32)
|
命令对应的属性
|
例如:“brightness”。
|
max
|
必选
|
int
|
范围最大值
|
例如:亮度最大值为100。
|
min
|
必选
|
int
|
范围最小值
|
例如:亮度最小值为0。
|
ratio
|
可选
|
float
|
补偿因子
|
例如:台灯的亮度是0.5,实际页面显示为百分数,显示内容为50%,那么补偿因子为0.01,再选中页面数值后,控制的过程中,要再次除以补偿因子,进行命令下发。
|
step
|
必选
|
int
|
步进值
|
每次变化的值。
|
defaultValue
|
可选
|
int
|
默认值
|
-
|
disable
|
可选
|
String[]
|
命令触发后禁用的标签数组
|
例如:["亮度"],例如:台灯关闭的时候,禁用亮度调节。
|
## Multifunction控件
Multifunction控件用于功能控制,支持显示两个或三个区域内容。左边的区域内容用于描述当前状态,中间的区域内容可不显示或用于计时,右边的区域内容用于显示操作按钮。示例图:

对应样例:
```
{
"name": "制作",
"span": 1,
"uiType": "MULTIFUNCTION",
"displayItemOne": {
"subType":"text",
"textDisplay": {
"down": {},
"upLeft": {
"description": {
"path": "workingStatus/status",
"value": [
{
"scope": "1",
"target": "待机中"
},
{
"scope": "2",
"target": "准备中"
},
{
"scope": "3",
"target": "制作中"
},
{
"scope": "4",
"target": "制作完成"
},
{
"scope": "5",
"target": "预约中"
}
]
},
"type": "dynamicText",
"value": "${workingStatus/status}"
},
"upRight": {}
}
},
"displayItemTwo": {
"subType":"text",
"textDisplay":{
"down":{
"type":"normaltext",
"value":"剩余时间"
},
"upLeft":{
"type":"dynamicText",
"value":"${remainingTime/time}"
},
"upRight":{
}
}
},
"multifunctionInfo": {
"path": "workingStatus/action",
"value": [
{
"scope": "1",
"commandOne": [
{
"characteristic": "action",
"disableIcon": "/ic_prepare.png",
"icon": "/ic_prepare.png",
"disableIconNight": "/ic_prepare.png",
"iconNight": "/ic_prepare.png",
"value": 3,
"sid": "workingStatus"
}
]
},
{
"scope": "2",
"commandOne": [
{
"characteristic": "action",
"disableIcon": "/ic_prepare.png",
"icon": "/ic_prepare.png",
"disableIconNight": "/ic_prepare.png",
"iconNight": "/ic_prepare.png",
"value": 3,
"sid": "workingStatus"
}
],
"commandTwo": [
{
"characteristic": "action",
"disableIcon": "/ic_cancel.png",
"icon": "/ic_cancel.png",
"disableIconNight": "/ic_cancel.png",
"iconNight": "/ic_cancel.png",
"value": 0,
"sid": "workingStatus"
}
]
},
{
"scope": "3",
"commandOne": [
{
"characteristic": "action",
"disableIcon": "/ic_cancel.png",
"icon": "/ic_cancel.png",
"disableIconNight": "/ic_cancel.png",
"iconNight": "/ic_cancel.png",
"value": 0,
"sid": "workingStatus"
}
]
},
{
"scope": "4",
"commandOne": [
{
"characteristic": "action",
"disableIcon": "/ic_complete.png",
"icon": "/ic_complete.png",
"disableIconNight": "/ic_complete.png",
"iconNight": "/ic_complete.png",
"value": 0,
"sid": "workingStatus"
}
]
},
{
"scope": "5",
"commandOne": [
{
"characteristic": "action",
"disableIcon": "/ic_cancel.png",
"icon": "/ic_cancel.png",
"disableIconNight": "/ic_cancel.png",
"iconNight": "/ic_cancel.png",
"value": 0,
"sid": "workingStatus"
}
]
}
]
}
}
```
相关的参数,定义如下:
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
name
|
必选
|
String (1-128)
|
当前控件显示名称
|
例如:“Battery”。
|
span
|
必选
|
float
|
跨度
|
根据手机设置控件的宽度占比,为1表示占满普通手机的宽。
|
uiType
|
必选
|
String(1-128)
|
控件风格
|
控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
|
heightType
|
可选
|
String(1-128)
|
高度类型
|
高度类型为:“default”,“low”;默认为“default”。
|
displayItemOne
|
必选
|
DisplayItem
|
通用展示子视图
|
排第一个的展示视图。
|
displayItemTwo
|
可选
|
DisplayItem
|
通用展示子视图
|
可选,用于一排显示3个的情况,前俩个显示通用视图,第3个为多功能按钮。
|
multifunctionInfo
|
必选
|
DynamicCommandContent
|
多功能按钮
|
-
|
DynamicCommandContent
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
path
|
必选
|
String (1-128)
|
动态内容条件值,可能需要动态获取设备数据填充
|
例如:“workingStatus/status” ,表示当前设备状态。
|
value
|
必选
|
VariationCommand
|
动态范围值
|
{ "scope": "-50", "target": "11FCFC" }。
|
VariationCommand
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
scope
|
必选
|
String (1-128)
|
条件范围
|
用“-”区分范围,有五种类型: 1,-50:表示小于等于50的值 2,50-100;表示大于50小于等于100; 3,100-:表示大于100的值 4,"scope": "-"时,表示可以匹配任意场景。 5,50:表示等于50。
|
commandOne
|
必选
|
MultifunctionCommand
|
执行动作1
|
示例代码如下:
{
"characteristic": "action",
"disableIcon": "icon_start_dis.png",
"icon": "icon_start.png",
"value": 1,
"sid": "action"
}
|
commandTwo
|
可选
|
MultifunctionCommand
|
执行动作2
|
示例代码如下:
{
"characteristic": "action",
"disableIcon": "icon_start_dis.png",
"icon": "icon_start.png",
"value": 1,
"sid": "action"
}
|
MultifunctionCommand
字段名称
|
可选/必选
|
字段类型
|
字段描述
|
备注
|
sid
|
必选
|
String (1-32)
|
命令对应的服务
|
例如:“switch”。
|
characteristic
|
必选
|
String (1-32)
|
命令对应的属性
|
例如:“on”。
|
value
|
可选
|
int
|
命令下发对应的属性值
|
value和valueString二者存在其一。其中wifi设备使用value,蓝牙设备使用value或者valueString。
|
valueString
|
可选
|
String (1-128)
|
命令下发对应的属性值
|
value和valueString二者存在其一。其中wifi设备使用value,蓝牙设备使用value或者valueString。
|
icon
|
必选
|
String (1-128)
|
命令对应的图像标签
|
命令对应的图标url。
|
disableIcon
|
可选
|
String (1-128)
|
不可用图标url
|
不可用图标url。
|
disable
|
可选
|
String[]
|
命令触发后禁用的标签数组
|
例如:["蒸功能"],例如:豆浆机关闭的时候,禁用蒸功能。
|