bacnet/bacnet.py
changeset 2669 be233279d179
parent 2649 db68cb0e6bdc
child 2703 32ffdb32b14e
--- a/bacnet/bacnet.py	Sun Jun 07 23:47:32 2020 +0100
+++ b/bacnet/bacnet.py	Fri Jun 12 10:30:23 2020 +0200
@@ -36,6 +36,7 @@
 from bacnet.BacnetSlaveEditor import ObjectProperties
 from PLCControler import LOCATION_CONFNODE, LOCATION_VAR_MEMORY
 from ConfigTreeNode import ConfigTreeNode
+import util.paths as paths
 
 base_folder = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
 base_folder = os.path.join(base_folder, "..")
@@ -775,5 +776,20 @@
         # fobject     = file object, already open'ed for read() !!
         #
         # extra_files -> files that will be downloaded to the PLC!
-        return [(Generated_BACnet_c_mainfile_name, CFLAGS)], LDFLAGS, True
+
+        websettingfile = open(paths.AbsNeighbourFile(__file__, "web_settings.py"), 'r')
+        websettingcode = websettingfile.read()
+        websettingfile.close()
+
+        location_str = "_".join(map(str, self.GetCurrentLocation()))
+        websettingcode = websettingcode % locals()
+
+        runtimefile_path = os.path.join(buildpath, "runtime_bacnet_websettings.py")
+        runtimefile = open(runtimefile_path, 'w')
+        runtimefile.write(websettingcode)
+        runtimefile.close()
+
+        return ([(Generated_BACnet_c_mainfile_name, CFLAGS)], LDFLAGS, True,
+                ("runtime_bacnet_websettings_%s.py" % location_str, open(runtimefile_path, "rb")),
+        )
         #return [(Generated_BACnet_c_mainfile_name, CFLAGS)], LDFLAGS, True, ('extrafile1.txt', extra_file_handle)