.. first line of object.rst template
.. first line of pou-object.rst template
.. first line of fun-object.rst template
.. _`.fld-FinderOpta.fld-Functions.fld-Read.MQTT_ReadTopicBinary`:


.. index::
   single: MQTT_ReadTopicBinary

.. _`MQTT_ReadTopicBinary`:

``MQTT_ReadTopicBinary`` (FUN)
------------------------------

FUNCTION MQTT_ReadTopicBinary : WORD




This function subscribes to the specified MQTT topic and returns published messages as arrays of bytes.

The output ``valid`` is set to ``TRUE`` when a publication occurs
on the topic and the message payload is copied into ``value``. Also the
output variable ``value_size`` is set to the number of bytes copied.





InOut:
    +--------+--------------------------+------------------------+------------------------------------------------------------+
    | Scope  | Name                     | Type                   | Comment                                                    |
    +========+==========================+========================+============================================================+
    | Return | ``MQTT_ReadTopicBinary`` | ``WORD``               | Status code returned by the runtime (0 means "no errors"). |
    +--------+--------------------------+------------------------+------------------------------------------------------------+
    | Inout  | ``id``                   | ``WORD``               | Operation identifier used by the runtime.                  |
    +--------+--------------------------+------------------------+------------------------------------------------------------+
    | Input  | ``topic``                | ``STRING(127)``        | MQTT topic name.                                           |
    +        +--------------------------+------------------------+------------------------------------------------------------+
    |        | ``qos``                  | ``WORD``               | Quality of Service level.                                  |
    +--------+--------------------------+------------------------+------------------------------------------------------------+
    | Output | ``value``                | ARRAY [0..244] OF BYTE | Binary value received from the topic.                      |
    +        +--------------------------+------------------------+------------------------------------------------------------+
    |        | ``value_size``           | ``WORD``               | Number of valid bytes in value.                            |
    +        +--------------------------+------------------------+------------------------------------------------------------+
    |        | ``valid``                | ``BOOL``               | ``TRUE`` when a valid value has been received.             |
    +--------+--------------------------+------------------------+------------------------------------------------------------+







.. last line of fun-object.rst template
.. last line of pou-object.rst template
.. last line of object.rst template



