--- a/branches/FeatureBranches/refactorpayload/SparkplugB/Function Blocks/FB_Edge/FB_Edge/NCMD/onNCMDMessage/svnobj
+++ b/branches/FeatureBranches/refactorpayload/SparkplugB/Function Blocks/FB_Edge/FB_Edge/NCMD/onNCMDMessage/svnobj
@@ -1,8 +1,8 @@
-Gx_ll8!0…jüoŚ*«¤j
Š¸Z–System.StringL{f8a58466-d7f6-439f-bbb8-d4600e41d099}ImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocumentL{f3878285-8e4f-490b-bb1b-9acbb7eb04db}TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}	Id
-longTagText
F//note: pMessage is already decoded.onNCMDMessage := FALSE;*// //get first metricRpMessage.GetFirstMetric( name => newName,\	                     datatype => newdatatype,B						 timestamp => newtimestamp,@						 valueString => newString,<						 valueLreal => newLreal,8						 valueReal => newreal,@						 valueVarInt => newVarInt,J						 MetricValid => newMetricValid,<						 HasNext => newHasNext);2                         LTHIS^.GetMetricbyName( DeviceId:= "", Z                       MetricName:= newName, f                       Metric=> itfExistingMetric, N                       GetTimestamp=> ,f                       xError=> MetricNotExisting, D                       eError=> ); .                       !2IF MetricNotExisting THEN"&    xError := TRUE;#f    eError := Error.OhMy_ThatShouldNotHaveHappened;$~    WriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),%Ø                    'PrimaryHost ProcessNDATA MetricNotExisting but haven$'t implemeneted NCMD/Rebirth: %s',&˜                    TO_STRING( Error.OhMy_ThatShouldNotHaveHappened ) );    'ELSE(J	// update one as it allready excists)P    Update( Metric := itfExistingMetric,*8            Name := newName,+H            DataType := newdatatype,,Z            Status := MetricStatus.ONLINE_OK,-L            Timestamp := newtimestamp,.B            String_ := newString,/@            LReal_ :=  newLreal,0:            Real_ := newreal,1F            VarInt :=  newVarInt );2END_IF34&WHILE newHasNext DO5R	pMessage.GetNextMetric( name => newName,6h                            datatype => newdatatype,7l                            timestamp => newtimestamp,8j                            valueString => newString,9f                            valueLreal => newLreal,:b                            valueReal => newreal,;j                            valueVarInt => newVarInt,<t                            MetricValid => newMetricValid,=f                            HasNext => newHasNext);>8                            ?P	THIS^.GetMetricbyName( DeviceId := "", @d                           MetricName := newName, Ap                           Metric => itfExistingMetric, BV                           GetTimestamp=> ,C`						   xError=> MetricNotExisting, eError=> );D6                           E4	IF MetricNotExisting THENF.        xError := TRUE;Gn        eError := Error.OhMy_ThatShouldNotHaveHappened;H†        WriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),Ià                        'PrimaryHost ProcessNDATA MetricNotExisting but haven$'t implemeneted NCMD/Rebirth: %s',J˜                        TO_STRING( Error.OhMy_ThatShouldNotHaveHappened ) );K
-	ELSEL		//update oneMX        Update( Metric := itfExistingMetric,N@                Name := newName,OP                DataType := newdatatype,Pb                Status := MetricStatus.ONLINE_OK,QT                Timestamp := newtimestamp,RJ                String_ := newString,SH                LReal_ :=  newLreal,TB                Real_ := newreal,UN                VarInt :=  newVarInt );V                 W	END_IFXEND_WHILEYvWriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),Z\                'EoN NCMD Received Topic: %s',[^                WSTRING_TO_STRING( pTopic^ ) );\,onNCMDMessage := TRUE;]Interface^L{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}_(*` 	At the moment, this only supports the one specific metric, Node Control/Rebirtha.    Node Command (NCMD)b    cÊ    NCMD messages are used by backend applications to write to EoN node outputs and send Node Controldª    commands to EoN nodes. Multiple metrics can be supplied in a single NCMD message.e˜    The following is a representation of a simple NCMD message on the topic:fl        spBv1.0/Sparkplug"! B Devices/NCMD/Raspberry Pig„        "    The  Group ID  of this device is: Sparkplug"! B Deviceshˆ        "    The host  EoN node ID  of this EoN node is: Raspberry Piid        "    This is an NCMD message to an EoN nodej     Consider the following Sparkplug"! B payload in the NCMD message shown above:k
-    {lF        "timestamp": 1486144502122,m*        "metrics": [{n^                "name": "Node Control/Rebirth",oV                "timestamp": 1486144502122,pL                "dataType": "Boolean",q:                "value": truer         }]s
-    }tâ    This NCMD payload tells the EoN node to republish its NBIRTH and DBIRTH(s) messages. This can be requested ifuä    a backend application gets an out of order seq number or if a metric arrives in an NDATA or DDATA message thatv~    was not provided in the original NBIRTH or DBIRTH messages.w*)x${attribute 'hide'}y6METHOD onNCMDMessage : BOOLzVAR_INPUT{‚    pTopic : POINTER TO WSTRING(GC_Sparkplug.supported_string_lengths); // resembles the topic under which the message is posted |END_VAR}VAR_IN_OUT~†    pMessage : FB_PayloadSimpleDecoder; //should already be decodedVAR_OUTPUT€8    Rebirth : BOOL := FALSE; 	xError  : BOOL;‚"	eError  : ERROR;ƒVAR„Ž    newName           : WSTRING(GC_Sparkplug.supported_string_lengths);…@    newMetricValid       : BOOL;†<    newVarInt : DecodedVarInt;‡0    newString : WSTRING;ˆ,    newLreal  : LREAL;‰*    newreal   : REAL;Š@    newHasNext           : BOOL;‹T    newdatatype          : MetricDataType;ŒF	newtimestamp         : T_DateTime;:    i                 : DINT;Ž	F	itfExistingMetric : IRemoteMetric;4	MetricNotExisting : BOOL;ĞĞĞERĞĞ	
+Gx_l™6!0…jüo9)$Ƶ8
U fSystem.StringL{f8a58466-d7f6-439f-bbb8-d4600e41d099}ImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocumentL{f3878285-8e4f-490b-bb1b-9acbb7eb04db}TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}	Id
+longTagText
F//note: pMessage is already decoded.onNCMDMessage := FALSE;*// //get first metricRpMessage.GetFirstMetric( name => newName,\	                     datatype => newdatatype,B						 timestamp => newtimestamp,@						 valueString => newString,<						 valueLreal => newLreal,8						 valueReal => newreal,@						 valueVarInt => newVarInt,J						 MetricValid => newMetricValid,<						 HasNext => newHasNext);2                         LTHIS^.GetMetricbyName( DeviceId:= "", Z                       MetricName:= newName, f                       Metric=> itfExistingMetric, N                       GetTimestamp=> ,f                       xError=> MetricNotExisting, D                       eError=> ); .                       !4IF NOT newMetricValid THEN"j	; // There are no metrics, so we needn't do anything#8ELSIF MetricNotExisting THEN$~    WriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),%º                    'Someone sent an NCMD with metric %s not in our NBIRTH.  It was ignored',&R                    TO_STRING(newName) );'ELSE(J	// update one as it allready excists)P    Update( Metric := itfExistingMetric,*8            Name := newName,+H            DataType := newdatatype,,Z            Status := MetricStatus.ONLINE_OK,-L            Timestamp := newtimestamp,.B            String_ := newString,/@            LReal_ :=  newLreal,0:            Real_ := newreal,1F            VarInt :=  newVarInt );2END_IF34&WHILE newHasNext DO5R	pMessage.GetNextMetric( name => newName,6h                            datatype => newdatatype,7l                            timestamp => newtimestamp,8j                            valueString => newString,9f                            valueLreal => newLreal,:b                            valueReal => newreal,;j                            valueVarInt => newVarInt,<t                            MetricValid => newMetricValid,=f                            HasNext => newHasNext);>8                            ?P	THIS^.GetMetricbyName( DeviceId := "", @d                           MetricName := newName, Ap                           Metric => itfExistingMetric, BV                           GetTimestamp=> ,C`						   xError=> MetricNotExisting, eError=> );D6                           E4	IF MetricNotExisting THENFz		WriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),Gž						'Someone sent an NCMD with metric %s not in our NBIRTH.  It was ignored',H6						TO_STRING(newName) );I
+	ELSEJ		//update oneKX        Update( Metric := itfExistingMetric,L@                Name := newName,MP                DataType := newdatatype,Nb                Status := MetricStatus.ONLINE_OK,OT                Timestamp := newtimestamp,PJ                String_ := newString,QH                LReal_ :=  newLreal,RB                Real_ := newreal,SN                VarInt :=  newVarInt );T                 U	END_IFVEND_WHILEWvWriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),X\                'EoN NCMD Received Topic: %s',Y^                WSTRING_TO_STRING( pTopic^ ) );Z,onNCMDMessage := TRUE;[Interface\L{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}](*^ 	At the moment, this only supports the one specific metric, Node Control/Rebirth_.    Node Command (NCMD)`    aÊ    NCMD messages are used by backend applications to write to EoN node outputs and send Node Controlbª    commands to EoN nodes. Multiple metrics can be supplied in a single NCMD message.c˜    The following is a representation of a simple NCMD message on the topic:dl        spBv1.0/Sparkplug"! B Devices/NCMD/Raspberry Pie„        "    The  Group ID  of this device is: Sparkplug"! B Devicesfˆ        "    The host  EoN node ID  of this EoN node is: Raspberry Pigd        "    This is an NCMD message to an EoN nodeh     Consider the following Sparkplug"! B payload in the NCMD message shown above:i
+    {jF        "timestamp": 1486144502122,k*        "metrics": [{l^                "name": "Node Control/Rebirth",mV                "timestamp": 1486144502122,nL                "dataType": "Boolean",o:                "value": truep         }]q
+    }râ    This NCMD payload tells the EoN node to republish its NBIRTH and DBIRTH(s) messages. This can be requested ifsä    a backend application gets an out of order seq number or if a metric arrives in an NDATA or DDATA message thatt~    was not provided in the original NBIRTH or DBIRTH messages.u*)v${attribute 'hide'}w6METHOD onNCMDMessage : BOOLxVAR_INPUTy‚    pTopic : POINTER TO WSTRING(GC_Sparkplug.supported_string_lengths); // resembles the topic under which the message is posted zEND_VAR{VAR_IN_OUT|†    pMessage : FB_PayloadSimpleDecoder; //should already be decoded}VAR_OUTPUT~8    Rebirth : BOOL := FALSE; 	xError  : BOOL;€"	eError  : ERROR;VAR‚Ž    newName           : WSTRING(GC_Sparkplug.supported_string_lengths);ƒ@    newMetricValid       : BOOL;„<    newVarInt : DecodedVarInt;…0    newString : WSTRING;†,    newLreal  : LREAL;‡*    newreal   : REAL;ˆ@    newHasNext           : BOOL;‰T    newdatatype          : MetricDataType;ŠF	newtimestamp         : T_DateTime;‹:    i                 : DINT;Œ	F	itfExistingMetric : IRemoteMetric;Ž4	MetricNotExisting : BOOL;ÐÐÐEPÐÐ	
 ­UÚÐ-
