List of available commands

To get the list of commands available to a unit or a hardware type or even get command templates use the command core/get_hw_cmds:

svc=core/get_hw_cmds&params={"deviceTypeId":<long>,
			     "unitId":<long>,
			     "template":<bool>
			     "lang":<text>}

Parameters

Name Description Comments
deviceTypeId hardware type ID
unitId unit ID
template flag, respond with com-
mand template data:
1 – on
optional
lang flag, translates “title”,“label” values optional

You can set either one of the parameters or both. The procedure begins with the search by hardware type ID, and if it fails, the search by unit ID proceeds. If you want to omit one of the parameters, set it to 0.

Response

Returns the list of available commands (if template:0 or missing):

{
	<text>:[	/* link type: gsm, tcp, udp, vrt */
		<text>,	/* command type */
		...
	],
	...
}

Returns command templates (example json is below; in real templates it might be custom set of fields 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>,    /* some dafault value (for example port of IP-address ) */
        "title":<text>,      /* title */
        "maxlength":<uint>   /* max length */
      },
      ...      
    ]
  },
  ...  
}