This command is used to send a command to an external program. Currently, only the unlock command (valid only for a locked screen) can be sent through <ExternCommand>. However, <ExternalCommand> is used to receive external commands and is not in <Trigger>. Instead, it is written in <Lockscreen> to monitor screen lock and unlock.
ExternCommand
<ExternCommand command="" condition="" delay="" delayCondition=""/>
ExternalCommand
<ExternalCommands>
<!--action is usually used to receive screen turn-on and turn-off instructions and execute corresponding commands. If it is set to resume, the screen is to be turned on; if it is set to pause, the screen is to be turned off.-->
<Trigger action="">
<Command target="" value=""/>
</Trigger>
</ExternalCommands> Parameter | Type | Mandatory | Description |
|---|---|---|---|
command | String | Yes | Command name. Currently, only the unlock command (valid only for a locked screen) is supported. |
condition | Expression | No | Condition for command execution judgment. Expressions are supported. When the value is true or a non-0 number, the command is executed. When the value is false or 0, the command is not executed. |
delay | Number | No | Delay for executing a command, in milliseconds. |
delayCondition | Expression | No | Condition for command delay judgment. By default, when the value is true or 1, the command execution is delayed; when the value is false or a non-1 number, the command execution is not delayed. |
Example 1: Execute the unlock command to unlock a screen.
<ExternCommand command="unlock"/>
Example 2: Receive screen turn-on and turn-off instructions and execute corresponding commands in the screen lock scenario. In this example, after a screen turn-on instruction is received, the animation of the component named target is played; after a screen turn-off instruction is received, the current time is recorded in pause_time.
<ExternalCommands>
<Trigger action="resume">
<Command target="target.animation" value="play"/>
</Trigger>
<Trigger action="pause">
<VariableCommand name="pause_time" expression="#time_sys"/>
</Trigger>
</ExternalCommands>