Diff of /branches/FeatureBranches/refactorpayload/SparkplugB/Function Blocks/FB_Edge/FB_Edge/svnobj [r824] .. [r825]  Maximize  Restore

Switch to side-by-side view

--- a/branches/FeatureBranches/refactorpayload/SparkplugB/Function Blocks/FB_Edge/FB_Edge/svnobj
+++ b/branches/FeatureBranches/refactorpayload/SparkplugB/Function Blocks/FB_Edge/FB_Edge/svnobj
@@ -1,5 +1,5 @@
-Gx_lKQ!0…jüo3BÓ˜ðèFLkSystem.StringL{6f9dac99-8de1-4efc-8465-68ac443b7d08}SpecialFuncL{0db3d7bb-cde0-4416-9a7b-ce49a0124323}NoneImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocument	L{f3878285-8e4f-490b-bb1b-9acbb7eb04db}
-TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}Id
longTagText// Componentsn_MQTT.IASyncPropertyProvider( IASyncPropertyProvider );b_MQTT.ITLSContextProvider( ITLSContextProvider );_MQTT();¸Connected := (NOT _MQTT.ClientError() AND NOT _MQTT.IsConnecting() AND _MQTT.IsConnected());T_SparkplugB( AllmetricsList := _Metrics );HIF _MQTT.STATEMessageReceived() THENž    _RecvSTATEMesg := _MQTT.GetSTATEMessage( MessageTopic => _RecvSTATETopic );Z    onSTATEMessage( Topic := _RecvSTATETopic,`                    Message := _RecvSTATEMesg );END_IFFIF _MQTT.NCMDMessageReceived() THENœ    _RecvNCMDMesg REF= _MQTT.GetNCMDMessage( MessageTopic => _RecvNCMDTopic );f    onNCMDMessage( pTopic := ADR( _RecvNCMDTopic ),Z                   pMessage := _RecvNCMDMesg, R                   Rebirth => _Rebirth );!v_ExponentialBackOff( Enable := (Connect AND NOT Connected),"n                     ConnectionTime := _ConnectionTime,#n                     LockTimesArray := _LockTimesArray,$R                     Enabled => _Enabled,%v                     OutTimeRemaining => _OutTimeRemaining,&~                     LockTimeRemaining => _LockTimeRemaining );'d_StateMachine( Connect := _ExponentialBackOff.out,(R               EoNConnected := Connected,)F               ReBirth := _Rebirth,*l               TimeToWait := TO_TIME( publishPeriod ),+J               pMQTT := ADR( _MQTT ),,b               pSparkplugB := ADR( _SparkplugB ),-8               pEoN := THIS,.X               SessionState => SessionState,/T               AllMetricsList := _Metrics,0P               DeviceList := _Devices );1$_Rebirth := FALSE;2V// update current number of plugged devices3JNumberOfDevices := _Devices.ListSize;4Diag();5Interface6L{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}7(*80    Edge of Network Node9Ö    Allows you to bidirectionally share sparkplug data from the edge of your network to a Primary Host Node:*);0{attribute 'reflection'}<\FUNCTION_BLOCK PUBLIC FB_Edge IMPLEMENTS IEdge=VAR_INPUT>€    ServerUrl     : STRING;          // eg:'test.mosquitto.org';?`    ServerPort    : UINT    := 1883; // eg: 1883@~    PrimaryHostID : WSTRING := "";   // eg:'PrimaryHostNode';  Aˆ    KeepAlive     : UINT    := 60;   // eg: 60 (Value is in seconds)BV    // Persistent Session (FALSE = DEFAULT)C°    //  * The client must get all messages from a certain topic, even if it is offline. Dò    //  * You want the broker to queue the messages for the client and deliver them as soon as the client is back online.EX    //  * The client has limited resources. Fˆ    //  * You want the broker to store the subscription information of the client and restore the interrupted communication quickly.GÈ    //  * The client needs to reNumberOfMetricse all QoS 1 and 2 publish messages after a reconnect.H    //  I8    //  Clean session (TRUE)Jà    //  * The client needs only to publish messages to topics, the client does not need to subscribe to topics. KÞ    //  * You don t want the broker to store session information or retry transmission of QoS 1 and 2 messages.L–    //  * The client does not need to get messages that it misses offline. M    //NH    CleanSession : BOOL    := FALSE;O’    Username     : WSTRING := ""; // specify a username if any (optional)Pª    Password     : WSTRING := ""; // specify the password for the username (optional)Q”    UseTLS       : BOOL; // Enables usage of the TLS encryption (optional)Rô    hCert        : SysTypes.RTS_IEC_HANDLE; // Handle to the client certificate (optional) and only used if UseTLS is TRUESx    GroupId             : WSTRING; // eg: "SparkplugBDevice"T`    NodeName            : WSTRING; // eg: "EoN1"UŒ    publishPeriod       : UINT; // eg: 5000 (Value is in milliseconds)Vö    ITLSContextProvider : MQTT.NBS.ITLSContext; //Encapsulates all the data neccessaray to handle encrypted tcp connectionsWˆ    //Static initialization, as shown in the following code snippet;X    //VARYV    //    commonName : STRING := 'MyRasPi';Z¸    //    ciCertInfo : NBS.CERT_INFO := (psInfo:=ADR(commonName), udiSize:=LEN(commonName));[X    //    myTLSContext : NBS.TLSContext := (\`    //        ePurpose:=NBS.PURPOSE.CLIENT_SIDE,]L    //        sUseCaseName:='NBSTest',^B    //        sTLSVersion:='1.3',_J    //        ciCertInfo:=ciCertInfo,`H    //        udiVerificationMode:=2a    //    );b    //END_VARcœ    IASyncPropertyProvider : 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) dEND_VAReVAR_OUTPUTf6    Connected       : BOOL;g`    SessionState    : SparkplugSessionStateType;h,	{attribute 'no_copy'}iJ    itfEdge         : IEdge := THIS^;j8    NumberOfDevices : UDINT;kVARl    Connect  : BOOL := TRUE; // TRUE: Connects EoN using the configured settings, FALSE: Disconnects EoN from server if it was connectedm:    _Enabled          : BOOL;n:    _Rebirth          : BOOL;oL    _ConnectionTime   : TIME := T#30S;p¤    _LockTimesArray   : ARRAY[1..8] OF TIME := [4(TIME#30S0MS), 2(TIME#1M0S0MS), TIME#2M0S0MS, TIME#4M0S0MS]; // could be made accessible public  q¢    _OutTimeRemaining     : TIME; // Duration of Out Time Period = TRUE remainingr¤    _LockTimeRemaining    : TIME; // Duration of Out Time Period = FALSE remainingsÄ    _ExponentialBackOff   : FB_ExponentialBackOffTimer; // Handles the Exponential Backoff ttimingt`    _StateMachine         : FB_EdgeStateMachine;ub    _TopicProvider        : FB_EdgeTopicProvider;vV    _NodeControl          : FB_NodeControl;w´    _cPrimaryHostID       : WSTRING; // Corrected PrimaryHostID, contains no illegal charsx¨    _cGroupId             : WSTRING; // Corrected GroupId, contains no illegal charsyª    _cNodeName            : WSTRING; // Corrected NodeName, contains no illegal charszP    _MQTT                 : FB_EdgeMQTT;{X    _MQTT_eError          : MQTT.MQTT_ERROR;|˜    _SparkplugB           : FB_SparkplugBSimple; // Handles SparkPlugB Stuff}„    _Devices              : List; // Handles all connected Devices~D    _prevNumberOfDevices  : UDINT;J    _ItfCurElement        : IElement;€D    _DeviceCnt            : UDINT;Z    _ItfCurDevice         : ISparkplugDevice;‚B    _HasItfDevice         : BOOL;ƒØ    _Metrics              : LIST; // Complete List Of All Metrics That Will ever be Sent, needed for NBIRTH „ˆ    _ChangeList           : LIST; // The Send list; Needed for NDATA…B    _Initialise           : BOOL;†B    _Disconnect           : BOOL;‡B    _Initialised          : BOOL;ˆB    _Reset                : BOOL;‰B    _SubscribeNCMD        : BOOL;ŠB    _UnSubscribeNCMD      : BOOL;‹B    _NodeBirthPublished   : BOOL;ŒB    _PublishNodeDataStart : BOOL;B    _DisablePublisher     : BOOL;Ž–    _LastWillTopic        : WSTRING(GC_Sparkplug.supported_string_lengths);¨    _NDEATH               : FB_RemoteMetric;    // contains the current NDEATH BDSeq¾    _NDEATHPayload        : ARRAY[0..255] OF BYTE; // what is the maximum size of this payload?‘D    _NDEATHPayloadSize    : UDINT;’€    _LastWillQos          : MQTT.MQTT_QOS := MQTT.MQTT_QOS.QoS0;“T    _LastWillRetain       : BOOL := FALSE;”¶    _NBIRTH               : FB_SparkplugUInt64;      // contains the current raw NBIRTH seq•¦    _Blob                 : ARRAY[0..65535] OF BYTE; // buffer for encoded messages–¨    _BlobSize             : UDINT;                   // current encoded message size—T    _NDATAEncoderPrepared : BOOL := FALSE;˜B    _PublishNDATA         : BOOL;™B    _ErrorDetected        : BOOL;šD    _ChangeError          : ERROR;›ä    _ChangeDetected       : BOOL;  // At least 1 Signal change has been detected; RBE needed next PublishInterval œÊ    _CurrentChanges       : UDINT; // Number of detected changes, each changes reflects 1 Signal     d    _MessageType          : SparkplugMessageTypes;žF    _RecvSTATEMesg        : STRING;Ÿ–    _RecvSTATETopic       : WSTRING(GC_Sparkplug.supported_string_lengths); ‚    _RecvNCMDMesg         : REFERENCE TO FB_PayloadSimpleDecoder;¡–    _RecvNCMDTopic        : WSTRING(GC_Sparkplug.supported_string_lengths);¢F    _Diag                 : STRING;£>    {attribute 'instance-path'}¤0    {attribute 'noinit'}¥$    _POU : STRING;¦"UniqueIdGenerator§
+Gx_l•Q!0…jüo}BŽBâ,ðèFLkSystem.StringL{6f9dac99-8de1-4efc-8465-68ac443b7d08}SpecialFuncL{0db3d7bb-cde0-4416-9a7b-ce49a0124323}NoneImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocument	L{f3878285-8e4f-490b-bb1b-9acbb7eb04db}
+TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}Id
longTagText// Componentsn_MQTT.IASyncPropertyProvider( IASyncPropertyProvider );b_MQTT.ITLSContextProvider( ITLSContextProvider );_MQTT();¸Connected := (NOT _MQTT.ClientError() AND NOT _MQTT.IsConnecting() AND _MQTT.IsConnected());T_SparkplugB( AllmetricsList := _Metrics );HIF _MQTT.STATEMessageReceived() THENž    _RecvSTATEMesg := _MQTT.GetSTATEMessage( MessageTopic => _RecvSTATETopic );Z    onSTATEMessage( Topic := _RecvSTATETopic,`                    Message := _RecvSTATEMesg );END_IFFIF _MQTT.NCMDMessageReceived() THENœ    _RecvNCMDMesg REF= _MQTT.GetNCMDMessage( MessageTopic => _RecvNCMDTopic );f    onNCMDMessage( pTopic := ADR( _RecvNCMDTopic ),Z                   pMessage := _RecvNCMDMesg, R                   Rebirth => _Rebirth );!v_ExponentialBackOff( Enable := (Connect AND NOT Connected),"n                     ConnectionTime := _ConnectionTime,#n                     LockTimesArray := _LockTimesArray,$R                     Enabled => _Enabled,%v                     OutTimeRemaining => _OutTimeRemaining,&~                     LockTimeRemaining => _LockTimeRemaining );'d_StateMachine( Connect := _ExponentialBackOff.out,(R               EoNConnected := Connected,)F               ReBirth := _Rebirth,*l               TimeToWait := TO_TIME( publishPeriod ),+J               pMQTT := ADR( _MQTT ),,b               pSparkplugB := ADR( _SparkplugB ),-8               pEoN := THIS,.X               SessionState => SessionState,/T               AllMetricsList := _Metrics,0P               DeviceList := _Devices );1$_Rebirth := FALSE;2V// update current number of plugged devices3JNumberOfDevices := _Devices.ListSize;4Diag();5Interface6L{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}7(*80    Edge of Network Node9Ö    Allows you to bidirectionally share sparkplug data from the edge of your network to a Primary Host Node:*);0{attribute 'reflection'}<\FUNCTION_BLOCK PUBLIC FB_Edge IMPLEMENTS IEdge=VAR_INPUT>€    ServerUrl     : STRING;          // eg:'test.mosquitto.org';?`    ServerPort    : UINT    := 1883; // eg: 1883@~    PrimaryHostID : WSTRING := "";   // eg:'PrimaryHostNode';  Aˆ    KeepAlive     : UINT    := 60;   // eg: 60 (Value is in seconds)BV    // Persistent Session (FALSE = DEFAULT)C°    //  * The client must get all messages from a certain topic, even if it is offline. Dò    //  * You want the broker to queue the messages for the client and deliver them as soon as the client is back online.EX    //  * The client has limited resources. Fˆ    //  * You want the broker to store the subscription information of the client and restore the interrupted communication quickly.GÈ    //  * The client needs to reNumberOfMetricse all QoS 1 and 2 publish messages after a reconnect.H    //  I8    //  Clean session (TRUE)Jà    //  * The client needs only to publish messages to topics, the client does not need to subscribe to topics. KÞ    //  * You don t want the broker to store session information or retry transmission of QoS 1 and 2 messages.L–    //  * The client does not need to get messages that it misses offline. M    //NH    CleanSession : BOOL    := FALSE;O’    Username     : WSTRING := ""; // specify a username if any (optional)Pª    Password     : WSTRING := ""; // specify the password for the username (optional)Q”    UseTLS       : BOOL; // Enables usage of the TLS encryption (optional)Rô    hCert        : SysTypes.RTS_IEC_HANDLE; // Handle to the client certificate (optional) and only used if UseTLS is TRUESx    GroupId             : WSTRING; // eg: "SparkplugBDevice"T`    NodeName            : WSTRING; // eg: "EoN1"UŒ    publishPeriod       : UINT; // eg: 5000 (Value is in milliseconds)Vö    ITLSContextProvider : MQTT.NBS.ITLSContext; //Encapsulates all the data neccessaray to handle encrypted tcp connectionsWˆ    //Static initialization, as shown in the following code snippet;X    //VARYV    //    commonName : STRING := 'MyRasPi';Z¸    //    ciCertInfo : NBS.CERT_INFO := (psInfo:=ADR(commonName), udiSize:=LEN(commonName));[X    //    myTLSContext : NBS.TLSContext := (\`    //        ePurpose:=NBS.PURPOSE.CLIENT_SIDE,]L    //        sUseCaseName:='NBSTest',^B    //        sTLSVersion:='1.3',_J    //        ciCertInfo:=ciCertInfo,`H    //        udiVerificationMode:=2a    //    );b    //END_VARcœ    IASyncPropertyProvider : 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) dEND_VAReVAR_OUTPUTf6    Connected       : BOOL;g`    SessionState    : SparkplugSessionStateType;h,	{attribute 'no_copy'}iJ    itfEdge         : IEdge := THIS^;j8    NumberOfDevices : UDINT;kVARl    Connect  : BOOL := TRUE; // TRUE: Connects EoN using the configured settings, FALSE: Disconnects EoN from server if it was connectedm:    _Enabled          : BOOL;n:    _Rebirth          : BOOL;oL    _ConnectionTime   : TIME := T#30S;p¤    _LockTimesArray   : ARRAY[1..8] OF TIME := [4(TIME#30S0MS), 2(TIME#1M0S0MS), TIME#2M0S0MS, TIME#4M0S0MS]; // could be made accessible public  q¢    _OutTimeRemaining     : TIME; // Duration of Out Time Period = TRUE remainingr¤    _LockTimeRemaining    : TIME; // Duration of Out Time Period = FALSE remainingsÄ    _ExponentialBackOff   : FB_ExponentialBackOffTimer; // Handles the Exponential Backoff ttimingt`    _StateMachine         : FB_EdgeStateMachine;ub    _TopicProvider        : FB_EdgeTopicProvider;vV    _NodeControl          : FB_NodeControl;w´    _cPrimaryHostID       : WSTRING; // Corrected PrimaryHostID, contains no illegal charsx¨    _cGroupId             : WSTRING; // Corrected GroupId, contains no illegal charsyª    _cNodeName            : WSTRING; // Corrected NodeName, contains no illegal charszP    _MQTT                 : FB_EdgeMQTT;{X    _MQTT_eError          : MQTT.MQTT_ERROR;|˜    _SparkplugB           : FB_SparkplugBSimple; // Handles SparkPlugB Stuff}„    _Devices              : List; // Handles all connected Devices~D    _prevNumberOfDevices  : UDINT;J    _ItfCurElement        : IElement;€D    _DeviceCnt            : UDINT;Z    _ItfCurDevice         : ISparkplugDevice;‚B    _HasItfDevice         : BOOL;ƒØ    _Metrics              : LIST; // Complete List Of All Metrics That Will ever be Sent, needed for NBIRTH „ˆ    _ChangeList           : LIST; // The Send list; Needed for NDATA…B    _Initialise           : BOOL;†B    _Disconnect           : BOOL;‡B    _Initialised          : BOOL;ˆB    _Reset                : BOOL;‰B    _SubscribeNCMD        : BOOL;ŠB    _UnSubscribeNCMD      : BOOL;‹B    _NodeBirthPublished   : BOOL;ŒB    _PublishNodeDataStart : BOOL;B    _DisablePublisher     : BOOL;Ž–    _LastWillTopic        : WSTRING(GC_Sparkplug.supported_string_lengths);¨    _NDEATH               : FB_RemoteMetric;    // contains the current NDEATH BDSeq¾    _NDEATHPayload        : ARRAY[0..255] OF BYTE; // what is the maximum size of this payload?‘D    _NDEATHPayloadSize    : UDINT;’€    _LastWillQos          : MQTT.MQTT_QOS := MQTT.MQTT_QOS.QoS0;“T    _LastWillRetain       : BOOL := FALSE;”€    _NBIRTH               : FB_RemoteMetric := (_dataType := MetricDataType.UInt64);      // contains the current raw NBIRTH seq•¦    _Blob                 : ARRAY[0..65535] OF BYTE; // buffer for encoded messages–¨    _BlobSize             : UDINT;                   // current encoded message size—T    _NDATAEncoderPrepared : BOOL := FALSE;˜B    _PublishNDATA         : BOOL;™B    _ErrorDetected        : BOOL;šD    _ChangeError          : ERROR;›ä    _ChangeDetected       : BOOL;  // At least 1 Signal change has been detected; RBE needed next PublishInterval œÊ    _CurrentChanges       : UDINT; // Number of detected changes, each changes reflects 1 Signal     d    _MessageType          : SparkplugMessageTypes;žF    _RecvSTATEMesg        : STRING;Ÿ–    _RecvSTATETopic       : WSTRING(GC_Sparkplug.supported_string_lengths); ‚    _RecvNCMDMesg         : REFERENCE TO FB_PayloadSimpleDecoder;¡–    _RecvNCMDTopic        : WSTRING(GC_Sparkplug.supported_string_lengths);¢F    _Diag                 : STRING;£>    {attribute 'instance-path'}¤0    {attribute 'noinit'}¥$    _POU : STRING;¦"UniqueIdGenerator§
 15662¨POULevel©L{8e575c5b-1d37-49c6-941b-5c0ec7874787}ªStandard« ChildObjectGuids¬8System.Collections.ArrayList­,AddAttributeSubsequent®boolÐÐ-ÐÐ	E
 )ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­	=ÚÐ-ÐÐ
­
 =ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­
=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ- ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-ÐÐ
­=ÚÐ-!ÐÐ
­=ÚÐ-"ÐÐ
­=ÚÐ-#ÐÐ
­=ÚÐ-$ÐÐ
­=ÚÐ-%ÐÐ
­=ÚÐ-&ÐÐ
­ =ÚÐ-ÐÐ
­!=ÚÐ-'ÐÐ
­"=ÚÐ-(ÐÐ
­#=ÚÐ-)ÐÐ
­$=ÚÐ-*ÐÐ
­%=ÚÐ-+ÐÐ
­&=ÚÐ-,ÐÐ
­'=ÚÐ--ÐÐ
­(=ÚÐ-.ÐÐ
­)=ÚÐ-/ÐÐ
­*=ÚÐ-0ÐÐ
­+=ÚÐ-ÐÐ
­,=ÚÐ-1ÐÐ
­-=ÚÐ-2ÐÐ
­.=ÚÐ-3ÐÐ
­ÃÚÐ-4Ð56Ð	E