Flow
- flow : いわゆるソースコード
- 複数のblockで構成される
- 各blockが一つのタスクを実行する。例えば
- ファイルをコピーする
- 変数に値を割り当てる
- ボタンが押されるのを待つ
- 状態を確認するblockもある
- デバイスがアンロックされているか確認する
- ユーザに決定を促す
- 今後も様々な block を追加予定。
- block は他の block と connector で接続される。
- flow が実行されると、fiber steps through each block along the paths. The number of dots a block has depends on the type of block,
- 基本的なブロックには2つのタイプがある。
- action block
- 他のブロックの結果として実施される
- なので、一つ以上の IN の接続が必要
- そして、一つの OK を持つ
- 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.
Fiber
- fiber :実行中の flow インスタンスである
- PCプログラムのように、同時に複数の fiber を起動できる。
- 各 fiber は独立して実行され、その内部の変数も独立したものとして扱われる。
- flow は(手動で)実行されると、fiber が作られる。
- このとき、Flow start block が使われることもあれば、すでに起動している fiber のクローンを作成する場合もある。この場合は Fork block を用いる。
- fiber は 次につながらない Flow stop block / Fiber stop block で停止する。エラーで指定することもある。
- 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:
- flow の編集の際、コンパイル時のみ変更できる(実行時には変更されない) Options。多くのオプションが ブロックの基本的な機能である Proceed と呼ばれるオプションを持つ。
- 実行時に fiber で評価される Input は変数や演算子による表現も含む場合もあるし、事前に定義される(定数である)場合もある。すべての input は明示される必要があることがほとんどである。よって、何かしらのデフォルト値が使われることもある。
- 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
多くの block は Proceed と呼ばれる option を持つ。この option は て停止して block の完了を待つか、状態の変化を待つか、もしくは停止せずすぐに次に進むかコントロールする。
決定ブロックに対し、Proceed option はそのブロックに対し、現在の状態をチェックさせるか、はたまた状態の変化を待たせる。
例
- Location block にて、自分がその場所に居るかどうかをチェックする、その場所に入る/から出るまで待つ
- Wi-Fi 接続 block は、あるネットワークに接続しているかどうかをチェックする、あるネットワークに接続する/接続が切れるまで待つ
Other automation apps differentiate between “event triggers” and “condition/constraint checks”.
Automate combines the same functionally into single block, using different Proceed options.
Technical
Automate uses cooperative multitasking, so it doesn’t use a thread for each fiber.
It may do so for blocking operations such as reading from disk or network.
Fiber は内部ストレージに保存され、もしデバイスがシャットダウンしたら、デバイスが再起動した際に、最後のブロックから継続される。
see the Run on system startup option in settings.
最終更新:2019年01月06日 10:22