Skip to content

Commit 36efeaa

Browse files
committed
README.md updating
1 parent b18bfde commit 36efeaa

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

README.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,45 @@ MQTT module for the [OpenDAQ SDK](https://github.com/openDAQ/openDAQ). The modul
1616
- **Where**: *mqtt_streaming_module/src/mqtt_client_fb_impl.cpp, include/mqtt_streaming_module/...*
1717
- **Purpose**: Represents the MQTT broker as an openDAQ function block - the connection point through which function blocks are created.
1818
- **Main properties:**
19-
- *BrokerAddress* (string) - MQTT broker address. It can be an IP address or a hostname. By default, it is set to *"127.0.0.1"*.
20-
- *BrokerPort* (integer) - Port number for the MQTT broker connection. By default, it is set to *1883*.
19+
- *BrokerAddress* (string) MQTT broker address. It can be an IP address or a hostname. By default, it is set to *"127.0.0.1"*.
20+
- *BrokerPort* (integer) Port number for the MQTT broker connection. By default, it is set to *1883*.
2121
- *Username* (string) — Username for MQTT broker authentication. By default, it is empty.
2222
- *Password* (string) — Password for MQTT broker authentication. By default, it is empty.
2323
- *ConnectionTimeout* (integer) — Timeout in milliseconds for the initial connection to the MQTT broker. If the connection fails, an exception is thrown. By default, it is set to *3000 ms*.
2424
2) **MQTT publisher Function Block (MQTTJSONPublisherFB)**:
2525
- **Where**: *include/mqtt_streaming_module/mqtt_publisher_fb_impl.h, src/mqtt_publisher_fb_impl.cpp*
26-
- **Purpose**: Publishes openDAQ signal data to MQTT topics. There are **four** general data publishing schemes:
27-
1) One MQTT message per signal / one message per sample / one topic per signal / one timestamp for each sample. Example: *{"AI0": 1.1, "timestamp": 1763716736100000}*
26+
- **Purpose**: Publishes openDAQ signal data to MQTT topics.
27+
There are **five** general data publishing schemes:
28+
1) Raw data publishing. When using this approach, the data is transmitted in raw binary form without any additional wrapper. Domain data is not transmitted.
29+
2) JSON message data publishing. One MQTT message per signal / one message per sample / one topic per signal / one timestamp for each sample. Example: *{"AI0": 1.1, "timestamp": 1763716736100000}*
2830

29-
2) One MQTT message per signal / one message containing several samples / one topic per signal / one timestamp per sample (array of samples). Example: *{"AI0": [1.1, 2.2, 3.3], "timestamps": [1763716736100000, 1763716736200000, 1763716736300000]}*
31+
3) JSON message data publishing. One MQTT message per signal / one message containing several samples / one topic per signal / one timestamp per sample (array of samples). Example: *{"AI0": [1.1, 2.2, 3.3], "timestamps": [1763716736100000, 1763716736200000, 1763716736300000]}*
3032

31-
3) One MQTT message for all signals / one message per sample containing all signals / one topic for all signals / one shared timestamp for all signals. Example: *{"AI0": 1.1, "AI1": 2, "timestamp": 1763716736100000}*
33+
4) JSON message data publishing. One MQTT message for all signals / one message per sample containing all signals / one topic for all signals / one shared timestamp for all signals. Example: *{"AI0": 1.1, "AI1": 2, "timestamp": 1763716736100000}*
3234

33-
4) One MQTT message for all signals / one message containing several samples for all signals / one topic for all signals / one shared timestamp for all signals (array of samples). Example: *{"AI0": [1.1, 2.2, 3.3], "AI1": [4.1, 4.2, 4.3], "timestamp": [1763716736100000, 1763716736200000, 1763716736300000]}*
35+
5) JSON message data publishing. One MQTT message for all signals / one message containing several samples for all signals / one topic for all signals / one shared timestamp for all signals (array of samples). Example: *{"AI0": [1.1, 2.2, 3.3], "AI1": [4.1, 4.2, 4.3], "timestamp": [1763716736100000, 1763716736200000, 1763716736300000]}*
3436

3537
The schemes are configured through combinations of properties.
3638

