Flow
流程
A flow is the “source code” for your automation, it’s made up of blocks, where each block will perform a single task.
一个流程是你的自动化的源代码,由模块构成,其中每个模块会执行一个单独的任务。
This may be an action like copying a file, assigning a value to a variable or awaiting a media button press.
可能是如复制一个文件、给一个变量赋一个值或者等待一个媒体按键的按压之类的活动。
A block may also check a condition like is the device unlocked or letting the user make a decision.
一个模块也可能是检查设备的开启状态或者让用户做一个决定。
There are a lot of blocks to build with, and more will be added in the future.
有许多内置的模块,以后还会有更多的模块被加入其中。
A block may be connected to other blocks by a path/lane between their “connector” dots.
一个模块可能通过它们的链接点之间的一个路径/通道,链接着其他模块。
When a flow is running, a fiber steps through each block along the paths.
当流程运行时,线程沿着路径逐步完成每个模块。
The number of dots a block has depends on the type of block, but there are two types of standard blocks: An action block is performed as a result of another block, so it must have one or more incoming (IN) connections.
一个模块,其点的数量,依据于其模块类型,但有两类标准的模块:行动模块是运行其他模块的结果,所以必有一个或一个以上的输入型连接点。
An action can only have one outcome, OK.
一个行动只能有一个结果,OK。
A decision block is performed as a result of another block, so it must have one or more incoming (IN) connections.
一个决定模块是运行作为其他模块的结果,所以必有一个或多个输入型连接点。
A decision can have either an YES or NO outcome.
一个决定会有一个"Yes"或"No"的结果。
Fiber
线程
A fiber is a running instance of a flow.
一个线程是一个流程的运行实例。
Like a computer program, a flow can be started several times creating multiple fibers which all run simultaneously.
就像一个电脑程序,一个流程能被开始多次,创建多重的;多个的;复杂的;多功能的线程同时运行。
Each fiber run independently, and points to a block in the flow where it’s currently performing the task, it also contain an independent set of values for the user declared variables.
各线程独立运行,指向当前执行任务流程中的模块,也包含用户声明变量的独立设置值。
A fiber is created when a flow is manually started, using the Flow start block, or by “cloning” an already running fiber using the Fork block.
一个线程在当一个流程被手动开始时被创建,使用流程开始模块,或通过使用分叉模块来克隆复制一个已经运行的线程。
A fiber stops when the flow is manually stopped, by a Flow stop or Fiber stop block, it reaches an unconnected dot, or if an error occurs.
当流程被手动停止,线程停止。通过流程停止或线程停止模块,到达一个没有连接的点,或一个错误产生。
A flow is considered stopped when all its fibers has stopped.
当其所有线程被停止时,该流程被视为停止。
All fibers run simultaneously, but an individual fiber may pause to await the completion of a block task.
所有线程同步运行,但一个独立的线程可以暂停以等候一个模块任务的完成。
This can often be configured with the Proceed option of a block.
这经常被配置布局构造为一个模块的前进选项。
Block configuration
模块的配置布局构造
A block can often be configured to perform its action or decision in a certain way.
一个模块经常以某种方式被配置为,执行其行动或决定。
The configuration, fields in the block editor, are divided into three section: Options that can only change at “compile time” by the user when editing the flow, and never at run-time when a fiber is running it.
这配置,领域场地在模块编辑软件程序,被划分为三个部分:只有在"编译时",被用户编辑流程而改变的选项,并且当一个线程运行该选项时,从不改变。
Many blocks have an option called Proceed which control the basic functionality of the block.
许多模块有一个被称为前进的选项,能控制该模块的基本功能。
Input arguments which are evaluated by the fiber at run-time, may include expressions with variables and operators, or just a predefined (constant) value.
该线程运行时所求的输入实参(arguments函数调用时的实际参数,parameter函数定义中的参数),可能包括带有变量的表达式和运算符,或只是一个预先定义的(常数)值。
All input arguments are seldom required and can be left unspecified, then a sensible default will be used instead, read the block instructions.
所有的输入实参,是很少要求的。可以省略不详细说明或指定,一个明智的默认选项经常代替使用,去阅读模块说明。
Output variables are used by the fiber at run-time to store the result or “output” of a block.
输出变量经常在线程运行时被用于存储一个模块的结果或"输出"。
An output variable field can only contain the name of a user-declared variable, not an expression or other value.
一个输出变量场领域,只能包含用户声明变量的名称,不能是表达式或值。
The result are assigned to the named variable when the block has completed, the variable can then be used as input argument in the following blocks.
当该模块完成,该结果会被赋予这已命名的变量,该变量在接下来的模块中能被用作输入实参。
The proceed option
前进选项
Many blocks have an option called Proceed.
许多模块有一个被称为前进的选项。
This option controls whether the fiber should pause to await completion of the block, await change of a condition, or if it should just proceed immediately without pause.
该选项控制该线程是否暂停以等候模块的完成、等候一个状态的改变,或者是否应该立即前进,不需暂停。
For a decision block the Proceed option usually makes the block either instantly check the current condition, or wait for the condition to change.
对于一个选择模块,前进选项通常会使该模块,要么及时检查当前状态,要么等候该状态改变。
For example, the Location at block can check if you’re currently at a location, or wait until you’ve enter/exit a location.
举例来说,在模块中的位置选项,可以检查当前你是否在某个位置,或者等候直到你进入/退出某个位置。
The Wi-Fi connected block can check if a network is currently connected, or wait for a network to connect/disconnect.
wifi连接模块,能检查,一个网络当前是否连接,或等待网络连接或断开。
Other automation apps differentiate between “event triggers” and “condition/constraint checks”.
其他的自动化App,在"事件触发"和"状态/限制检查"之间区分。
Automate combines the same functionally into single block, using different Proceed options.
Automate 使用不同的前进选项,将相同功能装入单独的模块。
Technical
技术支持
Automate uses cooperative multitasking, so it doesn’t use a thread for each fiber.
Automate 使用共享的多重任务处理,所以它不需要为每一个线程使用一条线索。
It may do so for blocking operations such as reading from disk or network.
如从硬盘或网络上读取等模块操作也是如此。
Fibers are saved to the internal storage, so if the device shutdown they’ll continue to run from the last block when the device has restarted, see the Run on system startup option in settings.
线程被保存在内部存储中,所以如果设备关闭重启后,它们就会从上一个模块继续运行,查看设置中系统开始选项,运行。