Diff of /branches/h-hermsen/mqttsparkplugb/SparkplugB/Function Blocks/FB_Edge_Of_Network_Node/FB_Edge_Of_Network_Node/PublishDBIRTH/svnobj [r524] .. [r525]  Maximize  Restore

Switch to side-by-side view

--- a/branches/h-hermsen/mqttsparkplugb/SparkplugB/Function Blocks/FB_Edge_Of_Network_Node/FB_Edge_Of_Network_Node/PublishDBIRTH/svnobj
+++ b/branches/h-hermsen/mqttsparkplugb/SparkplugB/Function Blocks/FB_Edge_Of_Network_Node/FB_Edge_Of_Network_Node/PublishDBIRTH/svnobj
@@ -1,11 +1,10 @@
-Gx_l‚.!0…jüoÑ#[å•Ô‰
-]7ñSystem.StringL{f8a58466-d7f6-439f-bbb8-d4600e41d099}ImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocumentL{f3878285-8e4f-490b-bb1b-9acbb7eb04db}TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}	Id
+Gx_lC-!0…jüoò",™Þò)
+Õw¥System.StringL{f8a58466-d7f6-439f-bbb8-d4600e41d099}ImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocumentL{f3878285-8e4f-490b-bb1b-9acbb7eb04db}TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}	Id
 longTagText
