[r825]: / branches / FeatureBranches / refactorpayload / SparkplugB / Function Blocks / FB_Edge / FB_EdgeMQTT / svnobj  Maximize  Restore  History

Download this file

42 lines (41 with data), 22.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
_Client( xEnable := _ClientEnable,
         xDone => _ClientDone,
         xBusy => _ClientBusy,
         xError => _ClientError,
         uiPort := _ServerPort,
         xUseTLS := _UseTLS,
         uiKeepAlive := _KeepAlive,
         pbWillMessage := _LastWillMessage,
         uiWillMessageSize := _LastWillMessageSize,
         xWillRetain := _LastWillRetain,
         eWillQoS := _LastWilQos,
         xCleanSession := _ClientCleanSession,
         wsUsername := _Username,
         wsPassword := _Password,
         wsWillTopic := _LastWillTopic,
         sClientId := _ClientId,
         tPingInterval := _ClientPingInterval,
         hCert := _hCert,
         itfTLSContext := _ItfTLSContext,
         itfAsyncProperty := _ItfAsyncProperty,
         sHostname := _ServerUrl,
         eMQTTError => _ClientMQTTError,
         xConnectedToBroker => _ClientConnectedToBroker );'
    Contains Edge of Network (EoN) MQTT CLient, Publisher and subscribers
*)
{attribute 'hide'}
FUNCTION_BLOCK FB_EdgeMQTT
VAR
    _ClientConnecting   : BOOL; // TRUE while trying to connect, otherwise FALSE
    _ServerUrl          : STRING(255); // := 'test.mosquitto.org';
    _ServerPort         : UINT;        // := 1883;
    _KeepAlive          : UINT    := 60;
    _Username           : WSTRING := "";
    _Password           : WSTRING := "";
    _UseTLS             : BOOL    := FALSE;
    //Static initialization, as shown in the following code snippet;
    //VAR
    //    commonName : STRING := 'MyRasPi';
    //        udiVerificationMode:=2
    //END_VAR
    _ItfAsyncProperty        : MQTT.NBS.IAsyncProperty; // Runs the connect process in a own background task. Use this property if the connection setup takes longer than one task cycle (e.g. TLS connections)