diff --git a/fsm.update.md b/fsm.update.md new file mode 100644 index 0000000..2bf4be0 --- /dev/null +++ b/fsm.update.md @@ -0,0 +1,68 @@ +## Request +* **Description**: Inquires about the current state of the FSM. +* **Subscribers**: [FSMHandler](https://github.com/avatao-content/baseimage-tutorial-framework/wiki/FSMHandler) + +```json +{ + "key": "update", + "intent": "control", + "scope": "zmq" +} +``` + +*** + +**Example**: +```json +{ + "key": "fsm.update", +} +``` + +## Response +* **Description**: Lists information about the FSM's internal state. +* **Subscribers**: [FSMAware](https://github.com/avatao-content/baseimage-tutorial-framework/wiki/FSMAware) + +```json +{ + "key": "fsm.update", + "intent": "event", + "scope": "broadcast" +} +``` + +| Parameter | Type | Required | Description | +| ------------ |:--------:|:------------------:| --------------------------- | +| *current_state* | `string` | :heavy_check_mark: | Name of the current FSM state. | +| *in_accepted_state* | `string` | :heavy_check_mark: | Tells whether the FSM is in its final state. On the platform, the challenge is considered finished when this property is true. | +| *last_event* | `object` | :heavy_check_mark: | Contains the source, destination, trigger keyword and timestamp of the latest transition. | +| *valid_transitions* | `array` | :heavy_check_mark: | Lists every possible transitions from the current step. | + +*** + +**Example**: +```json +{ + "current_state": "1", + "in_accepted_state": false, + "intent": "event", + "key": "fsm.update", + "last_event": { + "from_state": "0", + "timestamp": "2019-09-10T14:43:35.646400", + "to_state": "1", + "trigger": "step_1" + }, + "scope": "broadcast", + "valid_transitions": [ + {"trigger": "to_0"}, + {"trigger": "to_1"}, + {"trigger": "to_2"}, + {"trigger": "to_3"}, + {"trigger": "to_4"}, + {"trigger": "to_5"}, + {"trigger": "step_2"}, + {"trigger": "step_next"} + ] +} +``` \ No newline at end of file