ÐÐ	
 ­VÚÐ-ÐÐ	
 ­WÚÐ-ÐÐ	
@@ -14,18 +14,18 @@
 ­KÚÐ-ÐÐ	
 ­LÚÐ-ÐÐ	
 ­MÚÐ-ÐÐ	
-­NÚÐ-ÐÐ	
-­OÚÐ-ÐÐ	
-­PÚÐ-ÐÐ	
-­QÚÐ-ÐÐ	
-­RÚÐ-ÐÐ	
-­SÚÐ-ÐÐ	
-­TÚÐ-ÐÐ	
-­UÚÐ-ÐÐ	
+­žÚÐ-ÐÐ	
+­ŸÚÐ-ÐÐ	
+­ ÚÐ-ÐÐ	
+­¡ÚÐ-ÐÐ	
+­¢ÚÐ-ÐÐ	
+­£ÚÐ-ÐÐ	
+­¤ÚÐ-ÐÐ	
+­NÚÐ-ÐÐ	
 ­VÚÐ- ÐÐ	
-­WÚÐ-!ÐÐ	
-­XÚÐ-"ÐÐ	
-­YÚÐ-#ÐÐ	
+­œÚÐ-!ÐÐ	
+­ÚÐ-"ÐÐ	
+­WÚÐ-#ÐÐ	
 ­ZÚÐ-$ÐÐ	
 ­[ÚÐ-%ÐÐ	
 ­\ÚÐ-&ÐÐ	
@@ -59,88 +59,86 @@
 ­xÚÐ-BÐÐ	
 ­yÚÐ-CÐÐ	
 ­zÚÐ-DÐÐ	
-­{ÚÐ-EÐÐ	
-­|ÚÐ-FÐÐ	
-­}ÚÐ-GÐÐ	
-­~ÚÐ-HÐÐ	
-­ÚÐ-IÐÐ	
-­€ÚÐ-JÐÐ	
-­ÚÐ-KÐÐ	
-­‚ÚÐ-LÐÐ	
-­ƒÚÐ-MÐÐ	
-­„ÚÐ-NÐÐ	
-­…ÚÐ-OÐÐ	
-­†ÚÐ-PÐÐ	
-­‡ÚÐ-QÐÐ	
-­ˆÚÐ-RÐÐ	
-­‰ÚÐ-SÐÐ	
-­ŠÚÐ-TÐÐ	
-­‹ÚÐ-UÐÐ	
-­ŒÚÐ-VÐÐ	
-­ÚÐ-WÐÐ	
-­:ÚÐ-XÐÐ	
+­¥ÚÐ-EÐÐ	
+­¦ÚÐ-FÐÐ	
+­§ÚÐ-GÐÐ	
+­¨ÚÐ-HÐÐ	
+­ÚÐ-IÐÐ	
+­‚ÚÐ-JÐÐ	
+­ƒÚÐ-KÐÐ	
+­„ÚÐ-LÐÐ	
+­…ÚÐ-MÐÐ	
+­†ÚÐ-NÐÐ	
+­‡ÚÐ-OÐÐ	
+­ˆÚÐ-PÐÐ	
+­‰ÚÐ-QÐÐ	
+­ŠÚÐ-RÐÐ	
+­‹ÚÐ-SÐÐ	
+­ŒÚÐ-TÐÐ	
+­ÚÐ-UÐÐ	
+­:ÚÐ-VÐÐ	
 ­•ÚÐ-3ÐÐ	
-­–ÚÐ-YÐÐ	
-­—ÚÐ-ZÐÐ	
-­˜ÚÐ-[ÐÐ	
+­–ÚÐ-WÐÐ	
+­—ÚÐ-XÐÐ	
+­˜ÚÐ-YÐÐ	
 ­™ÚÐ-3ÐÐ	
-­”ÚÐ-\Ð]^ÐE;ÐÐ	
-­!ÚÐ-_ÐÐ	
-­"ÚÐ-`ÐÐ	
-­#ÚÐ-aÐÐ	
-­$ÚÐ-bÐÐ	
-­%ÚÐ-cÐÐ	
-­&ÚÐ-dÐÐ	
-­'ÚÐ-eÐÐ	
+­”ÚÐ-ZÐ[\ÐE;ÐÐ	
+­!ÚÐ-]ÐÐ	
+­"ÚÐ-^ÐÐ	
+­#ÚÐ-_ÐÐ	
+­$ÚÐ-`ÐÐ	
+­%ÚÐ-aÐÐ	
+­&ÚÐ-bÐÐ	
+­'ÚÐ-cÐÐ	
 ­(ÚÐ-3ÐÐ	
-­)ÚÐ-fÐÐ	
+­)ÚÐ-dÐÐ	
 ­*ÚÐ-3ÐÐ	
-­+ÚÐ-gÐÐ	
-­,ÚÐ-hÐÐ	
-­-ÚÐ-iÐÐ	
+­+ÚÐ-eÐÐ	
+­,ÚÐ-fÐÐ	
+­-ÚÐ-gÐÐ	
 ­.ÚÐ-3ÐÐ	
-­/ÚÐ-jÐÐ	
-­0ÚÐ-bÐÐ	
-­1ÚÐ-kÐÐ	
-­2ÚÐ-lÐÐ	
-­3ÚÐ-mÐÐ	
-­4ÚÐ-nÐÐ	
-­5ÚÐ-oÐÐ	
-­6ÚÐ-pÐÐ	
-­7ÚÐ-qÐÐ	
-­8ÚÐ-rÐÐ	
-­9ÚÐ-sÐÐ	
-­:ÚÐ-bÐÐ	
-­;ÚÐ-tÐÐ	
-­<ÚÐ-uÐÐ	
-­=ÚÐ-vÐÐ	
+­/ÚÐ-hÐÐ	
+­0ÚÐ-`ÐÐ	
+­1ÚÐ-iÐÐ	
+­2ÚÐ-jÐÐ	
+­3ÚÐ-kÐÐ	
+­4ÚÐ-lÐÐ	
+­5ÚÐ-mÐÐ	
+­6ÚÐ-nÐÐ	
+­7ÚÐ-oÐÐ	
+­8ÚÐ-pÐÐ	
+­9ÚÐ-qÐÐ	
+­:ÚÐ-`ÐÐ	
+­;ÚÐ-rÐÐ	
+­<ÚÐ-sÐÐ	
+­=ÚÐ-tÐÐ	
 ­>ÚÐ-3ÐÐ	
-­?ÚÐ-wÐÐ	
-­@ÚÐ-xÐÐ	
-­AÚÐ-yÐÐ	
-­BÚÐ-zÐÐ	
-­CÚÐ-{ÐÐ	
-­DÚÐ-|ÐÐ	
-­EÚÐ-}ÐÐ	
-­FÚÐ-~ÐÐ	
-­GÚÐ-|ÐÐ	
-­HÚÐ-ÐÐ	
-­IÚÐ-€ÐÐ	
-­’ÚÐ-ÐÐ	
-­“ÚÐ-‚ÐÐ	
-­JÚÐ-|ÐÐ	
-­KÚÐ-ƒÐÐ	
-­LÚÐ-„ÐÐ	
-­MÚÐ-…ÐÐ	
-­NÚÐ-†ÐÐ	
-­OÚÐ-‡ÐÐ	
-­PÚÐ-ˆÐÐ	
-­QÚÐ-‰ÐÐ	
-­RÚÐ-ŠÐÐ	
-­SÚÐ-‹ÐÐ	
-­ŽÚÐ-ŒÐÐ	
-­TÚÐ-ÐÐ	
-­ÚÐ-ŽÐÐ	
-­ÚÐ-ÐÐ	
-­‘ÚÐ-ÐÐ	
-­ÚÐ-|
\ No newline at end of file
+­?ÚÐ-uÐÐ	
+­@ÚÐ-vÐÐ	
+­AÚÐ-wÐÐ	
+­BÚÐ-xÐÐ	
+­CÚÐ-yÐÐ	
+­DÚÐ-zÐÐ	
+­EÚÐ-{ÐÐ	
+­FÚÐ-|ÐÐ	
+­GÚÐ-zÐÐ	
+­HÚÐ-}ÐÐ	
+­IÚÐ-~ÐÐ	
+­’ÚÐ-ÐÐ	
+­“ÚÐ-€ÐÐ	
+­JÚÐ-zÐÐ	
+­KÚÐ-ÐÐ	
+­LÚÐ-‚ÐÐ	
+­MÚÐ-ƒÐÐ	
+­NÚÐ-„ÐÐ	
+­OÚÐ-…ÐÐ	
+­PÚÐ-†ÐÐ	
+­QÚÐ-‡ÐÐ	
+­RÚÐ-ˆÐÐ	
+­SÚÐ-‰ÐÐ	
+­ŽÚÐ-ŠÐÐ	
+­TÚÐ-‹ÐÐ	
+­ÚÐ-ŒÐÐ	
+­ÚÐ-ÐÐ	
+­‘ÚÐ-ŽÐÐ	
+­ÚÐ-z
\ No newline at end of file