author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Mon, 13 Jan 2020 15:15:01 +0100 | |
branch | svghmi |
changeset 2824 | 074f43e6e114 |
parent 2822 | 9101a72a1da0 |
child 2826 | 1e5abecc3cde |
permissions | -rw-r--r-- |
2753
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
1 |
<?xml version="1.0"?> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
2 |
<xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:svg="http://www.w3.org/2000/svg" xmlns:str="http://exslt.org/strings" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:ns="beremiz" xmlns:cc="http://creativecommons.org/ns#" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" extension-element-prefixes="ns func" version="1.0" exclude-result-prefixes="ns str regexp exsl func"> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
3 |
<xsl:output method="xml" cdata-section-elements="xhtml:script"/> |
2753
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
4 |
<xsl:variable name="geometry" select="ns:GetSVGGeometry()"/> |
2763
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
5 |
<xsl:variable name="hmitree" select="ns:GetHMITree()"/> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
6 |
<xsl:variable name="svg_root_id" select="/svg:svg/@id"/> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
7 |
<xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
8 |
<xsl:variable name="hmi_geometry" select="$geometry[@Id = $hmi_elements/@id]"/> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
9 |
<xsl:variable name="hmi_pages" select="$hmi_elements[func:parselabel(@inkscape:label)/widget/@type = 'Page']"/> |
2795 | 10 |
<xsl:variable name="default_page"> |
11 |
<xsl:choose> |
|
12 |
<xsl:when test="count($hmi_pages) > 1"> |
|
13 |
<xsl:variable name="Home_page" select="$hmi_pages[func:parselabel(@inkscape:label)/widget/arg[1]/@value = 'Home']"/> |
|
14 |
<xsl:choose> |
|
15 |
<xsl:when test="$Home_page"> |
|
16 |
<xsl:text>Home</xsl:text> |
|
17 |
</xsl:when> |
|
18 |
<xsl:otherwise> |
|
19 |
<xsl:message terminate="yes">No Home page defined!</xsl:message> |
|
20 |
</xsl:otherwise> |
|
21 |
</xsl:choose> |
|
22 |
</xsl:when> |
|
23 |
<xsl:when test="count($hmi_pages) = 0"> |
|
24 |
<xsl:message terminate="yes">No page defined!</xsl:message> |
|
25 |
</xsl:when> |
|
26 |
<xsl:otherwise> |
|
27 |
<xsl:value-of select="func:parselabel($hmi_pages/@inkscape:label)/widget/arg[1]/@value"/> |
|
28 |
</xsl:otherwise> |
|
29 |
</xsl:choose> |
|
30 |
</xsl:variable> |
|
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
31 |
<xsl:variable name="_categories"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
32 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
33 |
<xsl:text>HMI_ROOT</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
34 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
35 |
<noindex> |
2814
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
36 |
<xsl:text>HMI_NODE</xsl:text> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
37 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
38 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
39 |
<xsl:text>HMI_PLC_STATUS</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
40 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
41 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
42 |
<xsl:text>HMI_CURRENT_PAGE</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
43 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
44 |
</xsl:variable> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
45 |
<xsl:variable name="categories" select="exsl:node-set($_categories)"/> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
46 |
<xsl:variable name="_indexed_hmitree"> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
47 |
<xsl:apply-templates mode="index" select="$hmitree"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
48 |
</xsl:variable> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
49 |
<xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
50 |
<xsl:template mode="index" match="*"> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
51 |
<xsl:param name="index" select="0"/> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
52 |
<xsl:param name="parentpath" select="''"/> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
53 |
<xsl:variable name="content"> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
54 |
<xsl:variable name="path"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
55 |
<xsl:choose> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
56 |
<xsl:when test="local-name() = 'HMI_ROOT'"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
57 |
<xsl:value-of select="$parentpath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
58 |
</xsl:when> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
59 |
<xsl:otherwise> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
60 |
<xsl:value-of select="$parentpath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
61 |
<xsl:text>/</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
62 |
<xsl:value-of select="@name"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
63 |
</xsl:otherwise> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
64 |
</xsl:choose> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
65 |
</xsl:variable> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
66 |
<xsl:choose> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
67 |
<xsl:when test="not(local-name() = $categories/noindex)"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
68 |
<xsl:copy> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
69 |
<xsl:attribute name="index"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
70 |
<xsl:value-of select="$index"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
71 |
</xsl:attribute> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
72 |
<xsl:attribute name="hmipath"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
73 |
<xsl:value-of select="$path"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
74 |
</xsl:attribute> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
75 |
<xsl:for-each select="@*"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
76 |
<xsl:copy/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
77 |
</xsl:for-each> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
78 |
</xsl:copy> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
79 |
</xsl:when> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
80 |
<xsl:otherwise> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
81 |
<xsl:apply-templates mode="index" select="*[1]"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
82 |
<xsl:with-param name="index" select="$index"/> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
83 |
<xsl:with-param name="parentpath"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
84 |
<xsl:value-of select="$path"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
85 |
</xsl:with-param> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
86 |
</xsl:apply-templates> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
87 |
</xsl:otherwise> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
88 |
</xsl:choose> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
89 |
</xsl:variable> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
90 |
<xsl:copy-of select="$content"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
91 |
<xsl:apply-templates mode="index" select="following-sibling::*[1]"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
92 |
<xsl:with-param name="index" select="$index + count(exsl:node-set($content)/*)"/> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
93 |
<xsl:with-param name="parentpath"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
94 |
<xsl:value-of select="$parentpath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
95 |
</xsl:with-param> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
96 |
</xsl:apply-templates> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
97 |
</xsl:template> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
98 |
<xsl:template mode="inline_svg" match="@* | node()"> |
2753
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
99 |
<xsl:copy> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
100 |
<xsl:apply-templates mode="inline_svg" select="@* | node()"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
101 |
</xsl:copy> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
102 |
</xsl:template> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
103 |
<xsl:template mode="inline_svg" match="svg:svg/@width"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
104 |
<xsl:template mode="inline_svg" match="svg:svg/@height"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
105 |
<xsl:template mode="inline_svg" match="svg:svg"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
106 |
<xsl:copy> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
107 |
<xsl:attribute name="preserveAspectRatio"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
108 |
<xsl:text>none</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
109 |
</xsl:attribute> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
110 |
<xsl:attribute name="height"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
111 |
<xsl:text>100vh</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
112 |
</xsl:attribute> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
113 |
<xsl:attribute name="width"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
114 |
<xsl:text>100vw</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
115 |
</xsl:attribute> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
116 |
<xsl:apply-templates mode="inline_svg" select="@* | node()"/> |
2753
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
117 |
</xsl:copy> |
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
118 |
</xsl:template> |
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
119 |
<xsl:template match="/"> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
120 |
<xsl:comment> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
121 |
<xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
122 |
</xsl:comment> |
2814
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
123 |
<xsl:comment> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
124 |
<xsl:apply-templates mode="testgeo" select="$hmi_geometry"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
125 |
</xsl:comment> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
126 |
<xsl:comment> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
127 |
<xsl:apply-templates mode="testtree" select="$hmitree"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
128 |
</xsl:comment> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
129 |
<xsl:comment> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
130 |
<xsl:apply-templates mode="testtree" select="$indexed_hmitree"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
131 |
</xsl:comment> |
2779
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
132 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
133 |
<head/> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
134 |
<body style="margin:0;overflow:hidden;"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
135 |
<xsl:apply-templates mode="inline_svg" select="svg:svg"/> |
2779
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
136 |
<script> |
2792
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
137 |
<xsl:call-template name="scripts"/> |
2779
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
138 |
</script> |
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
139 |
</body> |
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
140 |
</html> |
2753
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
141 |
</xsl:template> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
142 |
<func:function name="func:parselabel"> |
2792
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
143 |
<xsl:param name="label"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
144 |
<xsl:variable name="description" select="substring-after($label,'HMI:')"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
145 |
<xsl:variable name="_args" select="substring-before($description,'@')"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
146 |
<xsl:variable name="args"> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
147 |
<xsl:choose> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
148 |
<xsl:when test="$_args"> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
149 |
<xsl:value-of select="$_args"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
150 |
</xsl:when> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
151 |
<xsl:otherwise> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
152 |
<xsl:value-of select="$description"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
153 |
</xsl:otherwise> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
154 |
</xsl:choose> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
155 |
</xsl:variable> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
156 |
<xsl:variable name="_type" select="substring-before($args,':')"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
157 |
<xsl:variable name="type"> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
158 |
<xsl:choose> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
159 |
<xsl:when test="$_type"> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
160 |
<xsl:value-of select="$_type"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
161 |
</xsl:when> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
162 |
<xsl:otherwise> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
163 |
<xsl:value-of select="$args"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
164 |
</xsl:otherwise> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
165 |
</xsl:choose> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
166 |
</xsl:variable> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
167 |
<xsl:variable name="ast"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
168 |
<xsl:if test="$type"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
169 |
<widget> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
170 |
<xsl:attribute name="type"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
171 |
<xsl:value-of select="$type"/> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
172 |
</xsl:attribute> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
173 |
<xsl:for-each select="str:split(substring-after($args, ':'), ':')"> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
174 |
<arg> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
175 |
<xsl:attribute name="value"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
176 |
<xsl:value-of select="."/> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
177 |
</xsl:attribute> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
178 |
</arg> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
179 |
</xsl:for-each> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
180 |
<xsl:variable name="paths" select="substring-after($description,'@')"/> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
181 |
<xsl:for-each select="str:split($paths, '@')"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
182 |
<path> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
183 |
<xsl:attribute name="value"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
184 |
<xsl:value-of select="."/> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
185 |
</xsl:attribute> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
186 |
</path> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
187 |
</xsl:for-each> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
188 |
</widget> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
189 |
</xsl:if> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
190 |
</xsl:variable> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
191 |
<func:result select="exsl:node-set($ast)"/> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
192 |
</func:function> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
193 |
<xsl:template name="scripts"> |
2799
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
194 |
<xsl:text>//(function(){ |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
195 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
196 |
<xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
197 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
198 |
<xsl:text>var hmi_hash = [</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
199 |
<xsl:value-of select="$hmitree/@hash"/> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
200 |
<xsl:text>]; |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
201 |
</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
202 |
<xsl:text>var hmi_widgets = { |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
203 |
</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
204 |
<xsl:for-each select="$hmi_elements"> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
205 |
<xsl:variable name="widget" select="func:parselabel(@inkscape:label)/widget"/> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
206 |
<xsl:value-of select="@id"/> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
207 |
<xsl:text>: { |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
208 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
209 |
<xsl:text> type: "</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
210 |
<xsl:value-of select="$widget/@type"/> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
211 |
<xsl:text>", |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
212 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
213 |
<xsl:text> args: [ |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
214 |
</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
215 |
<xsl:for-each select="$widget/arg"> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
216 |
<xsl:text> "</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
217 |
<xsl:value-of select="@value"/> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
218 |
<xsl:text>"</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
219 |
<xsl:if test="position()!=last()"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
220 |
<xsl:text>,</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
221 |
</xsl:if> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
222 |
<xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
223 |
</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
224 |
</xsl:for-each> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
225 |
<xsl:text> ], |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
226 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
227 |
<xsl:text> indexes: [ |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
228 |
</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
229 |
<xsl:for-each select="$widget/path"> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
230 |
<xsl:variable name="hmipath" select="@value"/> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
231 |
<xsl:variable name="hmitree_match" select="$indexed_hmitree/*[@hmipath = $hmipath]"/> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
232 |
<xsl:if test="count($hmitree_match) = 0"> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
233 |
<xsl:message terminate="yes"> |
2814
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
234 |
<xsl:text>No match for path "</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
235 |
<xsl:value-of select="$hmipath"/> |
2814
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
236 |
<xsl:text>" in HMI tree</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
237 |
</xsl:message> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
238 |
</xsl:if> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
239 |
<xsl:text> </xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
240 |
<xsl:value-of select="$hmitree_match/@index"/> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
241 |
<xsl:if test="position()!=last()"> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
242 |
<xsl:text>,</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
243 |
</xsl:if> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
244 |
<xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
245 |
</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
246 |
</xsl:for-each> |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
247 |
<xsl:text> ], |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
248 |
</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
249 |
<xsl:text> element: document.getElementById("</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
250 |
<xsl:value-of select="@id"/> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
251 |
<xsl:text>"), |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
252 |
</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
253 |
<xsl:apply-templates mode="widget_defs" select="$widget"> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
254 |
<xsl:with-param name="hmi_element" select="."/> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
255 |
</xsl:apply-templates> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
256 |
<xsl:text>}</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
257 |
<xsl:if test="position()!=last()"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
258 |
<xsl:text>,</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
259 |
</xsl:if> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
260 |
<xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
261 |
</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
262 |
</xsl:for-each> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
263 |
<xsl:text>} |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
264 |
</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
265 |
<xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
266 |
</xsl:text> |
2822
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
267 |
<xsl:text>var heartbeat_index = </xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
268 |
<xsl:value-of select="$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index"/> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
269 |
<xsl:text>; |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
270 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
271 |
<xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
272 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
273 |
<xsl:text>var hmitree_types = [ |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
274 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
275 |
<xsl:for-each select="$indexed_hmitree/*"> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
276 |
<xsl:text>/* </xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
277 |
<xsl:value-of select="@index"/> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
278 |
<xsl:text> </xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
279 |
<xsl:value-of select="@hmipath"/> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
280 |
<xsl:text> */ "</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
281 |
<xsl:value-of select="substring(local-name(), 5)"/> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
282 |
<xsl:text>"</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
283 |
<xsl:if test="position()!=last()"> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
284 |
<xsl:text>,</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
285 |
</xsl:if> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
286 |
<xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
287 |
</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
288 |
</xsl:for-each> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
289 |
<xsl:text>] |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
290 |
</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
291 |
<xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
292 |
</xsl:text> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
293 |
<xsl:text>var page_desc = { |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
294 |
</xsl:text> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
295 |
<xsl:for-each select="$hmi_pages"> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
296 |
<xsl:variable name="desc" select="func:parselabel(@inkscape:label)/widget"/> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
297 |
<xsl:variable name="page" select="."/> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
298 |
<xsl:variable name="p" select="$hmi_geometry[@Id = $page/@id]"/> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
299 |
<xsl:variable name="page_ids" select="$hmi_geometry[@Id != $page/@id and @x >= $p/@x and @y >= $p/@y and @x+@w <= $p/@x+$p/@w and @y+@h <= $p/@y+$p/@h]/@Id"/> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
300 |
<xsl:variable name="page_elements" select="$hmi_elements[@id = $page_ids]"/> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
301 |
<xsl:text> "</xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
302 |
<xsl:value-of select="$desc/arg[1]/@value"/> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
303 |
<xsl:text>": { |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
304 |
</xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
305 |
<xsl:text> id: "</xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
306 |
<xsl:value-of select="@id"/> |
2795 | 307 |
<xsl:text>", |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
308 |
</xsl:text> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
309 |
<xsl:text> bbox: [</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
310 |
<xsl:value-of select="$p/@x"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
311 |
<xsl:text>, </xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
312 |
<xsl:value-of select="$p/@y"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
313 |
<xsl:text>, </xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
314 |
<xsl:value-of select="$p/@w"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
315 |
<xsl:text>, </xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
316 |
<xsl:value-of select="$p/@h"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
317 |
<xsl:text>], |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
318 |
</xsl:text> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
319 |
<xsl:text> widgets: [ |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
320 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
321 |
<xsl:for-each select="$page_ids"> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
322 |
<xsl:text> hmi_widgets.</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
323 |
<xsl:value-of select="."/> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
324 |
<xsl:if test="position()!=last()"> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
325 |
<xsl:text>,</xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
326 |
</xsl:if> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
327 |
<xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
328 |
</xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
329 |
</xsl:for-each> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
330 |
<xsl:text> ] |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
331 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
332 |
<xsl:text> }</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
333 |
<xsl:if test="position()!=last()"> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
334 |
<xsl:text>,</xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
335 |
</xsl:if> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
336 |
<xsl:text> |
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
337 |
</xsl:text> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
338 |
</xsl:for-each> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
339 |
<xsl:text>} |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
340 |
</xsl:text> |
2795 | 341 |
<xsl:text> |
342 |
</xsl:text> |
|
343 |
<xsl:text>var default_page = "</xsl:text> |
|
344 |
<xsl:value-of select="$default_page"/> |
|
345 |
<xsl:text>"; |
|
346 |
</xsl:text> |
|
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
347 |
<xsl:text>var svg_root = document.getElementById("</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
348 |
<xsl:value-of select="$svg_root_id"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
349 |
<xsl:text>"); |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
350 |
</xsl:text> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
351 |
<xsl:text>// svghmi.js |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
352 |
</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
353 |
<xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
354 |
</xsl:text> |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
355 |
<xsl:text>var cache = hmitree_types.map(_ignored => undefined); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
356 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
357 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
358 |
</xsl:text> |
2811
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
359 |
<xsl:text>function dispatch_value_to_widget(widget, index, value, oldval) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
360 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
361 |
<xsl:text> let idxidx = widget.indexes.indexOf(index); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
362 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
363 |
<xsl:text> if(idxidx == -1){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
364 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
365 |
<xsl:text> throw new Error("Dispatching to widget not interested, should not happen."); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
366 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
367 |
<xsl:text> } |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
368 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
369 |
<xsl:text> let d = widget.dispatch; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
370 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
371 |
<xsl:text> if(typeof(d) == "function" && idxidx == 0){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
372 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
373 |
<xsl:text> return d.call(widget, value, oldval); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
374 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
375 |
<xsl:text> }else if(typeof(d) == "object" && d.length >= idxidx){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
376 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
377 |
<xsl:text> return d[idxidx].call(widget, value, oldval); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
378 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
379 |
<xsl:text> }/* else dispatch_0, ..., dispatch_n ? */ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
380 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
381 |
<xsl:text> /*else { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
382 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
383 |
<xsl:text> throw new Error("Dunno how to dispatch to widget at index = " + index); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
384 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
385 |
<xsl:text> }*/ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
386 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
387 |
<xsl:text>} |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
388 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
389 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
390 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
391 |
<xsl:text>function dispatch_value(index, value) { |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
392 |
</xsl:text> |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
393 |
<xsl:text> let widgets = subscribers[index]; |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
394 |
</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
395 |
<xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
396 |
</xsl:text> |
2805
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
397 |
<xsl:text> let oldval = cache[index]; |
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
398 |
</xsl:text> |
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
399 |
<xsl:text> cache[index] = value; |
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
400 |
</xsl:text> |
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
401 |
<xsl:text> |
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
402 |
</xsl:text> |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
403 |
<xsl:text> if(widgets.size > 0) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
404 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
405 |
<xsl:text> for(let widget of widgets){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
406 |
</xsl:text> |
2811
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
407 |
<xsl:text> dispatch_value_to_widget(widget, index, value, oldval); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
408 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
409 |
<xsl:text> } |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
410 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
411 |
<xsl:text> } |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
412 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
413 |
<xsl:text>}; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
414 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
415 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
416 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
417 |
<xsl:text>function init_widgets() { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
418 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
419 |
<xsl:text> Object.keys(hmi_widgets).forEach(function(id) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
420 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
421 |
<xsl:text> let widget = hmi_widgets[id]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
422 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
423 |
<xsl:text> let init = widget.init; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
424 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
425 |
<xsl:text> if(typeof(init) == "function"){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
426 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
427 |
<xsl:text> return init.call(widget); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
428 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
429 |
<xsl:text> } |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
430 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
431 |
<xsl:text> }); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
432 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
433 |
<xsl:text>}; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
434 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
435 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
436 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
437 |
<xsl:text>// Open WebSocket to relative "/ws" address |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
438 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
439 |
<xsl:text>var ws = new WebSocket(window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws')); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
440 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
441 |
<xsl:text>ws.binaryType = 'arraybuffer'; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
442 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
443 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
444 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
445 |
<xsl:text>const dvgetters = { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
446 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
447 |
<xsl:text> INT: [DataView.prototype.getInt16, 2], |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
448 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
449 |
<xsl:text> BOOL: [DataView.prototype.getInt8, 1] |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
450 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
451 |
<xsl:text> /* TODO */ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
452 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
453 |
<xsl:text>}; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
454 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
455 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
456 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
457 |
<xsl:text>// Register message reception handler |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
458 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
459 |
<xsl:text>ws.onmessage = function (evt) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
460 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
461 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
462 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
463 |
<xsl:text> let data = evt.data; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
464 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
465 |
<xsl:text> let dv = new DataView(data); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
466 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
467 |
<xsl:text> let i = 0; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
468 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
469 |
<xsl:text> try { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
470 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
471 |
<xsl:text> for(let hash_int of hmi_hash) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
472 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
473 |
<xsl:text> if(hash_int != dv.getUint8(i)){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
474 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
475 |
<xsl:text> throw new Error("Hash doesn't match"); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
476 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
477 |
<xsl:text> }; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
478 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
479 |
<xsl:text> i++; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
480 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
481 |
<xsl:text> }; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
482 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
483 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
484 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
485 |
<xsl:text> while(i < data.byteLength){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
486 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
487 |
<xsl:text> let index = dv.getUint32(i, true); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
488 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
489 |
<xsl:text> i += 4; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
490 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
491 |
<xsl:text> let iectype = hmitree_types[index]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
492 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
493 |
<xsl:text> if(iectype != undefined){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
494 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
495 |
<xsl:text> let [dvgetter, bytesize] = dvgetters[iectype]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
496 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
497 |
<xsl:text> let value = dvgetter.call(dv,i,true); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
498 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
499 |
<xsl:text> dispatch_value(index, value); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
500 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
501 |
<xsl:text> i += bytesize; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
502 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
503 |
<xsl:text> } else { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
504 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
505 |
<xsl:text> throw new Error("Unknown index "+index) |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
506 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
507 |
<xsl:text> } |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
508 |
</xsl:text> |
2811
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
509 |
<xsl:text> }; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
510 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
511 |
<xsl:text> } catch(err) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
512 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
513 |
<xsl:text> // 1003 is for "Unsupported Data" |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
514 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
515 |
<xsl:text> // ws.close(1003, err.message); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
516 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
517 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
518 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
519 |
<xsl:text> // TODO : remove debug alert ? |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
520 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
521 |
<xsl:text> alert("Error : "+err.message+"\nHMI will be reloaded."); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
522 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
523 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
524 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
525 |
<xsl:text> // force reload ignoring cache |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
526 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
527 |
<xsl:text> location.reload(true); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
528 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
529 |
<xsl:text> } |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
530 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
531 |
<xsl:text>}; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
532 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
533 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
534 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
535 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
536 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
537 |
<xsl:text>function send_blob(data) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
538 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
539 |
<xsl:text> if(data.length > 0) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
540 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
541 |
<xsl:text> ws.send(new Blob([new Uint8Array(hmi_hash)].concat(data))); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
542 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
543 |
<xsl:text> }; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
544 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
545 |
<xsl:text>}; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
546 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
547 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
548 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
549 |
<xsl:text>const typedarray_types = { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
550 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
551 |
<xsl:text> INT: Int16Array, |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
552 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
553 |
<xsl:text> BOOL: Uint8Array |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
554 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
555 |
<xsl:text> /* TODO */ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
556 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
557 |
<xsl:text>}; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
558 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
559 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
560 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
561 |
<xsl:text>function send_reset() { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
562 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
563 |
<xsl:text> send_blob(new Uint8Array([1])); /* reset = 1 */ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
564 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
565 |
<xsl:text>}; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
566 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
567 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
568 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
569 |
<xsl:text>// subscription state, as it should be in hmi server |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
570 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
571 |
<xsl:text>// hmitree indexed array of integers |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
572 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
573 |
<xsl:text>var subscriptions = hmitree_types.map(_ignored => 0); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
574 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
575 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
576 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
577 |
<xsl:text>// subscription state as needed by widget now |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
578 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
579 |
<xsl:text>// hmitree indexed array of Sets of widgets objects |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
580 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
581 |
<xsl:text>var subscribers = hmitree_types.map(_ignored => new Set()); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
582 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
583 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
584 |
</xsl:text> |
2822
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
585 |
<xsl:text>// artificially subscribe the watchdog widget to "/heartbeat" hmi variable |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
586 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
587 |
<xsl:text>// Since dispatch directly calls change_hmi_value, |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
588 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
589 |
<xsl:text>// PLC will periodically send variable at given frequency |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
590 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
591 |
<xsl:text>subscribers[heartbeat_index].add({ |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
592 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
593 |
<xsl:text> /* type: "Watchdog", */ |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
594 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
595 |
<xsl:text> frequency: 1, |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
596 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
597 |
<xsl:text> indexes: [heartbeat_index], |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
598 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
599 |
<xsl:text> dispatch: function(value) { |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
600 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
601 |
<xsl:text> console.log("Heartbeat" + value); |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
602 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
603 |
<xsl:text> change_hmi_value(this.indexes[0], "+1"); |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
604 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
605 |
<xsl:text> } |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
606 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
607 |
<xsl:text>}); |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
608 |
</xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
609 |
<xsl:text> |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
610 |
</xsl:text> |
2811
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
611 |
<xsl:text>function update_subscriptions() { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
612 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
613 |
<xsl:text> let delta = []; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
614 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
615 |
<xsl:text> for(let index = 0; index < subscribers.length; index++){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
616 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
617 |
<xsl:text> let widgets = subscribers[index]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
618 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
619 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
620 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
621 |
<xsl:text> // periods are in ms |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
622 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
623 |
<xsl:text> let previous_period = subscriptions[index]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
624 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
625 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
626 |
</xsl:text> |
2822
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
627 |
<xsl:text> // subscribing with a zero period is unsubscribing |
9101a72a1da0
SVGHMI: added a watchdog. To ensure that the whole chain is checked, watchdog use a periodic echo of a hearteat variable. JS client code systematically register /HEARTBEAT at 1s update freq, and reacts on updates of /HEARTBEAT by systematically incrementing it. C code catch /HEARTBEAT update and feeds python-implemented watchdog. For now, watchdog does nothing when tiggered
Edouard Tisserant
parents:
2814
diff
changeset
|
628 |
</xsl:text> |
2811
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
629 |
<xsl:text> let new_period = 0; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
630 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
631 |
<xsl:text> if(widgets.size > 0) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
632 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
633 |
<xsl:text> let maxfreq = 0; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
634 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
635 |
<xsl:text> for(let widget of widgets) |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
636 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
637 |
<xsl:text> if(maxfreq < widget.frequency) |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
638 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
639 |
<xsl:text> maxfreq = widget.frequency; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
640 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
641 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
642 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
643 |
<xsl:text> if(maxfreq != 0) |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
644 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
645 |
<xsl:text> new_period = 1000/maxfreq; |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
646 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
647 |
<xsl:text> } |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
648 |
</xsl:text> |
2811
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
649 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
650 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
651 |
<xsl:text> if(previous_period != new_period) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
652 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
653 |
<xsl:text> subscriptions[index] = new_period; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
654 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
655 |
<xsl:text> delta.push( |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
656 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
657 |
<xsl:text> new Uint8Array([2]), /* subscribe = 2 */ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
658 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
659 |
<xsl:text> new Uint32Array([index]), |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
660 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
661 |
<xsl:text> new Uint16Array([new_period])); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
662 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
663 |
<xsl:text> } |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
664 |
</xsl:text> |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
665 |
<xsl:text> } |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
666 |
</xsl:text> |
2811
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
667 |
<xsl:text> send_blob(delta); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
668 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
669 |
<xsl:text>}; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
670 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
671 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
672 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
673 |
<xsl:text>function send_hmi_value(index, value) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
674 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
675 |
<xsl:text> let iectype = hmitree_types[index]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
676 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
677 |
<xsl:text> let jstype = typedarray_types[iectype]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
678 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
679 |
<xsl:text> send_blob([ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
680 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
681 |
<xsl:text> new Uint8Array([0]), /* setval = 0 */ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
682 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
683 |
<xsl:text> new Uint32Array([index]), |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
684 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
685 |
<xsl:text> new jstype([value])]); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
686 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
687 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
688 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
689 |
<xsl:text> cache[index] = value; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
690 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
691 |
<xsl:text>}; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
692 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
693 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
694 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
695 |
<xsl:text>function change_hmi_value(index, opstr) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
696 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
697 |
<xsl:text> let op = opstr[0]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
698 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
699 |
<xsl:text> let given_val = opstr.slice(1); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
700 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
701 |
<xsl:text> let old_val = cache[index] |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
702 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
703 |
<xsl:text> let new_val; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
704 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
705 |
<xsl:text> switch(op){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
706 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
707 |
<xsl:text> case "=": |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
708 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
709 |
<xsl:text> eval("new_val"+opstr); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
710 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
711 |
<xsl:text> break; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
712 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
713 |
<xsl:text> case "+": |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
714 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
715 |
<xsl:text> case "-": |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
716 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
717 |
<xsl:text> case "*": |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
718 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
719 |
<xsl:text> case "/": |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
720 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
721 |
<xsl:text> if(old_val != undefined) |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
722 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
723 |
<xsl:text> new_val = eval("old_val"+opstr); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
724 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
725 |
<xsl:text> break; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
726 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
727 |
<xsl:text> } |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
728 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
729 |
<xsl:text> if(new_val != undefined && old_val != new_val) |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
730 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
731 |
<xsl:text> send_hmi_value(index, new_val); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
732 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
733 |
<xsl:text> return new_val; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
734 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
735 |
<xsl:text>} |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
736 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
737 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
738 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
739 |
<xsl:text>var current_page; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
740 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
741 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
742 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
743 |
<xsl:text>function switch_page(page_name) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
744 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
745 |
<xsl:text> let old_desc = page_desc[current_page]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
746 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
747 |
<xsl:text> let new_desc = page_desc[page_name]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
748 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
749 |
<xsl:text> /* TODO hide / show widgets */ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
750 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
751 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
752 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
753 |
<xsl:text> /* remove subsribers of previous page if any */ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
754 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
755 |
<xsl:text> if(old_desc) for(let widget of old_desc.widgets){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
756 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
757 |
<xsl:text> for(let index of widget.indexes){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
758 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
759 |
<xsl:text> subscribers[index].delete(widget); |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
760 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
761 |
<xsl:text> } |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
762 |
</xsl:text> |
2811
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
763 |
<xsl:text> } |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
764 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
765 |
<xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
766 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
767 |
<xsl:text> if(new_desc) { |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
768 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
769 |
<xsl:text> /* add new subsribers if any */ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
770 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
771 |
<xsl:text> for(let widget of new_desc.widgets){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
772 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
773 |
<xsl:text> for(let index of widget.indexes){ |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
774 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
775 |
<xsl:text> subscribers[index].add(widget); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
776 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
777 |
<xsl:text> let cached_val = cache[index]; |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
778 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
779 |
<xsl:text> if(cached_val != undefined) |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
780 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
781 |
<xsl:text> dispatch_value_to_widget(widget, index, cached_val, cached_val); |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
782 |
</xsl:text> |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
783 |
<xsl:text> |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
784 |
</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
785 |
<xsl:text> } |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
786 |
</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
787 |
<xsl:text> } |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
788 |
</xsl:text> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
789 |
<xsl:text> svg_root.setAttribute('viewBox',new_desc.bbox.join(" ")); |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
790 |
</xsl:text> |
2811
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
791 |
<xsl:text> // TODO dispatch current cache in newly opened page |
4a81cec5f786
SVGHMI - prepare page with cached data when switching. This prevents values that do not change and that was already subscribed in previous page from keeping undefined.
Edouard Tisserant
parents:
2810
diff
changeset
|
792 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
793 |
<xsl:text> } |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
794 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
795 |
<xsl:text> current_page = page_name; |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
796 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
797 |
<xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
798 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
799 |
<xsl:text> update_subscriptions(); |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
800 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
801 |
<xsl:text>}; |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
802 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
803 |
<xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
804 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
805 |
<xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
806 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
807 |
<xsl:text>// Once connection established |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
808 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
809 |
<xsl:text>ws.onopen = function (evt) { |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
810 |
</xsl:text> |
2801
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
811 |
<xsl:text> init_widgets(); |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
812 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
813 |
<xsl:text> send_reset(); |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
814 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
815 |
<xsl:text> // show main page |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
816 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
817 |
<xsl:text> switch_page(default_page); |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
818 |
</xsl:text> |
2799
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
819 |
<xsl:text>}; |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
820 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
821 |
<xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
822 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
823 |
<xsl:text>ws.onclose = function (evt) { |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
824 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
825 |
<xsl:text> // TODO : add visible notification while waiting for reload |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
826 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
827 |
<xsl:text> console.log("Connection closed. code:"+evt.code+" reason:"+evt.reason+" wasClean:"+evt.wasClean+" Reload in 10s."); |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
828 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
829 |
<xsl:text> // TODO : re-enable auto reload when not in debug |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
830 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
831 |
<xsl:text> //window.setTimeout(() => location.reload(true), 10000); |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
832 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
833 |
<xsl:text> alert("Connection closed. code:"+evt.code+" reason:"+evt.reason+" wasClean:"+evt.wasClean+"."); |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
834 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
835 |
<xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
836 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
837 |
<xsl:text>}; |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
838 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
839 |
<xsl:text>//})(); |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
840 |
</xsl:text> |
2792
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
841 |
</xsl:template> |
2814
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
842 |
<xsl:template mode="testgeo" match="bbox"> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
843 |
<xsl:text>ID: </xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
844 |
<xsl:value-of select="@Id"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
845 |
<xsl:text> x: </xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
846 |
<xsl:value-of select="@x"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
847 |
<xsl:text> y: </xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
848 |
<xsl:value-of select="@y"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
849 |
<xsl:text> w: </xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
850 |
<xsl:value-of select="@w"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
851 |
<xsl:text> h: </xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
852 |
<xsl:value-of select="@h"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
853 |
<xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
854 |
</xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
855 |
</xsl:template> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
856 |
<xsl:template mode="testtree" match="*"> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
857 |
<xsl:param name="indent" select="''"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
858 |
<xsl:value-of select="$indent"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
859 |
<xsl:text> </xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
860 |
<xsl:value-of select="local-name()"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
861 |
<xsl:text> </xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
862 |
<xsl:for-each select="@*"> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
863 |
<xsl:value-of select="local-name()"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
864 |
<xsl:text>=</xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
865 |
<xsl:value-of select="."/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
866 |
<xsl:text> </xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
867 |
</xsl:for-each> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
868 |
<xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
869 |
</xsl:text> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
870 |
<xsl:apply-templates mode="testtree" select="*"> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
871 |
<xsl:with-param name="indent"> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
872 |
<xsl:value-of select="concat($indent,'>')"/> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
873 |
</xsl:with-param> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
874 |
</xsl:apply-templates> |
2cabc4773885
SVGHMI: HMI_LABEL and HMI_CLASS become HMI_NODE.
Edouard Tisserant
parents:
2811
diff
changeset
|
875 |
</xsl:template> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
876 |
<xsl:template name="defs_by_labels"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
877 |
<xsl:param name="labels" select="''"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
878 |
<xsl:param name="mandatory" select="'yes'"/> |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
879 |
<xsl:param name="hmi_element"/> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
880 |
<xsl:for-each select="str:split($labels)"> |
2807 | 881 |
<xsl:variable name="name" select="."/> |
882 |
<xsl:variable name="elt_id" select="$hmi_element//*[@inkscape:label=$name][1]/@id"/> |
|
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
883 |
<xsl:if test="$mandatory='yes' and not($elt_id)"> |
2807 | 884 |
<xsl:message terminate="yes"> |
885 |
<xsl:text>Meter widget must have a </xsl:text> |
|
886 |
<xsl:value-of select="$name"/> |
|
887 |
<xsl:text> element</xsl:text> |
|
888 |
</xsl:message> |
|
889 |
</xsl:if> |
|
890 |
<xsl:value-of select="$name"/> |
|
891 |
<xsl:text>_elt: document.getElementById("</xsl:text> |
|
892 |
<xsl:value-of select="$elt_id"/> |
|
893 |
<xsl:text>"), |
|
894 |
</xsl:text> |
|
895 |
</xsl:for-each> |
|
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
896 |
</xsl:template> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
897 |
<xsl:template mode="widget_defs" match="widget[@type='Display']"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
898 |
<xsl:param name="hmi_element"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
899 |
<xsl:text>frequency: 5, |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
900 |
</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
901 |
<xsl:text>dispatch: function(value) { |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
902 |
</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
903 |
<xsl:choose> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
904 |
<xsl:when test="$hmi_element[self::svg:text]"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
905 |
<xsl:text> this.element.textContent = String(value); |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
906 |
</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
907 |
</xsl:when> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
908 |
<xsl:otherwise> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
909 |
<xsl:message terminate="yes"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
910 |
<xsl:text>Display widget as a group not implemented</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
911 |
</xsl:message> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
912 |
</xsl:otherwise> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
913 |
</xsl:choose> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
914 |
<xsl:text>}, |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
915 |
</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
916 |
</xsl:template> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
917 |
<xsl:template mode="widget_defs" match="widget[@type='Meter']"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
918 |
<xsl:param name="hmi_element"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
919 |
<xsl:text>frequency: 10, |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
920 |
</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
921 |
<xsl:call-template name="defs_by_labels"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
922 |
<xsl:with-param name="hmi_element" select="$hmi_element"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
923 |
<xsl:with-param name="labels"> |
2810
63b9a37b73c7
SVGHMI: various insignificant code moves, commenting and typos fixes.
Edouard Tisserant
parents:
2808
diff
changeset
|
924 |
<xsl:text>value min max needle range</xsl:text> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
925 |
</xsl:with-param> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
926 |
</xsl:call-template> |
2807 | 927 |
<xsl:text>dispatch: function(value) { |
928 |
</xsl:text> |
|
929 |
<xsl:text> this.value_elt.textContent = String(value); |
|
930 |
</xsl:text> |
|
931 |
<xsl:text> let [min,max,totallength] = this.range; |
|
932 |
</xsl:text> |
|
933 |
<xsl:text> let length = Math.max(0,Math.min(totallength,(Number(value)-min)*totallength/(max-min))); |
|
934 |
</xsl:text> |
|
935 |
<xsl:text> let tip = this.range_elt.getPointAtLength(length); |
|
936 |
</xsl:text> |
|
937 |
<xsl:text> this.needle_elt.setAttribute('d', "M "+this.origin.x+","+this.origin.y+" "+tip.x+","+tip.y); |
|
938 |
</xsl:text> |
|
939 |
<xsl:text>}, |
|
940 |
</xsl:text> |
|
941 |
<xsl:text>origin: undefined, |
|
942 |
</xsl:text> |
|
943 |
<xsl:text>range: undefined, |
|
944 |
</xsl:text> |
|
945 |
<xsl:text>init: function() { |
|
946 |
</xsl:text> |
|
947 |
<xsl:text> this.range = [Number(this.min_elt.textContent), Number(this.max_elt.textContent), this.range_elt.getTotalLength()] |
|
948 |
</xsl:text> |
|
949 |
<xsl:text> this.origin = this.needle_elt.getPointAtLength(0); |
|
950 |
</xsl:text> |
|
951 |
<xsl:text>}, |
|
952 |
</xsl:text> |
|
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
953 |
</xsl:template> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
954 |
<xsl:template mode="widget_defs" match="widget[@type='Input']"> |
2801
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
955 |
<xsl:param name="hmi_element"/> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
956 |
<xsl:text>frequency: 5, |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
957 |
</xsl:text> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
958 |
<xsl:call-template name="defs_by_labels"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
959 |
<xsl:with-param name="hmi_element" select="$hmi_element"/> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
960 |
<xsl:with-param name="labels"> |
2810
63b9a37b73c7
SVGHMI: various insignificant code moves, commenting and typos fixes.
Edouard Tisserant
parents:
2808
diff
changeset
|
961 |
<xsl:text>value</xsl:text> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
962 |
</xsl:with-param> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
963 |
</xsl:call-template> |
2801
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
964 |
<xsl:text>dispatch: function(value) { |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
965 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
966 |
<xsl:text> this.value_elt.textContent = String(value); |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
967 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
968 |
<xsl:text>}, |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
969 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
970 |
<xsl:variable name="edit_elt_id" select="$hmi_element/*[@inkscape:label='edit'][1]/@id"/> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
971 |
<xsl:text>init: function() { |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
972 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
973 |
<xsl:if test="$edit_elt_id"> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
974 |
<xsl:text> document.getElementById("</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
975 |
<xsl:value-of select="$edit_elt_id"/> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
976 |
<xsl:text>").addEventListener( |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
977 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
978 |
<xsl:text> "click", |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
979 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
980 |
<xsl:text> evt => alert('XXX TODO : Edit value')); |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
981 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
982 |
</xsl:if> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
983 |
<xsl:for-each select="$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-][0-9]+')]"> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
984 |
<xsl:text> document.getElementById("</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
985 |
<xsl:value-of select="@id"/> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
986 |
<xsl:text>").addEventListener( |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
987 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
988 |
<xsl:text> "click", |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
989 |
</xsl:text> |
2806
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
990 |
<xsl:text> evt => {let new_val = change_hmi_value(this.indexes[0], "</xsl:text> |
2801
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
991 |
<xsl:value-of select="@inkscape:label"/> |
2806
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
992 |
<xsl:text>"); |
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
993 |
</xsl:text> |
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
994 |
<xsl:text> this.value_elt.textContent = String(new_val);}); |
2801
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
995 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
996 |
</xsl:for-each> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
997 |
<xsl:text>}, |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
998 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
999 |
</xsl:template> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
1000 |
<xsl:template mode="widget_defs" match="widget[@type='Button']"/> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
1001 |
<xsl:template mode="widget_defs" match="widget[@type='Toggle']"> |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
1002 |
<xsl:text> frequency: 5, |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
1003 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
1004 |
</xsl:template> |
2801
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
1005 |
<xsl:template mode="widget_defs" match="widget[@type='Change']"> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
1006 |
<xsl:text> frequency: 5, |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
1007 |
</xsl:text> |
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
1008 |
</xsl:template> |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1009 |
<xsl:template mode="widget_defs" match="widget[@type='Jump']"> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1010 |
<xsl:text>init: function() { |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1011 |
</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1012 |
<xsl:text> this.element.addEventListener( |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1013 |
</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1014 |
<xsl:text> "click", |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1015 |
</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1016 |
<xsl:text> evt => switch_page(this.args[0])); |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1017 |
</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1018 |
<xsl:text>}, |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1019 |
</xsl:text> |
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
1020 |
</xsl:template> |
2753
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
1021 |
</xsl:stylesheet> |