send_cmd
To send a command to the unit, use the unit/send_cmd command.
svc=unit/send_cmd¶ms={
"itemId": <long>,
"commandType": <text>,
"commandName": <text>,
"linkType": <text>,
"param": <text>,
"timeout": <uint>,
"flags": <uint>
}
Parameters
The required parameters are marked with an asterisk (*).
| Name | Description |
|---|---|
| itemId* | Unit ID. |
| commandType* | Command type. See below. |
| commandName | Command name. If not specified, the command type is used as a name. |
| linkType* | Channel via which the command should be sent. See below. |
| param* | Command parameters. |
| timeout* | Timeout for the command to wait in the queue, in seconds. |
| flags | Flags for selecting a phone number to execute the command: 0 - use any (primary, then secondary) 0x1 - use primary 0x2 - use secondary 0x10 - send param in JSON format. |
Command types
| Command type | Description |
|---|---|
| block_engine | Block the engine. |
| unblock_engine | Unblock the engine. |
| custom_msg | Send a custom message. |
| driver_msg | Send a message to the driver. |
| download_msgs | Download messages. |
| query_pos | Request the unit location. |
| query_photo | Request a photo. |
| output_on | Activate an output. |
| output_off | Deactivate an output. |
| send_position | Send coordinates. |
| set_report_interval | Set a data transfer interval. |
| upload_cfg | Upload a configuration. |
| upload_sw | Upload firmware. |
Channels
| Value | Channel |
|---|---|
| Empty string | Auto |
| tcp | TCP |
| udp | UDP |
| vrt | Virtual |
| gsm | SMS |
Example
Below is an example of the unit/send_cmd request.
svc=unit/send_cmd¶ms={"itemId":1351,"commandName":"pin","linkType":"","param":"pin 0000","timeout":60,"flags":0}
Response
If the request is completed successfully, an empty response is returned.
{ }
Otherwise, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | Invalid input parameters. |
| 5 | Error sending the command. |
| 7 | The user doesn’t have the required access rights to the unit, specifically: ADF_ACL_AVL_UNIT_VIEW_CMD_ALIASES ADF_ACL_AVL_UNIT_EDIT_CMD_ALIASES ADF_ACL_AVL_UNIT_EXEC_CMDS |