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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | PROGRAM Edge1 VAR Init : BOOL := TRUE; EoN : Sparkplug.FB_Edge; EoNConnectionState : Sparkplug.SparkplugSessionStateType; NumberOfDevices : UDINT; MyDevice1 : Sparkplug.FB_Device; Device1Healthy : BOOL := TRUE; MyDevice2 : Sparkplug.FB_Device; Device2Healthy : BOOL := TRUE; MyDevice3 : Sparkplug.FB_Device; Device3Healthy : BOOL := TRUE; MyDevice1State : Sparkplug.SparkplugSessionStateType; MyDevice2State : Sparkplug.SparkplugSessionStateType; MyDevice3State : Sparkplug.SparkplugSessionStateType; PlugIt : BOOL := TRUE; ItfEoN : Sparkplug.ISparkplugDeviceProtocol; GenerateDataPeriod : TIME; GenerateDataElapsed : TIME; GenerateDataTimer : TON; Str : ChangingString; TimeStamp : Sparkplug.T_DateTime; TON_DelayStartup : TON := (PT := T#5S); END_VAR IF Init THEN AddAllMetrics(); Scenario( TestScenario := g_example_settings.TestScenario); IF NOT Scenario.StillGettingClientCertificate AND TON_DelayStartup.Q THEN EoN( ServerUrl := Scenario.ServerUrl, ServerPort := Scenario.ServerPort, PrimaryHostID := g_example_settings.PrimaryHostID1, NodeName := g_example_settings.EdgeName1, GroupId := g_example_settings.GroupID, KeepAlive := Scenario.KeepAlive, CleanSession := Scenario.CleanSession, Username := Scenario.Username, Password := Scenario.Password, UseTLS := Scenario.UseTLS, hCert := Scenario.hCert, publishPeriod := Scenario.publishPeriod, // ITLSContextProvider := ItfTLSContext, // We provide a reference to an instance of TLSContext IASyncPropertyProvider :=, SessionState => EoNConnectionState, NumberOfDevices => NumberOfDevices ); ELSIF Scenario.StillGettingClientCertificate THEN //The below method creates a Client Certificate for you Scenario.AdditionalStepsToRegisterAClientCertificateWithtest_mosquitto_org(); IF PlugIt THEN ItfEoN := EoN; ELSE ItfEoN := 0; MyDevice1( DeviceName := "Device1", DeviceHealthy := Device1Healthy, ItfEoNInstance := ItfEoN, PluggedIntoEoN =>, SessionState => MyDevice1State, publishPeriod := Scenario.publishPeriod ); MyDevice2( DeviceName := "Device2", DeviceHealthy := Device2Healthy, SessionState => MyDevice2State, MyDevice3( DeviceName := "Device3", DeviceHealthy := Device3Healthy, SessionState => MyDevice3State, |