# Command

After receiving the command, the terminal will confirm it with the server and will only execute the command once it is confirmed as executable.

# Device-Server Command Interaction Sequence Diagram

Device Polling Command

descript

# Device Receives Command API:

Basic Information

Path: /wp-json/wp/v2/comments

Method: GET

Description: This can be used to let the device receive commands.

Request Parameters

Parameter Required Example Description
clt_type Yes terminal Fixed as ‘terminal’
device_num Yes int Device serial number

Response Data

Explanation: 
The command data can be generated by the CommandGenerator tool in the CltCloudDevKitEnhancer package. See this section for details.
Name Type Required Description
root object [] No Single command object.
├─ id integer Yes Command confirmation ID, can be auto-incremented. (Ensure that at least the two consecutive command IDs received by the terminal are not duplicated.)
├─ post integer No Treminal ID, not processed by the device. Optional.
├─ karma integer Yes Terminal screen execution method: 0-get, 1-post, 2-put, 3-delete.
├─ ContentDTO object Yes Command object.
├─ raw string Yes JSON corresponding to the command, "{}" for empty state.
├─ author_url string Yes Command operation type, such as api/brightness, "" for empty state.

Example

# Brightness Command

Parameter: Brightness

Modifying the value in "{"brightness":80}" will change the brightness value.

The range of brightness values: 0-255.

{
	"id": 1,
	"post": 1,
	"author_url": "api/brightness",
	"content": {
		"raw": "{\"brightness\":88}"
	},
	"karma": 2
}

# Upgrade Command

Parameter: Upgrade package URL

{
	"id": 1,
	"post": 1,
	"author_url": "api/update",
	"content": {
		"raw": "http://ip/wp-content/upload/2020/12/update_c1_v1.67.1.1329_b7c809cdb9bd4a78500d3bd8c27f0de9_480774370.zip"
	},
	"karma": 0
}

# Reboot Command

{
	"id": 1,
	"post": 1,
	"author_url": "api/action",
	"content": {
		"raw": "{\"command\":\"reboot\"}"
	},
	"karma": 1
}

# Screenshot Command

{
	"id": 1,
	"post": 1,
	"author_url": "transmission/ftp/config",
	"content": {
		"raw": "{}"
	},
	"karma": 0
}

# Sleep Command

{
    "id": 1,
    "post": 1,
    "author_url": "api/action",
    "content": {
        "raw": "{\"command\":\"sleep\"}" 
    },
    "karma": 1
}

# Update Program Command

{
	"id": 1,
	"post": 1,
	"author_url": "",
	"content": {
		"raw": "{\"program\":\"dirty\"}"
	},
	"karma": 0
}

# Wakeup Command

{
    "id": 1,
    "post": 1,
    "author_url": "api/action",
    "content": {
        "raw": "{\"command\":\"wakeup\"}" 
    },
    "karma": 1
}

# Schedule Command

{
    "id":1,
    "post":1,
    "author_url":"",
    "content":{
        "raw":"{\"program\":\"schedule\"}"
    },
    "karma":0
}

# Onboard Relay Command

Parameter: Board relay status value (0: Close; 1: Open)

{
    "id":1,
    "post":1,
    "author_url":"api/board_relay",
    "content":{
        "raw":"[{\"relay\":1,\"delay\":0,\"status\":1}]"
    },
    "karma":2
}

# Relay Command

Parameter: 0: Close, 1: Open

{
    "id":1,
    "post":1,
    "author_url":"api/relay",
    "content":{
"raw":"[{\"relay\":1,\"delay\":0,\"status\":1},{\"relay\":2,\"delay\":0,\"status\":1},{\"relay\":3,\"delay\":0,\"status\":1}]"
    },
    "karma":2
}

# Clear Cache Command

{
    "id":1,
    "post":1,
    "author_url":"api/clrresunused",
    "content":{
        "raw":"{}"
    },
    "karma":3
}

# Color Temperature Command

Parameter: Color temperature, with a range between 2000 and 10000

