RemoveClient

TwinCAT
Network MQTT Client

ns=2;s=DEPRAG Smart/Network/MQTT/RemoveClient

The command terminates the connection of a concrete MQTT client and removes it from the list of active clients.

Parameters:

    Id
    Unique zero-based index that can be used to retrieve the MQTT client from the ActiveClients array.

Returns:

    RemoveClient
    A variable of type OpcMethodReturnValueInt32. The Result property contains the command-specific return values.
      Result
      Unique zero-based index that can be used to retrieve the MQTT client from the ActiveClients array.

Examples:

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

Beckhoff parameter:

    bHttpRemoveClient
    A boolean variable that can be used to trigger the execution of the RemoveClient command.
    OutputDataHttpRemoveClient
    An instance of the ST_Int32OutputData structure into which the return value of the RemoveClient method is written.
    hrHttpRemoveClient
    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.
    nDeviceId
    A DINT variable specifying the client to be removed.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
  bHttpRemoveClient   : BOOL;
  OutputDataHttpRemoveClient : ST_Int32OutputData;
  hrHttpRemoveClient   : HRESULT;

  fbMqtt  : FB_Mqtt;
END_VAR

fbMqtt.RemoveClient(
     bExecute        := bMqttRemoveClient, 
     ConnectionHandle      := depragSmartConnection.ConnectionHandle, 
     nDeviceId        := 0, 
     OutputData        => OutputDataMqttRemoveClient);
IF hrMqttRemoveClient <> S_FALSE THEN 
    bMqttRemoveClient := 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".