ns=2;s=DEPRAG Smart/Network/MQTT/ActiveClients/0/SubscribeWithQualityOfServiceLevel
Subscribes to an MQTT topic with QoS from the MQTT broker.
In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:
VAR
bMqttSubscribeWithQualityOfServiceLevel : BOOL;
OutputDataMqttSubscribeWithQualityOfServiceLevel : ST_VoidOutputData;
hrMqttSubscribeWithQualityOfServiceLevel : HRESULT;
fbMqtt : FB_Mqtt;
END_VAR
hrMqttSubscribeWithQualityOfServiceLevel := fbMqtt.SubscribeWithQualityOfServiceLevel(
bExecute := bMqttSubscribeWithQualityOfServiceLevel,
ConnectionHandle := depragSmartConnection.ConnectionHandle,
sTopic := 'testSmart/test',
QualityOfServiceLevel := MqttQualityOfServiceLevel.ExactlyOnce,
sClientId := '0',
OutputData => OutputDataMqttSubscribeFullyParameterized);
IF hrMqttSubscribeWithQualityOfServiceLevel <> S_FALSE THEN
bMqttSubscribeWithQualityOfServiceLevel := 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".