a/branches/FeatureBranches/PrimaryHost/SparkplugB/Function Blocks/FB_RemoteEdge/FB_RemoteEdge/ProcessNDATA/svnobj b/branches/FeatureBranches/PrimaryHost/SparkplugB/Function Blocks/FB_RemoteEdge/FB_RemoteEdge/ProcessNDATA/svnobj
1
Gx_l¨5!0…jüov(’DČ­ļ£'õ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
1
Gx_l5!0…jüot([¹­ï£'õ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
2
longTagText
B// 1. pMessage is already decoded¦// 2. For each metric already in the edge try to find it in the NBIRTH.MetricList, ^      // Not Found? => set to Status.NotBirthed.      // Found? => nothingj_Metrics.ItterateRestart(HasNext => existingHasNext);0WHILE existingHasNext DOª  _Metrics.ItterateNext(itfElement => itfExistingElement, HasNext => existingHasNext);: MetricFoundInNDATA := FALSE;€    IF __QUERYINTERFACE(itfExistingElement, itfExistingMetric) THENV      pMessage.GetFirstMetric( name => newName,N                         MetricValid => newMetricValid,@                         HasNext => newHasNext);œ       MetricFoundInNDATA := newMetricValid AND (newName = itfExistingMetric.Name);`    WHILE newHasNext AND NOT MetricFoundInNDATA DOX       pMessage.GetNextMetric(  name => newName,P                            MetricValid => newMetricValid,B                            HasNext => newHasNext);ž          MetricFoundInNDATA := newMetricValid AND (newName = itfExistingMetric.Name);     END_WHILE!   END_IF"> IF NOT MetricFoundInNDATA THEN#l    itfExistingMetric.Status := MetricStatus.NotBirthed;$END_WHILE%|// 3. For each metric in the NDATA, try to find it in the edge&F  // Found? ==> metric.ProcessNDATA'.  // NotFound ==> Error(RpMessage.GetFirstMetric( name => newName,)\                        datatype => newdatatype,*B                   timestamp => newtimestamp,+@                   valueString => newString,,<                 valueLreal => newLreal,-8                 valueReal => newreal,.@                 valueVarInt => newVarInt,/J                 MetricValid => newMetricValid,0<                   HasNext => newHasNext);12                         2LTHIS^.GetMetricbyName( DeviceId:= "", 3Z                       MetricName:= newName, 4f                       Metric=> itfExistingMetric, 5N                       GetTimestamp=> ,6f                       xError=> MetricNotExisting, 7D                       eError=> );8.                       92IF MetricNotExisting THEN:&    xError := TRUE;;f    eError := Error.OhMy_ThatShouldNotHaveHappened;<~    WriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),=Š                    'PrimaryHost ProcessNDATA MetricNotExisting: %s',>˜                    TO_STRING( Error.OhMy_ThatShouldNotHaveHappened ) );    ?ELSE@J   // update one as it allready excistsAP    Update( Metric := itfExistingMetric,B8            Name := newName,CH            DataType := newdatatype,DZ            Status := MetricStatus.ONLINE_OK,EL            Timestamp := newtimestamp,FB            String_ := newString,G@            LReal_ :=  newLreal,H:            Real_ := newreal,IF            VarInt :=  newVarInt );JEND_IFK\WHILE newHasNext AND NOT MetricFoundInNDATA DOLR   pMessage.GetNextMetric( name => newName,Mh                            datatype => newdatatype,Nl                            timestamp => newtimestamp,Oj                            valueString => newString,Pf                            valueLreal => newLreal,Qb                            valueReal => newreal,Rj                            valueVarInt => newVarInt,St                            MetricValid => newMetricValid,Tf                            HasNext => newHasNext);U8                            VP THIS^.GetMetricbyName( DeviceId := "", Wd                           MetricName := newName, Xp                           Metric => itfExistingMetric, YV                           GetTimestamp=> ,Z`                     xError=> MetricNotExisting, eError=> );[6                           \4 IF MetricNotExisting THEN].        xError := TRUE;^n        eError := Error.OhMy_ThatShouldNotHaveHappened;_†        WriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),`’                        'PrimaryHost ProcessNDATA MetricNotExisting: %s',aœ                        TO_STRING( Error.OhMy_ThatShouldNotHaveHappened ) );  b
2
longTagText
B// 1. pMessage is already decoded¤// 2. For each metric already in the edge try to find it in the NDATA.MetricList, ^      // Not Found? => set to Status.NotBirthed.    // Found? => nothingj_Metrics.ItterateRestart(HasNext => existingHasNext);0WHILE existingHasNext DOª  _Metrics.ItterateNext(itfElement => itfExistingElement, HasNext => existingHasNext);: MetricFoundInNDATA := FALSE;€    IF __QUERYINTERFACE(itfExistingElement, itfExistingMetric) THENV      pMessage.GetFirstMetric( name => newName,N                         MetricValid => newMetricValid,@                         HasNext => newHasNext);œ       MetricFoundInNDATA := newMetricValid AND (newName = itfExistingMetric.Name);`    WHILE newHasNext AND NOT MetricFoundInNDATA DOX       pMessage.GetNextMetric(  name => newName,P                            MetricValid => newMetricValid,B                            HasNext => newHasNext);ž          MetricFoundInNDATA := newMetricValid AND (newName = itfExistingMetric.Name);     END_WHILE!   END_IF"> IF NOT MetricFoundInNDATA THEN#l    itfExistingMetric.Status := MetricStatus.NotBirthed;$END_WHILE%|// 3. For each metric in the NDATA, try to find it in the edge&F  // Found? ==> metric.ProcessNDATA'.  // NotFound ==> Error(RpMessage.GetFirstMetric( name => newName,)\                        datatype => newdatatype,*B                   timestamp => newtimestamp,+@                   valueString => newString,,<                 valueLreal => newLreal,-8                 valueReal => newreal,.@                 valueVarInt => newVarInt,/J                 MetricValid => newMetricValid,0<                   HasNext => newHasNext);12                         2LTHIS^.GetMetricbyName( DeviceId:= "", 3Z                       MetricName:= newName, 4f                       Metric=> itfExistingMetric, 5N                       GetTimestamp=> ,6f                       xError=> MetricNotExisting, 7D                       eError=> );8.                       92IF MetricNotExisting THEN:&    xError := TRUE;;f    eError := Error.OhMy_ThatShouldNotHaveHappened;<~    WriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),=Š                    'PrimaryHost ProcessNDATA MetricNotExisting: %s',>˜                    TO_STRING( Error.OhMy_ThatShouldNotHaveHappened ) );    ?ELSE@J   // update one as it allready excistsAP    Update( Metric := itfExistingMetric,B8            Name := newName,CH            DataType := newdatatype,DZ            Status := MetricStatus.ONLINE_OK,EL            Timestamp := newtimestamp,FB            String_ := newString,G@            LReal_ :=  newLreal,H:            Real_ := newreal,IF            VarInt :=  newVarInt );JEND_IFK\WHILE newHasNext AND NOT MetricFoundInNDATA DOLR   pMessage.GetNextMetric( name => newName,Mh                            datatype => newdatatype,Nl                            timestamp => newtimestamp,Oj                            valueString => newString,Pf                            valueLreal => newLreal,Qb                            valueReal => newreal,Rj                            valueVarInt => newVarInt,St                            MetricValid => newMetricValid,Tf                            HasNext => newHasNext);U8                            VP THIS^.GetMetricbyName( DeviceId := "", Wd                           MetricName := newName, Xp                           Metric => itfExistingMetric, YV                           GetTimestamp=> ,Z`                     xError=> MetricNotExisting, eError=> );[6                           \4 IF MetricNotExisting THEN].        xError := TRUE;^n        eError := Error.OhMy_ThatShouldNotHaveHappened;_†        WriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),`’                        'PrimaryHost ProcessNDATA MetricNotExisting: %s',aœ                        TO_STRING( Error.OhMy_ThatShouldNotHaveHappened ) );  b
3
    ELSEc    //update onedX        Update( Metric := itfExistingMetric,e@                Name := newName,fP                DataType := newdatatype,gb                Status := MetricStatus.ONLINE_OK,hT                Timestamp := newtimestamp,iJ                String_ := newString,jH                LReal_ :=  newLreal,kB                Real_ := newreal,lN                VarInt :=  newVarInt );m                 nInterfaceoL{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}p&METHOD ProcessNDATAqVAR_INPUTrD    itfPrimaryHost : IPrimaryHost;sEND_VARtVAR_IN_OUTu‚    pMessage : FB_PayloadSimpleDecoder; // already decoded pleasevVAR_OUTPUTw$    xError : BOOL;x&    eError : Error;yVARz8  existingHasNext     : BOOL;{@   itfExistingElement  : IElement;|J   itfExistingMetric   : IRemoteMetric;}8 MetricNotExisting   : BOOL;~   8 newHasNext          : BOOL;€8  newMetricValid      : BOOL;8  MetricFoundInNDATA  : BOOL;‚>  newName             : WSTRING;ƒL    newdatatype         : MetricDataType;„D  newtimestamp        : T_DateTime;…Œ newString           : WSTRING(gc_sparkplug.supported_string_lengths);†:  newLreal            : LREAL;‡8    newreal             : REAL;ˆJ  newVarInt           : DecodedVarInt;‰b    pPrimaryHost        : POINTER TO FB_PrimaryHost;Šh    AllocdMetric        : REFERENCE TO FB_RemoteMetric;‹d  pExistingMetric     : POINTER TO FB_RemoteMetric;Œ    P    itfAllocdMetric     : IRemoteMetric;ÐÐÐEfÐÐ  
3
    ELSEc    //update onedX        Update( Metric := itfExistingMetric,e@                Name := newName,fP                DataType := newdatatype,gb                Status := MetricStatus.ONLINE_OK,hT                Timestamp := newtimestamp,iJ                String_ := newString,jH                LReal_ :=  newLreal,kB                Real_ := newreal,lN                VarInt :=  newVarInt );m                 nInterfaceoL{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}p&METHOD ProcessNDATAqVAR_INPUTrD    itfPrimaryHost : IPrimaryHost;sEND_VARtVAR_IN_OUTu‚    pMessage : FB_PayloadSimpleDecoder; // already decoded pleasevVAR_OUTPUTw$    xError : BOOL;x&    eError : Error;yVARz8  existingHasNext     : BOOL;{@   itfExistingElement  : IElement;|J   itfExistingMetric   : IRemoteMetric;}8 MetricNotExisting   : BOOL;~   8 newHasNext          : BOOL;€8  newMetricValid      : BOOL;8  MetricFoundInNDATA  : BOOL;‚>  newName             : WSTRING;ƒL    newdatatype         : MetricDataType;„D  newtimestamp        : T_DateTime;…Œ newString           : WSTRING(gc_sparkplug.supported_string_lengths);†:  newLreal            : LREAL;‡8    newreal             : REAL;ˆJ  newVarInt           : DecodedVarInt;‰b    pPrimaryHost        : POINTER TO FB_PrimaryHost;Šh    AllocdMetric        : REFERENCE TO FB_RemoteMetric;‹d  pExistingMetric     : POINTER TO FB_RemoteMetric;Œ    P    itfAllocdMetric     : IRemoteMetric;ÐÐÐEfÐÐ  
4
­ªÚÐ-
ÐÐ  
4
­ªÚÐ-
ÐÐ  
5
­«ÚÐ-ÐÐ  
5
­«ÚÐ-ÐÐ  
6
­¬ÚÐ-ÐÐ  
6
­¬ÚÐ-ÐÐ  
7
­­ÚÐ-ÐÐ  
7
­­ÚÐ-ÐÐ  
...
...
135
­¦ÚÐ-ŠÐÐ 
135
­¦ÚÐ-ŠÐÐ 
136
­§ÚÐ-‹ÐÐ 
136
­§ÚÐ-‹ÐÐ 
137
­¨ÚÐ-ŒÐÐ 
137
­¨ÚÐ-ŒÐÐ 
138
­©ÚÐ-ÐÐ 
138
­©ÚÐ-ÐÐ 
139
­ÚÐ-s
139
­ÚÐ-s