3739
- **Main properties**:
38-
- *TopicMode* (list) — Selects whether to publish all signals to separate MQTT topics (one per signal, *TopicPerSignal mode*) or to a single topic (*SingleTopic mode*), one for all signals. Choose *0* for *TopicPerSignal* mode and *1* for *SingleTopic* mode. By default, it is set to *TopicPerSignal* mode.
40+
- *Mode* (list) — Selects the mode of publishing (JSON, Raw). Choose *0* for *JSON* mode and *1* for *Raw* mode. In JSON mode, the function block converts signal samples into JSON messages and publishes them to MQTT topics. In Raw mode, the function block publishes raw signal samples to MQTT topics without any conversion. By default it is set to JSON mode.
41+
- *TopicMode* (list) — The property is used **only** in *JSON* mode. Selects whether to publish all signals to separate MQTT topics (one per signal, *TopicPerSignal mode*) or to a single topic (*SingleTopic mode*), one for all signals. Choose *0* for *TopicPerSignal* mode and *1* for *SingleTopic* mode. By default, it is set to *TopicPerSignal* mode.
3942
- *QoS* (list) — MQTT Quality of Service level. It can be *0* (at most once), *1* (at least once), or *2* (exactly once). By default, it is set to *1*.
40-
- *Topic* (string) — Topic name for publishing in *SingleTopic* mode. If left empty, the Publisher's *Global ID* is used as the topic name.
43+
- *Topic* (string) — The property is used **only** in *JSON* mode. Topic name for publishing in *SingleTopic* mode. If left empty, the Publisher's *Global ID* is used as the topic name.
4144
- *Topics* (list of strings, read-only) — Contains a list of topics used for publishing data in the *TopicPerSignal* mode. The order in the list is the same as the input ports order.
42-
- *GroupValues* (bool) — Enables the use of a sample pack for a signal. By default, it is set to *false*.
43-
- *SignalValueJSONKey* (list) — Describes how to name a JSON value field. By default it is set to *GlobalID*.
44-
- *SamplesPerMessage* (integer) — Sets the size of the sample pack when publishing grouped values. By default, it is set to *1*.
45+
- *GroupValues* (bool) — The property is used **only** in *JSON* mode. Enables the use of a sample pack for a signal. By default, it is set to *false*.
46+
- *SignalValueJSONKey* (list) — The property is used **only** in *JSON* mode. Describes how to name a JSON value field. By default it is set to *GlobalID*.
47+
- *SamplesPerMessage* (integer) — The property is used **only** in *JSON* mode. Sets the size of the sample pack when publishing grouped values. By default, it is set to *1*.
4548
- *ReaderWaitPeriod* (integer) — Polling period in milliseconds, specifying how often the server calls an internal reader to collect and publish the connected signals’ data to an MQTT broker. By default, it is set to *20 ms*.
4649
- *EnablePreviewSignal* (bool) — Enable the creation of preview signals: one signal in *SingleTopic* mode and one signal per connected input port in *TopicPerSignal* mode. These signals contain the same JSON string data that is published to MQTT topics.
4750
- *Schema* (string, read-only) - Describes the general representation of a JSON data packet according to the current function block settings.
4851

4952
To configure the publishing schemes, set the properties as follows:
50-
1) *TopicMode(0), GroupValues(false)*;
51-
2) *TopicMode(0), GroupValues(true), SamplesPerMessage(<pack_size>)*;
52-
3) *TopicMode(1), GroupValues(false)*;
53-
4) *TopicMode(1), GroupValues(true), SamplesPerMessage(<pack_size>)*;
53+
1) *Mode(1)*;
54+
2) *Mode(0), TopicMode(0), GroupValues(false)*;
55+
3) *Mode(0), TopicMode(0), GroupValues(true), SamplesPerMessage(<pack_size>)*;
56+
4) *Mode(0), TopicMode(1), GroupValues(false)*;
57+
5) *Mode(0), TopicMode(1), GroupValues(true), SamplesPerMessage(<pack_size>)*;
5458

5559

5660
3) **MQTT subscriber Function Block (MQTTSubscriberFB)**:
@@ -61,6 +65,7 @@ MQTT module for the [OpenDAQ SDK](https://github.com/openDAQ/openDAQ). The modul
6165
- *Topic* (string) — MQTT topic to subscribe to for receiving raw binary data.
6266
- *QoS* (list) — MQTT Quality of Service level. It can be *0* (at most once), *1* (at least once), or *2* (exactly once). By default, it is set to *1*.
6367
- *EnablePreviewSignal* (bool) — Enable the creation of a preview signal. This signal contains the raw binary data received from an MQTT topic.
68+
- *DomainMode* (list) — Defines the domain of the preview signal. By default it is set to *None* (0), which means that the preview signal doesn't have a timestamp. If set to *System time* (1), the preview signal's timestamp is set to the system time when the MQTT message is received.
6469
- *MessageIsString* (bool) — Interpret a received message as a string.
6570
- *JSONConfigFile* (string) — path to file with **JSON configuration string**. See the *JSONConfig* property for more details. This property could be set only at creation. It is not visible.
6671
- *JSONConfig* (string) — **JSON configuration string** that defines the MQTT topic and the corresponding signals to subscribe to. This property could be set only at creation. It is not visible. A typical string structure:
@@ -126,6 +131,7 @@ MQTT module for the [OpenDAQ SDK](https://github.com/openDAQ/openDAQ). The modul
126131
- **Purpose**: To parse JSON string data to extract a value and a timestamp, and to send data and domain samples based on this data.
127132
- **Main properties**:
128133
- *ValueKey* (string) — Specifies the JSON field name from which value data will be extracted. This property is required. It should be contained in the incoming JSON messages. Otherwise, a parsing error will occur.
134+
- *DomainMode* (list) — Defines how the timestamp of the decoded signal is generated. By default it is set to *None* (0), which means that the decoded signal doesn't have a timestamp. If set to *Extract from message* (1), the JSON decoder will try to extract the timestamp from the incoming JSON messages (see *DomainKey* property). If set to *System time* (2), the timestamp of the decoded signal is set to the system time when the JSON message is received.
129135
- *DomainKey* (string) — Specifies the JSON field name from which timestamp will be extracted. This property is optional. If it is set it should be contained in the incoming JSON messages. Otherwise, a parsing error will occur.
130136
- *Unit* (string) — Specifies the unit symbol for the decoded value. This property is optional.
131137
---

0 commit comments

Comments
 (0)