[r815]: / branches / FeatureBranches / refactorpayload / SparkplugB / Function Blocks / FB_Edge / FB_Edge / GetMetricbyName / svnobj  Maximize  Restore  History

Download this file

24 lines (23 with data), 5.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
IF DeviceId = "" THEN
    //Edge Metric
    eError := ERROR.MetricNotFound;
    _metrics.ItterateRestart( HasNext => HasNext );
    WHILE HasNext AND NOT FoundMetric DO
        _metrics.ItterateNext( itfElement => itfElement,
                               HasNext => HasNext );
        IF __QUERYINTERFACE( itfElement,
                             _Metric ) THEN
            IF _Metric.Name = MetricName THEN
                FoundMetric := TRUE;
                eError      := ERROR.NO_ERROR;
                Metric      := _Metric;
            END_IF
        END_IF
    END_WHILE
ELSE
    //Device Metric
    refDevice REF= THIS^.GetDevice( DeviceId := DeviceId,
                                    eError => eError );
    IF eError = ERROR.NO_ERROR THEN
        refDevice.GetMetricbyName( MetricName := MetricName,
                                   Metric => Metric,