[r886]: / trunk / mqttsparkplug / mqttsparkplug-example / Device_1 / Plc Logic / Application1 / Edge1 / Scenario / svnobj  Maximize  Restore  History

Download this file

47 lines (46 with data), 10.1 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
42
43
44
45
46
IF Init THEN
    CASE TestScenario OF
        1: // Private Ignition Maker Edition
            ServerUrl := '192.168.168.69';
            ServerPort := 1883;
            KeepAlive := 60; // In seconds        
            Username := "";
            Password := "";
            UseTLS := FALSE;
            StillGettingClientCertificate := FALSE;
        2: // Private Mosquitto
            ServerUrl := '192.168.168.2';
        3: // Public 'broker.hivemq.com';
            ServerUrl := 'broker.hivemq.com';
            KeepAlive := 60; // In seconds               
        4: // Public 'test.mosquitto.org';
            ServerUrl := 'test.mosquitto.org';
            // Please go to Device > PLC Shell and type the command cert-gendhparams
            ServerPort := 8883;
            UseTLS := TRUE;
            StillGettingClientCertificate := FALSE; //no client cert
        7: // Co5e public hosted MQTT server -> empty on puropse! Will not connect
            ServerUrl := 'mqtt.co5e.org';
            KeepAlive := 60;
            Password := ""; // empty on puropse! => Will not connect
            hCert := SysTypes.RTS_INVALID_HANDLE;
            // TLSContextProvider Settings
            sUseCaseName := 'u1';
            ePurpose := Sparkplug.MQTT.NBS.Purpose.Client_Side;
            sHostname := 'mqtt.co5e.org';
            udiVerificationMode := 2;
            // Copy settings to FB
            myTLS.sUseCaseName := sUseCaseName;
            myTLS.ePurpose := ePurpose;
            myTLS.sHostname := sHostname;
            myTLS.udiVerificationMode := udiVerificationMode;
            // Connect the interface
            ItfTLSContext := myTLS;
        8: // Co5e public hosted MQTT server              
            Username := "co5e";
            Password := "co5e";
    //// TLSContextProvider Settings
    //sUseCaseName                  := 'u1';
    GenerateDataPeriod := UINT_TO_TIME( publishPeriod - 250 ); // Now we surely change the data before sending it
    Init := FALSE;
END_IF