SendMessage

SendMessage 1:

This method is called once to send a (push) message to the broker. This message is then displayed in the app. This is not a message that is visible as a push message on the mobile phone.

Syntax

METHOD SendMessage : BOOL
VAR_INPUT
    sMessage : STRING(255);
END_VAR

SendMessage 2: Return value

Name

Type

Description

SendMessage

BOOL

The method returns the return value TRUE if the call was successful.

SendMessage 3: Inputs

Name

Type

Description

sMessage

STRING

Text of the (push) message to be sent to the broker.

Possible errors are output at the outputs bError and hrErrorCode of the function block instance.

SendMessage 4:

Strings in UTF-8 format

The variables of type STRING used here are based on the UTF-8 format. This STRING formatting is common for MQTT communication.

In order to be able to receive special characters and texts from a wide range of languages, the character set in the Tc3_IotCommunicator library is not limited to the typical character set of the data type STRING. Instead, the Unicode character set in UTF-8 format is used in conjunction with the data type STRING.

If the ASCII character set is used, there is no difference between the typical formatting of a STRING and the UTF-8 formatting of a STRING.