[r819]: / trunk / mqttsparkplug / mqttsparkplug / SparkplugB / Function Blocks / FB_Device / FB_Device_1 / DBIRTH / PublishDBIRTHEntry / svnobj  Maximize  Restore  History

Download this file

41 lines (36 with data), 6.2 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
36
37
38
39
40
PublishDBIRTHEntry := FALSE;
                                                             AllMetricsList := AllMetricsList );
IF DBIRTHError <> ERROR.NO_ERROR THEN
    WriteDeviceLog( gc_sparkplug.CMP_EDGE,
                    CmpLog.LogClass.LOG_ERROR,
                    'Publish DBIRTH Error: %s',
                    TO_STRING( DBIRTHError ) );
    RETURN;
END_IF
_SparkplugB.Encode( Enable := TRUE );
REPEAT
    _SparkplugB( AllmetricsList := AllMetricsList );
    The DBIRTH is responsible for informing the backend system of all of the information about the device.
    The following is a representation of a simple DBIRTH message on the topic:
    In the topic above the following information is known based on the Sparkplug
 topic definition:
    
        
   The host 
EoN node ID
 of this device is: Raspberry Pi
        
   The 
Device ID
 is: Pibrella
        
   This is an DBIRTH message from the device
*)
{attribute 'hide'}
METHOD PublishDBIRTHEntry : BOOL
VAR_IN_OUT
    AllMetricsList : LIST;
END_VAR
VAR_OUTPUT
    EncodeError   : BOOL := FALSE;
    Encode_eError : ERROR;
VAR_STAT
    DBIRTHError : ERROR;
    DBIRTHTopic : WSTRING;
    EncodeDone  : BOOL := FALSE;