.PublishDBIRTH := FALSE;°DBIRTHError := _SparkplugB.GetDeviceBirthCertificate( AllMetricsList := AllMetricsList);JIF DBIRTHError <> ERROR.NO_ERROR THENä    WriteDeviceLog( TO_DWORD(CmpLog.LogClass.LOG_ERROR), 'EoN Publish DBIRTH Error: %s', TO_STRING(DBIRTHError) );    RETURN;    END_IFd                                                  ¾//{info 'todo: aliazzz: Advanced example usage of templates and adds some device metrics here'}(*â    The DBIRTH message can also include optional  Device Control  payload components. These are used by a backendÊ    application to control aspects of a device. The following are examples of Device Control metrics.    X    "    Metric name:  Device Control/Reboot x        o Used by backend application(s) to reboot a device.Z    "    Metric name:  Device Control/Rebirth ž        o Used by backend application(s) to request a new DBIRTH from a device.^    "    Metric name:  Device Control/Scan rate ”        o Used by backed application(s) to modify a poll rate on a device. Ð    The DBIRTH message can also include optional  Properties  of a device. The following are examples of!2        Property metrics."^    "    Metric name:  Properties/Hardware Make #„        o Used to transmit the hardware manufacturer of the device$`    "    Metric name:  Properties/Hardware Model %v        o Used to transmit the hardware model of the device&H    "    Metric name:  Properties/FW 'z        o Used to transmit the firmware version of the device(*))z// Publish the initial data with the Device BIRTH certificate*J_SparkplugB.Encode( Enable := TRUE );+REPEAT,j    _SparkplugB( AllmetricsList := _AllMetricsList );-Œ    EncodeError := _SparkplugB.EncodeError( eError => Encode_eError );.P    EncodeDone := _SparkplugB.Encoded();/
-UNTIL0>    EncodeDone OR EncodeError  1END_REPEAT;2L_SparkplugB.Encode( Enable := FALSE );3&IF EncodeError THEN4ú    WriteDeviceLog( TO_DWORD(CmpLog.LogClass.LOG_ERROR), 'EoN Encoding DBIRTH data Error: %s', TO_STRING(Encode_eError) );   5    RETURN;6F// now retrieve the serialised blob7†_SparkplugB.GetEncodedBlob( Blob := _Blob, BlobSize := _BlobSize );8^DBIRTHTopic   := WCONCAT( SPARKPLUGB, GroupId);9vDBIRTHTopic   := WCONCAT( DBIRTHTopic, DEVICE_BIRTH_TOPIC);:bDBIRTHTopic   := WCONCAT( DBIRTHTopic, NodeName);;bDBIRTHTopic   := WCONCAT( DBIRTHTopic, FW_SLASH);<fDBIRTHTopic   := WCONCAT( DBIRTHTopic, DeviceName);=Ø//client.publish("spBv1.0/" + myGroupId + "/DBIRTH/" + NodeName + "/" DeviceName, PublishMessage, 0, FALSE);>Ž// i.e. topic: spBv1.0/Sparkplug"!B Devices/DBIRTH/Raspberry Pi/Pibrella?2_MQTT.EnablePublisher(); @R    _MQTT.publish( Topic := DBIRTHTopic, AX                   pbMessage := ADR(_Blob), BZ                   MessageSize := _BlobSize, CZ                   Qos := MQTT.MQTT_QOS.QoS0,DL                   Retained := FALSE);E	_MQTT();F†    publishError := _MQTT.PublisherError(eError => Publish_eError);Gp    publishDone := _MQTT.PublisherDone();               H>    publishDone OR publishErrorIZ_MQTT.DisablePublisher();                    JôWriteDeviceLog( TO_DWORD(CmpLog.LogClass.LOG_INFO), 'EoN Publish DBIRTH data to: %s', WSTRING_TO_STRING(DBIRTHTopic) );   K.PublishDBIRTH := TRUE; LInterfaceML{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}NÔ    The DBIRTH is responsible for informing the backend system of all of the information about the device.OŒ    This includes every metric it will publish data for in the future.Pœ    The following is a representation of a simple DBIRTH message on the topic:Q€        spBv1.0/Sparkplug"!B Devices/DBIRTH/Raspberry Pi/PibrellaRÆ    In the topic above the following information is known based on the Sparkplug"! topic definition:S„        "    The  Group ID  of this device is: Sparkplug"! B DevicesT„        "    The host  EoN node ID  of this device is: Raspberry PiUP        "    The  Device ID  is: PibrellaVj        "    This is an DBIRTH message from the deviceW${attribute 'hide'}X6METHOD PublishDBIRTH : BOOLYVAR_INPUTZ`    GroupId : WSTRING; // eg: "SparkplugBDevice"[J    NodeName : WSTRING; // eg: "EoN1"\b    DeviceName : WSTRING; // eg: "EmulatedDevice"]END_VAR^VAR_IN_OUT_4    AllMetricsList : LIST;`VAR_STATa0    DBIRTHError : ERROR;b4    DBIRTHTopic : WSTRING;c   d@    EncodeError : BOOL := FALSE;e4    Encode_eError : ERROR;f>    EncodeDone : BOOL := FALSE;gB    PublishError : BOOL := FALSE;hJ    Publish_eError : MQTT.MQTT_ERROR;iH    PublishDone : BOOL := FALSE;    ÐÐÐEKÐÐ	
+UNTIL0>    EncodeDone OR EncodeError  1END_REPEAT;2L_SparkplugB.Encode( Enable := FALSE );3&IF EncodeError THEN4ú    WriteDeviceLog( TO_DWORD(CmpLog.LogClass.LOG_ERROR), 'EoN Encoding DBIRTH data Error: %s', TO_STRING(Encode_eError) );   5    RETURN;6F// now retrieve the serialised blob7†_SparkplugB.GetEncodedBlob( Blob := _Blob, BlobSize := _BlobSize );8^DBIRTHTopic   := WCONCAT( SPARKPLUGB, GroupId);9vDBIRTHTopic   := WCONCAT( DBIRTHTopic, DEVICE_BIRTH_TOPIC);:bDBIRTHTopic   := WCONCAT( DBIRTHTopic, NodeName);;bDBIRTHTopic   := WCONCAT( DBIRTHTopic, FW_SLASH);<fDBIRTHTopic   := WCONCAT( DBIRTHTopic, DeviceName);=Ž// i.e. topic: spBv1.0/Sparkplug"!B Devices/DBIRTH/Raspberry Pi/Pibrella>2_MQTT.EnablePublisher(); ?R    _MQTT.publish( Topic := DBIRTHTopic, @X                   pbMessage := ADR(_Blob), AZ                   MessageSize := _BlobSize, BZ                   Qos := MQTT.MQTT_QOS.QoS0,CL                   Retained := FALSE);D	_MQTT();E†    publishError := _MQTT.PublisherError(eError => Publish_eError);Fp    publishDone := _MQTT.PublisherDone();               G>    publishDone OR publishErrorHZ_MQTT.DisablePublisher();                    IôWriteDeviceLog( TO_DWORD(CmpLog.LogClass.LOG_INFO), 'EoN Publish DBIRTH data to: %s', WSTRING_TO_STRING(DBIRTHTopic) );   J<PublishDBIRTH := publishDone; KInterfaceLL{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}MÔ    The DBIRTH is responsible for informing the backend system of all of the information about the device.NŒ    This includes every metric it will publish data for in the future.Oœ    The following is a representation of a simple DBIRTH message on the topic:P€        spBv1.0/Sparkplug"!B Devices/DBIRTH/Raspberry Pi/PibrellaQÆ    In the topic above the following information is known based on the Sparkplug"! topic definition:R„        "    The  Group ID  of this device is: Sparkplug"! B DevicesS„        "    The host  EoN node ID  of this device is: Raspberry PiTP        "    The  Device ID  is: PibrellaUj        "    This is an DBIRTH message from the deviceV${attribute 'hide'}W6METHOD PublishDBIRTH : BOOLXVAR_INPUTY`    GroupId : WSTRING; // eg: "SparkplugBDevice"ZJ    NodeName : WSTRING; // eg: "EoN1"[P    DeviceName : WSTRING; // eg: "FT001"\END_VAR]VAR_IN_OUT^4    AllMetricsList : LIST;_VAR_STAT`0    DBIRTHError : ERROR;a4    DBIRTHTopic : WSTRING;b   c@    EncodeError : BOOL := FALSE;d4    Encode_eError : ERROR;e>    EncodeDone : BOOL := FALSE;fB    PublishError : BOOL := FALSE;gJ    Publish_eError : MQTT.MQTT_ERROR;hH    PublishDone : BOOL := FALSE;    ÐÐÐEGÐÐ	
 ­‘ÚÐ-
