1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- package at.acdp.urweb.web;
- import at.acdp.urweb.Main;
- import at.acdp.urweb.fhpp.Status;
- import com.nmote.xr.XRMethod;
- import java.util.concurrent.ExecutionException;
- public class XRServer {
- @XRMethod(value = "example.helloWorld", help = "Returns 'Helo ' + argument")
- public static String hello(Object s) {
- return "Hello '" + s + "'";
- }
- @XRMethod(value = "ref", help = "ref")
- public static String ref(String a, String b) {
- return "ref";
- }
- @XRMethod(value = "rel", help = "rel")
- public static void rel(String pos) {
- System.out.println("rel: "+pos);
- waitMC(true);
- Main.fhm.direktAuftrag(Integer.parseInt(pos),0,true);
- Main.fhm.direktAuftrag(Integer.parseInt(pos),1,true);
- waitMC(true);
- }
- @XRMethod(value = "abs", help = "abs")
- public static void abs(String pos) {
- System.out.println("abs: "+pos);
- waitMC(true);
- Main.fhm.direktAuftrag(Integer.parseInt(pos),0, false);
- Main.fhm.direktAuftrag(Integer.parseInt(pos),1, false);
- waitMC(true);
- }
- private static void waitMC(boolean what) {
- while(true) {
- Status s=Main.fhm.readStatus().join();
- System.out.println(s.mc);
- if(s.mc==what) break;
- }
- }
- @XRMethod(value = "status", help = "Returns status")
- public static String status() {
- var x=Main.fhm.readStatus();
- try {
- return x==null?"<null>":x.get().toString();
- } catch (Exception e) {
- e.printStackTrace();
- return e.toString();
- }
- }
- @XRMethod(value = "set_title", help = "Returns 'Helo ' + argument")
- public static String set_title(Object s) {
- return "Hello '" + s + "'";
- }
- @XRMethod(value = "get_title", help = "Returns 'Helo ' + argument")
- public static String get_title() {
- return "Hello";
- }
- @XRMethod(value = "get_message")
- public static String get_message(Object s) {
- return "asdfasdfas";
- }
- }
|