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

Download this file

45 lines (40 with data), 8.4 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
41
42
43
44
{attribute 'hide'}
METHOD PublishNBIRTHEntry : BOOL
VAR_OUTPUT
    EncodeError   : BOOL;
    Encode_eError : ERROR;
END_VAR
VAR_STAT
    NBIRTHError : ERROR;
    NBIRTHTopic : WSTRING;
PublishNBIRTHEntry := FALSE;
NBIRTHError        :=
                                            AllMetricsList := _Metrics );
IF NBIRTHError <> ERROR.NO_ERROR THEN
    WriteDeviceLog( TO_DWORD( CmpLog.LogClass.LOG_ERROR ),
                    'EoN Publish NBIRTH Error: %s',
                    TO_STRING( NBIRTHError ) );
END_IF
(*
    application to control aspects of the EoN node. The following are examples of Node Control metrics.
    
   Metric name: 
Node Control/Reboot
        o Used by backend application(s) to reboot an EoN node.
    
   Metric name: 
Node Control/Rebirth
        o Used by backend application(s) to request an EoN node to walk to the next MQTT Server in its list
        in multi-MQTT Server environments.
    
   Metric name: 
Node Control/Scan rate
    The NBIRTH message can also include optional 
Properties
 of an EoN node. The following are examples of
    Property metrics.
    
   Metric name: 
Properties/Hardware Make
//Encode the node birth certificate, which should only take 1 scan!
_SparkplugB.Encode( Enable := TRUE );
REPEAT
    _SparkplugB( AllmetricsList := _Metrics );
                WSTRING_TO_STRING( _TopicProvider.wsNBIRTHpublisherTopic ) );
PublishNBIRTHEntry := EncodeDone OR EncodeError;