StartDefaultWithoutWillMessage

TwinCAT TIA
Network MQTT Client ActiveClients One client

ns=2;s=DEPRAG Smart/Network/MQTT/ActiveClients/0/StartDefaultWithoutWillMessage

Parameterizes the MQTT client and establishes a connection to the specified MQTT broker.

Parameters:

    ClientName
    A string variable which specifies the name of the client.

Returns:

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bMqttStartDefaultWithoutWillMessage
    A boolean variable that can be used to trigger the execution of the StartDefaultWithoutWillMessage command.
    OutputDataMqttStartDefaultWithoutWillMessage
    An instance of the ST_VoidOutputData structure into which the return value of the StartDefaultWithoutWillMessage method is written.
    hrMqttStartDefaultWithoutWillMessage
    This can be used to monitor the execution of the command. Error codes have the type HRESULT.
    fbMqtt
    An instance of the "FB_Mqtt" function block supplied with the DEPRAG Smart library.
    sClientName
    A string(255) variable representing the identification of the MQTT client at the broker.
    bIgnoreCertificateChainErrors
    A boolean variable that specifies whether to ignore errors in the certificate chain.
    bIgnoreCertificateRevocationErrors
    A boolean variable that specifies whether to ignore errors from the certificate revocation list.
    sClientId
    A String(255) variable that specifies the client that should execute the command.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
   bMqttStartDefaultWithoutWillMessage     : BOOL;
   OutputDataMqttStartDefaultWithoutWillMessage  : ST_VoidOutputData;
   hrMqttStartDefaultWithoutWillMessage    : HRESULT;

   fbMqtt  : FB_Mqtt;
END_VAR

hrMqttStartDefaultWithoutWillMessage := fbMqtt.StartDefaultWithoutWillMessage(
     bExecute       := bMqttStartDefaultWithoutWillMessage, 
     ConnectionHandle     := depragSmartConnection.ConnectionHandle, 
     sClientName       := 'SmartTest', 
     bIgnoreCertificateChainErrors  := TRUE, 
     bIgnoreCertificateRevocationErrors := TRUE, 
     sClientId       := '0', 
     OutputData       => OutputDataMqttStartDefaultWithoutWillMessage);
IF hrMqttStartDefaultWithoutWillMessage <> S_FALSE THEN 
    bMqttStartDefaultWithoutWillMessage := FALSE;
END_IF
                                                    

For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".