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 | // 1. pMessage is already decoded _Metrics.ItterateNext(itfElement => itfExistingElement, HasNext => existingHasNext); MetricFoundInxBIRTH := FALSE; MetricFoundInxBIRTH := newMetricValid AND (newName = itfExistingMetric.Name); WHILE newHasNext AND NOT MetricFoundInxBIRTH DO pMessage.GetNextMetric( name => newName, MetricValid => newMetricValid, HasNext => newHasNext); AllocdMetric REF= pPrimaryHost^.allocMetric(itfMetricOwner := THIS^.itfRemoteEoN, eError => eError); IF eError = ERROR.NO_ERROR THEN itfAllocdMetric := AllocdMetric; Update( Metric := itfAllocdMetric, Name := newName, DataType := newdatatype, Status := MetricStatus.ONLINE_OK, Timestamp := newtimestamp, String_ := newString, LReal_ := newLreal, Real_ := newreal, VarInt := newVarInt ); END_IF ELSE // update one as it allready excists Update( Metric := itfExistingMetric, Name := newName, DataType := newdatatype, Status := MetricStatus.ONLINE_OK, Timestamp := newtimestamp, String_ := newString, LReal_ := newLreal, Real_ := newreal, VarInt := newVarInt ); END_IF WHILE newHasNext AND NOT MetricFoundInxBIRTH DO pMessage.GetNextMetric( name => newName, datatype => newdatatype, timestamp => newtimestamp, valueString => newString, valueLreal => newLreal, valueReal => newreal, valueVarInt => newVarInt, MetricValid => newMetricValid, HasNext => newHasNext); THIS^.GetMetricbyName( DeviceId := "", MetricName := newName, Metric => itfExistingMetric, GetTimestamp=> , xError=> MetricNotExisting, eError=> ); IF MetricNotExisting THEN // get one and update it IF __QUERYPOINTER(itfPrimaryHost, pPrimaryHost) THEN /// Set all Device metric to offline and each device.isQualityOK = FALSE _devices.ItterateRestart(hasnext => existingHasNextDevice); WHILE existingHasNextDevice DO IF __QUERYINTERFACE(itfExistingElement, itfExistingDevice) THEN itfExistingDevice.QualityOK := FALSE; itfExistingDevice.setAllMetricsStatus( NewStatus := MetricStatus.DeviceOffline ); |