To create, edit or delete command, use the command unit/update_command_definition:
svc=unit/update_command_definition¶ms={"itemId":<long>, "id":<long>, "callMode":<text>, "n":<text>, "c":<text>, "l":<text>, "p":<text>, "a":<long>}
Parameters
Name | Description |
---|---|
itemId | unit ID |
id | command ID |
callMode | action: create, update, delete |
Parameters required only for create and update: | |
n | command name |
c | type (see below) |
l | link type (see below) |
p | parameters |
a | access level: rights that user must have to execute current command (see Access flags: General and Access flags: Units and unit groups) |
Command types:
- block_engine – block engine;
- unblock_engine – unblock engine;
- custom_msg – custom message;
- driver_msg – message to driver;
- download_msgs – download messages;
- query_pos – query position;
- query_photo – query snapshot;
- output_on – activate output;
- output_off – deactivate output;
- send_position – send coordinates;
- set_report_interval – set data transfer interval;
- upload_cfg – upload configuration;
- upload_sw – upload firmware.
Link types:
- empty string – auto;
- tcp – TCP;
- udp – UDP;
- vrt – virtual;
- gsm – SMS.
Response
On create and edit:
[ <long>, /* command ID */ { "id":<long>, /* command ID */ "n":<text>, /* command name */ "c":<text>, /* command type */ "l":<text>, /* link type */ "p":<text>, /* parameters */ "a":<uint> /* access level */ } ]
On delete:
[ <long>, /* command ID */ null ]