SVGHMI: Prepare accepting multiple clients on multiple HMI: Use POULibrary new capability to add variables to PLC Configuration. Now heartbeat and HMI tree root are added by the library part of SVGHMI, and not by each instance. svghmi
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Wed, 30 Jun 2021 15:51:59 +0200
branchsvghmi
changeset 3267 5f20f391ae31
parent 3266 aff5cedb35ba
child 3268 d22782b9591f
SVGHMI: Prepare accepting multiple clients on multiple HMI: Use POULibrary new capability to add variables to PLC Configuration. Now heartbeat and HMI tree root are added by the library part of SVGHMI, and not by each instance.
svghmi/svghmi.py
--- a/svghmi/svghmi.py	Wed Jun 30 15:44:32 2021 +0200
+++ b/svghmi/svghmi.py	Wed Jun 30 15:51:59 2021 +0200
@@ -238,6 +238,11 @@
                 # note the double zero after "runtime_", 
                 # to ensure placement before other CTN generated code in execution order
 
+    def GlobalInstances(self):
+        """ Adds HMI tree root and hearbeat to PLC Configuration's globals """
+        return [(name, iec_type, "") for name, iec_type in SPECIAL_NODES]
+
+
 
 def Register_SVGHMI_UI_for_HMI_tree_updates(ref):
     global on_hmitree_update
@@ -699,11 +704,10 @@
                 self.GetCTRoot().logger.write_error(
                     _("Font file does not exist: %s\n") % fontfile)
         
-    def CTNGlobalInstances(self):
-        # view_name = self.BaseParams.getName()
-        # return [ (view_name + "_" + name, iec_type, "") for name, iec_type in SPECIAL_NODES]
-        # TODO : move to library level for multiple hmi
-        return [(name, iec_type, "") for name, iec_type in SPECIAL_NODES]
+    ## In case one day we support more than one heartbeat
+    # def CTNGlobalInstances(self):
+    #     view_name = self.BaseParams.getName()
+    #     return [(view_name + "_HEARTBEAT", "HMI_INT", "")]
 
     def GetIconName(self):
         return "SVGHMI"