ÐÐ	
 ­ªÚÐ-ÐÐ	
 ­eÚÐ-ÐÐ	
-­åÚÐ-ÐÐ	
 ­ÚÐ-ÐÐ	
 ­ßÚÐ-ÐÐ	
 ­äÚÐ-ÐÐ	
@@ -57,60 +56,57 @@
 ­¨ÚÐ-:ÐÐ	
 ­©ÚÐ-;ÐÐ	
 ­„ÚÐ-<ÐÐ	
-­†ÚÐ-ÐÐ	
-­‡ÚÐ-=ÐÐ	
-­ÚÐ->ÐÐ	
-­ëÚÐ-?ÐÐ	
+­ÚÐ-=ÐÐ	
+­ëÚÐ->ÐÐ	
 ­êÚÐ-+ÐÐ	
-­ˆÚÐ-@ÐÐ	
-­‰ÚÐ-AÐÐ	
-­ŠÚÐ-BÐÐ	
-­‹ÚÐ-CÐÐ	
-­\ÚÐ-DÐÐ	
-­òÚÐ-EÐÐ	
-­íÚÐ-FÐÐ	
-­îÚÐ-GÐÐ	
+­ˆÚÐ-?ÐÐ	
+­‰ÚÐ-@ÐÐ	
+­ŠÚÐ-AÐÐ	
+­‹ÚÐ-BÐÐ	
+­\ÚÐ-CÐÐ	
+­òÚÐ-DÐÐ	
+­íÚÐ-EÐÐ	
+­îÚÐ-FÐÐ	
 ­ïÚÐ-/ÐÐ	
-­ðÚÐ-HÐÐ	
+­ðÚÐ-GÐÐ	
 ­ñÚÐ-1ÐÐ	
-­ìÚÐ-IÐÐ	
-­áÚÐ-ÐÐ	
-­âÚÐ-JÐÐ	
-­ÎÚÐ-KÐLMÐE$ÐÐ	
+­ìÚÐ-HÐÐ	
+­âÚÐ-IÐÐ	
+­ÎÚÐ-JÐKLÐE$ÐÐ	
 ­óÚÐ-ÐÐ	
-­ôÚÐ-NÐÐ	
-­õÚÐ-OÐÐ	
-­öÚÐ-PÐÐ	
+­ôÚÐ-MÐÐ	
+­õÚÐ-NÐÐ	
+­öÚÐ-OÐÐ	
 ­÷ÚÐ-ÐÐ	
-­øÚÐ-QÐÐ	
+­øÚÐ-PÐÐ	
 ­ùÚÐ-ÐÐ	
-­úÚÐ-RÐÐ	
+­úÚÐ-QÐÐ	
 ­ûÚÐ-ÐÐ	
-­üÚÐ-SÐÐ	
-­ýÚÐ-TÐÐ	
-­þÚÐ-UÐÐ	
-­ÿÚÐ-VÐÐ	
+­üÚÐ-RÐÐ	
+­ýÚÐ-SÐÐ	
+­þÚÐ-TÐÐ	
+­ÿÚÐ-UÐÐ	
 ­ÚÐ-(ÐÐ	
-­ÚÐ-WÐÐ	
-­ÚÐ-XÐÐ	
-­ÚÐ-YÐÐ	
-­ÚÐ-ZÐÐ	
-­ÚÐ-[ÐÐ	
-­ÚÐ-\ÐÐ	
-­ÚÐ-]ÐÐ	
-­ÚÐ-^ÐÐ	
-­ÚÐ-_ÐÐ	
-­	ÚÐ-]ÐÐ	
+­ÚÐ-VÐÐ	
+­ÚÐ-WÐÐ	
+­ÚÐ-XÐÐ	
+­ÚÐ-YÐÐ	
+­ÚÐ-ZÐÐ	
+­ÚÐ-[ÐÐ	
+­ÚÐ-\ÐÐ	
+­ÚÐ-]ÐÐ	
+­ÚÐ-^ÐÐ	
+­	ÚÐ-\ÐÐ	
 ­
-ÚÐ-`ÐÐ	
-­ÚÐ-aÐÐ	
-­ÚÐ-bÐÐ	

ÚÐ-cÐÐ	
-­ÚÐ-dÐÐ	
-­ÚÐ-eÐÐ	
-­ÚÐ-fÐÐ	
+ÚÐ-_ÐÐ	
+­ÚÐ-`ÐÐ	
+­ÚÐ-aÐÐ	

ÚÐ-bÐÐ	
+­ÚÐ-cÐÐ	
+­ÚÐ-dÐÐ	
+­ÚÐ-eÐÐ	
 ­ÚÐ-ÐÐ	
-­ÚÐ-gÐÐ	
-­ÚÐ-hÐÐ	
-­ÚÐ-iÐÐ	
-­"ÚÐ-]
\ No newline at end of file
+­ÚÐ-fÐÐ	
+­ÚÐ-gÐÐ	
+­ÚÐ-hÐÐ	
+­"ÚÐ-\
\ No newline at end of file