get_hw_cmds
The get_hw_cmds function is used to get the list of commands available for a unit or a hardware type, or to get the command templates.
svc=core/get_hw_cmds¶ms={"deviceTypeId":<long>,
"unitId":<long>,
"template":<bool>
"lang":"<text>"}
Parameters
Name | Description |
---|---|
deviceTypeId | Hardware type ID. |
unitId | Unit ID. |
template | Flag. If set to 1 (on), the returned result is a JSON with the command template data. The parameter is optional. |
lang | Flag. Translates the values of "title" and "label" values. The parameter is optional. |
You can set only one parameter or both. The search begins with the hardware type ID and if it fails, continues with the unit ID. If you want to omit a parameter, set it to 0.
Returned result
The returned result contains the list of available commands if template:0 or missing:
{
"<text>":[ /* link type: GSM, TCP, UDP, VRT */
"<text>", /* command type */
...
],
...
}
If the template flag is set to 1, the command template is returned. It can be a custom set of fields. An example of a JSON is given below:
{
"<cmd_template_name>": { /* name */
"icon": <text>, /* icon */
"props": [ /* properties */
{
"label":<text>, /* property label */
"type":<text>, /* type */
"validate":<text>, /* validation rule */
"value": [ /* key-value array */
{
"n":<text>, /* key */
"v":<text> /* value */
},
...
],
"default":<text>, /* a default value (for example the IP address port) */
"title":<text>, /* title */
"maxlength":<uint> /* maximum length */
},
...
]
},
...
}
Possible error codes:
Code | Description |
---|---|
6 | Failed to fetch the current user. |
4 | One of the following:
|