summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/server.cc14
-rw-r--r--server/src/widgetgenerator.cc2
-rw-r--r--server/xml/example2.xml46
3 files changed, 60 insertions, 2 deletions
diff --git a/server/src/server.cc b/server/src/server.cc
index 2f89c73..a82b716 100644
--- a/server/src/server.cc
+++ b/server/src/server.cc
@@ -131,17 +131,31 @@ static void connection(TCPSocket &socket)
// Map the results
LUAQueryMapper lqm(qp.result);
+ socket.write(" <course name=\"");
+ socket.write(templ->course.attributes["name"]);
+ socket.write("\">\n");
+
// Generate the macro and return it to the client
std::vector< Macro >::iterator mi2 = templ->course.macroes.begin();
while(mi2 != templ->course.macroes.end()) {
Macro &macro = (*mi2);
printf("Macro: %s ?= %s\n", macro.attributes["name"].c_str(), request.macro.c_str());
+
+ socket.write(" <macro name=\"");
+ socket.write(macro.attributes["name"]);
+ socket.write("\">\n");
+
if(macro.attributes["name"] == request.macro) {
widgetgenerator(socket, macro, lqm);
}
+
+ socket.write(" </macro>\n");
+
mi2++;
}
+ socket.write(" </course>\n");
+
i++;
}
diff --git a/server/src/widgetgenerator.cc b/server/src/widgetgenerator.cc
index ced804a..2dcfa35 100644
--- a/server/src/widgetgenerator.cc
+++ b/server/src/widgetgenerator.cc
@@ -73,5 +73,5 @@ static void send_macro_widget(Macro &macro, Widget &widget, TCPSocket &socket, s
void widgetgenerator(TCPSocket &socket, Macro &macro, LUAQueryMapper &mapper)
{
- send_macro_widget(macro, macro.window, socket, " ", mapper);
+ send_macro_widget(macro, macro.window, socket, " ", mapper);
}
diff --git a/server/xml/example2.xml b/server/xml/example2.xml
index d30bfec..65164bc 100644
--- a/server/xml/example2.xml
+++ b/server/xml/example2.xml
@@ -1,6 +1,50 @@
<?xml version='1.0' encoding='UTF-8'?>
<template name="testcourse">
- <course>
+ <course name="example2">
+ <macro name="example1" 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>
<macro name="example2" version="1.0"
resume="${linse1}${linse2}">
<queries>