summaryrefslogtreecommitdiff
path: root/server/xml/example2.xml
blob: 0bfee27678ae8ae8e158353d657652fca35b11e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version='1.0' encoding='UTF-8'?>
<template name="testcourse">
  <course name="example2">
    <macro name="example1" version="1.0"
           resume="${linse1}${linse2}">
      <queries>
        <query class="lensmeter" ttl="10000" automap="true"/>
      </queries>
      <maps>
        <map name="axis">
          -- LUA program
          return math.pi, 1234567890
        </map>
        <map name="right.axis" uses="lensmeter, lensmeter.right.axis">
          -- LUA program
	  right_axis = 0
	  if( lensmeter.right.axis ) right_axis = lensmeter.right.axis.value
          return right_axis, lensmeter.right.sphere.timestamp
        </map>
        <map name="cyl">
          -- LUA program
          return lensmeter.right.cyl.value, lensmeter.right.cyl.timestamp
        </map>
      </maps>
      <window name="mainwindow"
              caption="Fundus"
              width="500"
              height="560"
              layout="vbox">
        <frame name="linse_frame" caption="Linser:" layout="vbox">
          <frame name="linse_framea" layout="hbox">
            <label name="a" width="300" caption="Akse rotation:"/>
            <lineedit name="linse4"
		      regexp="[24]*"
		      map="axis"
		      lua_validator="if( tonumber(value) == 42 ) then return 'true' else return 'false' end"
		      value="90K"/>
          </frame>
          <frame name="linse_frameb" layout="hbox">
            <label name="b" width="300" caption="Sphere:"/>
            <lineedit name="linse2" regexp="-{0,1}[0-9]{1,3}\.[0-9]{1,3}" map="sphere" value="90K"/>
          </frame>
          <frame name="linse_framec" layout="hbox">
            <label name="c" width="300" caption="Sphere:"/>
            <lineedit name="linse3" regexp="-{0,1}[0-9]{1,3}\.[0-9]{1,3}" map="cyl" value="90K"/>
          </frame>
        </frame>
        <frame name="buttons" layout="hbox">
          <button name="cancel" caption="Annuller" action="cancel"/>
          <button name="commit" caption="Godkend" action="commit"/>
        </frame>
      </window>
    </macro>
    <macro name="example2" version="1.0"
           resume="${linse1}${linse2}">
      <queries>
        <query device_id="lensmeter" device_type="lensmeter" class="lensmeter" ttl="10000"/>
      </queries>
      <maps>
        <map name="axis">
          -- LUA program
          return right.axis
        </map>
        <map name="sphere">
          -- LUA program
          return right.sphere
        </map>
        <map name="cyl">
          -- LUA program
          return right.cyl
        </map>
      </maps>
      <window name="mainwindow"
              caption="Fundus"
              width="500"
              height="560"
              layout="vbox">
        <frame name="linse_frame" caption="Linser:" layout="vbox">
          <frame name="linse_framea" layout="hbox">
            <label name="a" width="300" caption="Akse rotation:"/>
            <lineedit name="linse1" regexp="[0-9]{1,3}" map="axis" value="90K"/>
          </frame>
          <frame name="linse_frameb" layout="hbox">
            <label name="b" width="300" caption="Sphere:"/>
            <lineedit name="linse2" regexp="[0-9]{1,3}" map="sphere" value="90K"/>
          </frame>
          <frame name="linse_framec" layout="hbox">
            <label name="c" width="300" caption="Sphere:"/>
            <lineedit name="linse3" regexp="[0-9]{1,3}" map="cyl" value="90K"/>
          </frame>
        </frame>
        <frame name="buttons" layout="hbox">
          <button name="cancel" caption="Annuller" action="cancel"/>
          <button name="commit" caption="Godkend" action="commit"/>
        </frame>
      </window>
    </macro>
  </course>
</template>