--- a/svghmi/svghmi.py Fri Jan 10 13:15:07 2020 +0100
+++ b/svghmi/svghmi.py Fri Jan 10 17:00:01 2020 +0100
@@ -13,6 +13,7 @@
from pprint import pformat
@@ -375,8 +376,9 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="SVGHMI">
- <xsd:attribute name="enableHTTP" type="xsd:boolean" use="optional" default="false"/>
- <xsd:attribute name="bindAddress" type="xsd:string" use="optional" default="localhost"/>
+ <xsd:attribute name="OnStart" type="xsd:string" use="optional"/> + <xsd:attribute name="OnStop" type="xsd:string" use="optional"/> + <xsd:attribute name="OnWatchdog" type="xsd:string" use="optional"/> <xsd:attribute name="port" type="xsd:string" use="optional" default="8080"/>
@@ -503,19 +505,37 @@
res += ((target_fname, open(target_path, "rb")),)
+ for thing in ["Start", "Stop", "Watchdog"]: + given_command = self.GetParamsAttributes("SVGHMI.On"+thing)["value"] + svghmi_cmds[thing] = shlex.split(given_command) runtimefile_path = os.path.join(buildpath, "runtime_svghmi1_%s.py" % location_str)
runtimefile = open(runtimefile_path, 'w')
+svghmi_cmds = %(svghmi_cmds)s + Popen(svghmi_cmds[cmd]) def _runtime_svghmi1_%(location)s_start():
svghmi_root.putChild('%(view_name)s',File('%(xhtml)s', defaultType='application/xhtml+xml'))
def _runtime_svghmi1_%(location)s_stop():
svghmi_root.delEntity('%(view_name)s')
""" % {"location": location_str,
- "view_name": view_name})
+ "view_name": view_name, + "svghmi_cmds": repr(svghmi_cmds)}) --- a/svghmi/svghmi_server.py Fri Jan 10 13:15:07 2020 +0100
+++ b/svghmi/svghmi_server.py Fri Jan 10 17:00:01 2020 +0100
@@ -9,6 +9,11 @@
from threading import RLock, Timer
+ from runtime.spawn_subprocess import Popen + from subprocess import Popen from twisted.web.server import Site
from twisted.web.resource import Resource
from twisted.internet import reactor
--- a/tests/svghmi/plc.xml Fri Jan 10 13:15:07 2020 +0100
+++ b/tests/svghmi/plc.xml Fri Jan 10 17:00:01 2020 +0100
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2019-08-06T14:23:42"/>
- <contentHeader name="Unnamed" modificationDateTime="2019-11-14T13:42:40">
+ <contentHeader name="Unnamed" modificationDateTime="2020-01-10T16:48:16"> --- a/tests/svghmi/svghmi_0@svghmi/confnode.xml Fri Jan 10 13:15:07 2020 +0100
+++ b/tests/svghmi/svghmi_0@svghmi/confnode.xml Fri Jan 10 17:00:01 2020 +0100
@@ -1,2 +1,2 @@
<?xml version='1.0' encoding='utf-8'?>
-<SVGHMI xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
+<SVGHMI xmlns:xsd="http://www.w3.org/2001/XMLSchema" OnWatchdog="echo Banana" OnStart="echo Whaaaa" OnStop="echo Hoooo"/>