MQTTSUB
This block subscribe to a given MQTT topic.
Library
Communicate
Parameters
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
hostname | Hostname | Defines the broker's IP address | String | |
port | Port | Defines the port number to use. | Scalar | |
username | Username | Defines the username for authentication. | String | |
password | Password | Defines the password for authentication. | Vector | |
topic | Topic | Defines the topic to describe to, the message will be read from that topic. | String | |
connection | Connection | Defines the MQTT clean session flag. | Structure | |
connection/clean | Clean session | Number | 0 | |
connection/persistent | Persistent session | Number | 0 | |
qos | Quality of Sevice | Defines the Quality of Service to be used for the connection. | Structure | |
qos/qos0 | 0 | This level guarantees a best-effort delivery. There is no guarantee of delivery. The recipient does not acknowledge receipt of the message and the message is not stored and re-transmitted by the sender. | Number | 0 |
qos/qos1 | 1 | This level guarantees that a message is delivered at least one time to the receiver. The sender stores the message until it gets a PUBACK packet from the receiver that acknowledges receipt of the message. It is possible for a message to be sent or delivered multiple times. | Number | 0 |
qos/qos2 | 2 | This level guarantees that each message is received only once by the intended recipients. It is the safest and slowest quality of service level. | Number | 0 |
keepalive | Keep alive | Defines the number of seconds after which the broker should send a PING message to the client if no other messages have been exchanged in that time. | Scalar | |
timeout | Timeout | Maximum number of milliseconds to wait for network activity in the select() call before timing out. Set to 0 for instant return. Set negative to use the default of 1000ms. | Scalar | |
maxiter | Maximum numbers of retries | Maximum number of retries if the data is not recieved. | Scalar |
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
nout | Number of outputs | Defines the number of outputs | Number | |
outports | Output ports | Defines the data type and size for each output. | Structure | |
outports/rowsize | Row size | Defines the row size for each output. | Cell of scalars | |
outports/colsize | Column size | Defines the column size for each output. | Cell of scalars | |
outports/datatype | Data Type | Defines the data type for each output. | Cell of strings | 'double' |
messageformat | Message Format | Defines the Format of the message. | Structure | |
messageformat/text | Text | Number | 0 | |
messageformat/json | Json | Number | 0 | |
message | Message | Defines the message format to be read. This message can be of any format (text, JSON, ...). User can use %%1, %%2, ..., %%n to identify the outputs. | String | |
jsonfields | Json field names | Structure | ||
jsonfields/name | Name | Cell of strings | ||
separator | Array separator | Defines the separator used for arrays elements. | String | |
onFailure | Do on failure | Defines the behavior on failure. | Structure | |
onFailure/error | Error | Number | 0 | |
onFailure/warning | Warning | Number | 0 | |
verbose | Verbose | If set, some information are written in the OML command windows. This flag help to debug. | Number | 0 |
Ports
Name | Type | Description | IO Type | Number |
---|---|---|---|---|
Port 1 | explicit | output | nout | |
Port 2 | activation | input | 1 |