[r805]: / trunk / mqttsparkplug / mqttsparkplug / SparkplugB / Function Blocks / FB_RemoteEdge / FB_RemoteEdge / ProcessNDATA / svnobj  Maximize  Restore  History

Download this file

36 lines (34 with data), 13.7 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
METHOD ProcessNDATA
VAR_INPUT
    itfPrimaryHost : IPrimaryHost;
END_VAR
VAR_IN_OUT
	newMetricValid      : BOOL;
	newName             : WSTRING;
	newtimestamp        : T_DateTime;
	newString           : WSTRING(gc_sparkplug.supported_string_lengths);
	newreal             : REAL;
	pPrimaryHost        : POINTER TO FB_PrimaryHost;
	pExistingMetric     : POINTER TO FB_RemoteMetric;
// 1. pMessage is already decoded
	_Metrics.ItterateNext(itfElement => itfExistingElement, HasNext => existingHasNext);
	MetricFoundInNDATA := FALSE;
		MetricFoundInNDATA := newMetricValid AND (newName = itfExistingMetric.Name);
		WHILE newHasNext AND NOT MetricFoundInNDATA DO
			pMessage.GetNextMetric(  name => newName,
									 MetricValid => newMetricValid,
									 HasNext => newHasNext);
                    'PrimaryHost ProcessNDATA MetricNotExisting: %s',
        WriteDeviceLog( UDINT_TO_DWORD( CmpLog.LogClass.LOG_INFO ),
                        TO_STRING( Error.OhMy_ThatShouldNotHaveHappened ) );  
	ELSE
		//update one
        Update( Metric := itfExistingMetric,
                Name := newName,
                DataType := newdatatype,
                Status := MetricStatus.ONLINE_OK,
                Timestamp := newtimestamp,
                String_ := newString,
                LReal_ :=  newLreal,
                Real_ := newreal,
                VarInt :=  newVarInt );