[r818]: / branches / FeatureBranches / Debuglogging / SparkplugB / Function Blocks / FB_Device / FB_Device_1 / DDEATH / PublishDDEATHEntry / svnobj  Maximize  Restore  History

Download this file

29 lines (28 with data), 4.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
{attribute 'hide'}
METHOD PublishDDEATHEntry : BOOL
VAR_IN_OUT
    AllMetricsList : LIST;
END_VAR
VAR_OUTPUT
    EncodeError   : BOOL := FALSE;
    Encode_eError : Error;
VAR_STAT
    DDEATHeError : Error;
PublishDDEATHEntry := FALSE;
WriteDeviceLog( gc_sparkplug.CMP_EDGE,
                CmpLog.LogClass.LOG_DEBUG,
                'Device Death Detected: %s',
                WSTRING_TO_STRING( DeviceName ) );
    EncodeError := _SparkplugB.EncodeError( eError => Encode_eError );
    EncodeDone  := _SparkplugB.Encoded();
UNTIL EncodeDone OR EncodeError
END_REPEAT;
_SparkplugB.Encode( Enable := FALSE );
IF EncodeError THEN
                    'Encoding DDEATH data Error: %s',
                    TO_STRING( Encode_eError ) );
// now retrieve the serialised blob
_SparkplugB.GetEncodedBlob( Blob := _Blob,
                            BlobSize := _BlobSize );
_MQTT.EnablePublisher();
PublishDDEATHEntry := EncodeDone OR EncodeError;