Description

  • Description of the slider widget

Interface version

Version number Writer Date Description
1.0 Qin Zhitian June 29, 2021 initial release

IP address

http://192.168.1.1/wapi

API list

Name Description
set set attributes
get get attributes

1. set

Description of request parameters

Parameter Name Type Description
attr string attribute
attr.type string type: value_change-‘value change-trigger event’;size-‘slider size’; range-‘maximum and minimum values of slider’;cur-‘value and mode’;change-‘value added and mode’;
attr.x_value int parameter: size-‘length’;range-‘minimum value’;cur-‘value’;change-‘value added’;
attr.y_value int parameter: size-‘width’;range-‘maximum value’;
attr.anim string parameter: on-‘set value with animation’;off-‘change value immediately’;

Call example

{
    "wid": "s1",
    "cmd" : "set",
    "attr": {
        "type": "value_change"
    }
}
Note: set a slider event to trigger callback;
{
    "wid": "s1",
    "cmd" : "set",
    "attr": {
            "type": "size",
            "x_value": "150",
            "y_value": "30"
    }
}
Note: set the size of the slider to 150 * 30;
{
    "wid": "s1",
    "cmd" : "set",
    "attr": {
            "type": "range",
            "x_value": "0",
            "y_value": "100"
    }
}
Note: set the value range of the slider to 0-100;
{
    "wid": "s1",
    "cmd" : "set",
    "attr": {
            "type": "cur",
            "x_value": "50",
            "anim": "on"
    }
}
Note: set the value of slider to 50, and the animation effect is to set the value with animation;
{
    "wid": "s1",
    "cmd" : "set",
    "attr": {
            "type": "cur",
            "x_value": "50",
            "anim": "off"
    }
}
Note: set the value of slider to 50, and the animation effect is to change the value immediately;
{
    "wid": "s1",
    "cmd" : "set",
    "attr": {
            "type": "change",
            "x_value": "10",
            "anim": "on"
    }
}
Note: set the slider value to increase by 10 from the original value,and the animation effect is to set the value with animation;
{
    "wid": "s1",
    "cmd" : "set",
    "attr": {
            "type": "change",
            "x_value": "10",
            "anim": "off"
    }
}
Note: set the slider value to increase by 10 from the original value,and the animation effect is to change the value immediately;

Return example

{
    "code": 0
}

Description of return parameters

Parameter Name Type Description
result string result information
result.code int error code

Error Code

Error Code Description

2. get

Description of request parameters

Parameter Name Type Description

Call example

{
    "wid": "s1",
    "cmd" : "get"
}

Return example

{
    "cur_value": 60,
    "code": 0
}

Description of return parameters

Parameter Name Type Description
result string result information
result.code int error code
result.cur_value int slider value

Error code

Error Code Description
文档更新时间: 2021-08-19 16:08   作者:plj