{
    "id":1,
    "post":1,
    "author_url":"api/colortemp",
    "content":{
        "raw":"{\"colortemp\":2222}"
    },
    "karma":2
}

# Switch Signal Source Command

Parameter: Signal type, Sync signal (hdmi), Async signal (dvi)

{
    "id":1,
    "post":1,
    "author_url":"api/inputmode",
    "content":{
        "raw":"{\"inputmode\":\"hdmi\"}"
    },
    "karma":2
}

# Volume Command

Parameter: Volume.

The output volume is divided into 16levels (0-15), with 15 representing 100% volume.

{
    "id":1,
    "post":1,
    "author_url":"api/volume",
    "content":{
        "raw":"{\"musicvolume\":10}"
    },
    "karma":2
}

# GPS Reporting Command

You can modify the GPS reporting interval by adjusting the value of gps.report.interval in the content field.

{\"gps.report.interval\":30}: Report every 30 seconds.

{\"gps.report.interval\":0}: Disable GPS reporting.

{
  "id": 1,
  "post": 1,
  "author_url":"api/setreporttime",
  "content":{
    "raw": "{\"gps.report.interval\":30}"
  },
  "karma": 1
}

# Switch Program Command

You can view the program list in the status information reported by the device.

Example of vsns content is as follows:

{
  "contents": [
    {
      "unused": 0,
      "ressize": 0,
      "type": "lan",
      "content": [
        {
          "size": 5075,
          "name": "Playlist8770_319e0214d9f829fa1a461106c9665504_5075.vsn",
          "publishedmd5": "",
          "md5": ""
        }
      ]
    },
    {
      "unused": 3735273,
      "ressize": 4065575,
      "type": "internet",
      "content": [
        {
          "size": 331634,
          "name": "Playlist9017_783596d9ee396d7a604dac56a6979546_1332.vsn",
          "publishedmd5": "",
          "md5": ""
        }
      ]
    }
  ],
  "playing": {
    "name": "Playlist8770_319e0214d9f829fa1a461106c9665504_5075.vsn",
    "type": "internet"
  }
}

"act_url": api/vsns/sources/ + Program sources(vsns.contents.type) + /vsns/ + Program name(vsns.contents.content.name) + /activated

lan: Local Area Network Programs, internet: Internet Programs

Example:

api/vsns/sources/lan/vsns/Playlist8770_319e0214d9f829fa1a461106c9665504_5075.vsn/activated

api/vsns/sources/internet/vsns/Playlist9017_783596d9ee396d7a604dac56a6979546_1332.vsn/activated

Command Contents:

{
  "post": 929,
  "id": 3782,
  "author_url": "api/vsns/sources/internet/vsns/Playlist9017_783596d9ee396d7a604dac56a6979546_1332.vsn/activated",
  "content": {
    "raw": "{\"command\":\"\"}"
  },
  "karma": 2
}

# Adjust Monitoring Reporting Interval Command

"sensor.report.interval": is the sensor reporting interval, in seconds

"ber.report.interval": is the bit error rate reporting interval, in seconds

Command Contents:

{
  "post": 929,
  "id": 3783,
  "author_url": "api/setreporttime",
  "content": {
    "raw": "{\"sensor.report.interval\":\"180\",\"ber.report.interval\":\"180\"}"
  },
  "karma": 1
}

# Enable or Disable Content Reporting Command

(Switch of playing statistics)

"status": 1: Enable, 0: Disable.

{
  "post": 929,
  "id": 3786,
  "author_url": "api/contentreport",
  "content": {
    "raw": "{\"status\":1}"
  },
  "karma": 2
}

# Clear Program Command

This command is used to clear all programs of the player.

{
  "id":1,
  "post":1,
  "author_url":"api/clrprgms",
  "content":{
    "raw":"{}"
  },
  "karma":3
}

# Delete Terminal Program Command

You can view the device's program list and switch between programs in the status data reported by the device.

"author_url": api/vsns/sources/ + program source (type) + /vsns/ + program name (name)

{
  "id":1,
  "post":1,
  "author_url":"api/vsns/sources/internet/vsns/Playlist9017_783596d9ee396d7a604dac56a6979546_1332.vsn",
  "content":{
    "raw":"{\"command\":\"\"}"
  },
  "karma":3
}

# Report Terminal Runtime Log Command

Currently, log reporting is supported only on terminals with version 1.70.5 or higher, as well as certain customized versions.

{
  "id":1,
  "post":1,
  "author_url":"api/current_log",
  "content":{
    "raw":"{}"
  },
  "karma":0
}

# Set Language and Region Command

Parameters in "{"language":"zh","country":"HK"}":

Language: Refer to: https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes (opens new window)

Region: Refer to: https://en.wikipedia.org/wiki/ISO_3166-2 (opens new window)

You can also refer to: https://doc.weixin.qq.com/doc/w3_AbIAhwbDAOwV1GV28m2Rgu1MPj9bh?scode=ABoA9QdVAGEFbOVZu7AbIAhwbDAOw (opens new window)

Chinese (China): zh-CN

English (Canada): en, CA

Example:

{
  "id":1,
  "post":1,
  "author_url":"api/locale",
  "content":{
    "raw":"{\"language\":\"zh\",\"country\":\"CN\"}"
  },
  "karma":2
}

# Terminal Log Reporting Command

Enable/Disable Terminal Log Reporting Command

"{"log_report":"on"}": "on" means enabled; "off" means disabled.

{
  "id":1,
  "post":1,
  "author_url":"api/reportswitch",
  "content":{
    "raw":"{\"log_report\":\"on\"}"
  },
  "karma":2
}

# Network Interface Configuration Reporting Command

The reported content is from the ifstatus interface in the terminal status.

{
  "id":1,
  "post":1,
  "author_url":"api/ifstatus",
  "content":{
    "raw":"{}"
  },
  "karma":0
}

Enable/Disable Reporting of Carousel Schedule Program Name Command

You can enable or disable the reporting of carousel program names by modifying the "reportswitch.rotate_program_vsns_report" field in the terminal status.

"{"rotate_program_vsns_report":"on"}": "on" means enabled; "off" means disabled.

{
  "id":1,
  "post":1,
  "author_url":"api/reportswitch",
  "content":{
    "raw":"{\"rotate_program_vsns_report\":\"on\"}"
  },
  "karma":2
}

# Set Time Zone Command

timezoneId: Time zone ID

timezone: The offset of this time zone from UTC

isautotime: Whether to automatically synchronize time (1: Yes, 0: No)

For details, refer to: https://www.zeitverschiebung.net/cn/all-time-zones.html (opens new window)

You can also refer to: https://doc.weixin.qq.com/doc/w3_AbIAhwbDAOwV1GV28m2Rgu1MPj9bh?scode=ABoA9QdVAGEFbOVZu7AbIAhwbDAOw (opens new window)

(UTC+08:00)Asia/Shanghai: timezoneId: Asia/Shanghai, timezone: 8

(UTC-07:00)America/Creston: timezoneId: America/Creston, timezone: -7

{
  "id": 1,
  "post": 1,
  "author_url": "api/newrtc",
  "content": {
    "raw": "{\"timezoneId\":\"Asia/Taipei\",\"timezone\":8,\"isautotime\":1}"
  },
  "karma": 2
}

# Command Response API

Basic Information

Path: /wp-json/wp/v2/comments

Method: POST

Description: After receiving a command, the device will validate it and then send a confirmation request to the server. The status code between 200 and 300 returned by the sender indicates that the command can be executed.

Request Parameters

Headers

Parameter Value Required
Content-Type application/json Yes

Params

Name Type Required Description
post integer Yes Termial ID

Body

Name Type Required Description
parent integer Yes Command ID.
content string Yes Device validation results of the command: Duplicate comments or Executable comment.

Request Example

{
	"parent": 999,
	"content": "Executable comment"
}

Response Data

The device determines whether to execute this command based on the status code. Execution is allowed if the status code is between 200 and 300. Otherwise, it will not be executed.