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

Download this file

23 lines (22 with data), 5.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
{attribute 'call_after_init'}
FUNCTION_BLOCK PUBLIC FB_RemoteMetric IMPLEMENTS IRemoteMetric
VAR_INPUT
    itfPrimaryHost : IPrimaryHost;
    // FALSE when metric value is representative of the remote value. 
    // TRUE when Edge or Device dies, or when Host is OFFLINE
    isStale : BOOL := TRUE;
VAR
    pPrimary       : POINTER TO FB_PrimaryHost;
    _name          : WSTRING;
    _Value         : BOOL;
    _TS            : T_DateTime;
    _Status        : MetricStatus;
	_storageMetricHost : FB_HostStorageMetric;//This is just used for storage for the payload
	// ISimpleStorage
IF THIS^.itfMetricOwner <> 0 THEN
    itfMetricOwner.RegisterMetric( THIS^ );
ELSIF THIS^.itfPrimaryHost <> 0 THEN
    IF __QUERYPOINTER( itfPrimaryHost, pPrimary ) THEN
        pPrimary^.RegisterMetric( THIS^ );
    END_IF
END_IF