diff --git a/docs/pages/command.md b/docs/pages/command.md index 145634a..716c21f 100644 --- a/docs/pages/command.md +++ b/docs/pages/command.md @@ -82,10 +82,10 @@ Or change the detector sensibility on all detector logics in all traffic lights: `command/all/all/detector/sensibility` -## Response -How would command responses be handled? We would use the request-response pattern, which is based on Response Topics. When you send a command, you pass a topic that would want to response to be published to. A supervisor sending a command could pass the response topic: -`response//component/module/command`. +## Result +How would command results be handled? We would use the request-result pattern, which is based on Result Topics. When you send a command, you pass a topic that would want to result to be published to. A supervisor sending a command could pass the result topic: +`result//component/module/command`. -When a supervisor with id 22ba changing plan with `command/45fe/main/tlc/plan`, the respons would be send to `response/22ba/main/tlc/plan`. +When a supervisor with id 22ba changing plan with `command/45fe/main/tlc/plan`, the respons would be send to `result/22ba/main/tlc/plan`. -All supervisor can receive response if the just subscribe to `response/+/main/tlc/plan`. +All supervisor can receive result if the just subscribe to `result/+/main/tlc/plan`. diff --git a/docs/pages/messages.md b/docs/pages/messages.md index 0eda99a..7422f68 100644 --- a/docs/pages/messages.md +++ b/docs/pages/messages.md @@ -3,13 +3,40 @@ title: Messages permalink: /messages/ nav_order: 100 has_children: true +has_toc: false --- # Messages -RSMP 4 is based on MQTT. Messages are send by publishing to a topic path and passing a payload. +RSMP 4 defines the following messages with coresponding topic paths structures: -## Payload +| Message type | Topic path | +|-|-| +| [Presence](presence.md) | `presence/` | +| [Status](status.md) | `status////` | +| [Command](command.md) | `command////` | +| [Result](result.md) | `result////` | +| [Alarm](alarm.md) | `alarm////` | +| [Reaction](reaction.md) | `reaction////` | + + +All these topic paths (except presence) follow this layout: + +``` +///[/] +``` + +- type: the type of message, either presence, statuss, command, resposne, alarm or reaction. +- module: the name of the module. +- code: the code of command/status/alarm within the module. +- node: the id of the sender or receiver, depending on the message type. +- component: indentifies one or more [components](components.md). + +The component can be left out as a shortcut to refer to the main component. + +The component is includes as part of the topic path (except for presence messages) to ensure that you can retain status, commands an alarms for each component. + +## Payload CBOR Encoding Message payloads consist of JSON encoded in binary format using [CBOR (Concise Binary Object Representation)](https://cbor.io). Using CBOR encoding saves space, while still retaining the JSON data model, which is very easy to work with. diff --git a/docs/pages/response.md b/docs/pages/response.md deleted file mode 100644 index c1ba77f..0000000 --- a/docs/pages/response.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: Response -parent: Messages -nav_order: 3 -permalink: /messages/response/ ---- - -## Command Response -A command reponses is published after handling a command. - -``` -response///[/] -```` - -Examples: -``` -response/tlc/2/45fe # TLC M0002 (for main component) response from node 45fe -response/sensor/17/45fe/dl/3 # Sensor M0017 for detector logic 3 from node 45fe -``` diff --git a/docs/pages/result.md b/docs/pages/result.md new file mode 100644 index 0000000..6ebbf1a --- /dev/null +++ b/docs/pages/result.md @@ -0,0 +1,19 @@ +--- +title: Result +parent: Messages +nav_order: 3 +permalink: /messages/result/ +--- + +## Command Result +A command result is published after handling a command. + +``` +result///[/] +```` + +Examples: +``` +result/tlc/2/45fe # TLC M0002 (for main component) result from node 45fe +result/sensor/17/45fe/dl/3 # Sensor M0017 for detector logic 3 from node 45fe +``` diff --git a/docs/pages/topic_paths.md b/docs/pages/topic_paths.md deleted file mode 100644 index d82db09..0000000 --- a/docs/pages/topic_paths.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: Topic Paths -nav_order: 10 ---- - -# Topic Paths -All messages follow this topic path layout: - -``` -///[/] -``` - -- type: the type of message, either presence, statuss, command, resposne, alarm or reaction. -- module: the name of the module -- code: the code of command/status/alarm within the module -- node: the id if sender or receiver, depending on the mesage type -- component: component path indentifying one or more components, can be left out as a shortcut to refer to the main component. - -Attributes and data are send in the payload, not as part of the topic path. - -The node id represents wither a sender or a receiver, depending on the message type. - -The [Component path](components.md) consists or zero, one or more parts separate with slashes. - -MQTT allows a retained value per topic path. The component is includes as part of the topic path (except for presence messages) to ensure that you can retain status, commands an alarms for each component. - -## Messages summary - -| Message type | Topic path | -|-|-| -| [Presence](presence.md) | `presence/` | -| [Status](status.md) | `status////` | -| [Command](command.md) | `command////` | -| [Response](response.md) | `response////` | -| [Alarm](alarm.md) | `alarm////` | -| [Reaction](reaction.md) | `reaction////` | -