XRServer.java 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package at.acdp.urweb.web;
  2. import at.acdp.urweb.Main;
  3. import com.nmote.xr.XRMethod;
  4. import java.util.concurrent.ExecutionException;
  5. public class XRServer {
  6. @XRMethod(value = "example.helloWorld", help = "Returns 'Helo ' + argument")
  7. public static String hello(Object s) {
  8. return "Hello '" + s + "'";
  9. }
  10. @XRMethod(value = "ref", help = "ref")
  11. public static String ref(String a, String b) {
  12. return "ref";
  13. }
  14. @XRMethod(value = "pos", help = "pos")
  15. public static void pos(String pos) {
  16. //Main.fhm.prepare();
  17. Main.fhm.direktAuftrag(Integer.parseInt(pos),0);
  18. Main.fhm.direktAuftrag(Integer.parseInt(pos),1);
  19. }
  20. @XRMethod(value = "status", help = "Returns status")
  21. public static String status() {
  22. var x=Main.fhm.readStatus();
  23. try {
  24. return x==null?"<null>":x.get().toString();
  25. } catch (Exception e) {
  26. e.printStackTrace();
  27. return e.toString();
  28. }
  29. }
  30. @XRMethod(value = "set_title", help = "Returns 'Helo ' + argument")
  31. public static String set_title(Object s) {
  32. return "Hello '" + s + "'";
  33. }
  34. @XRMethod(value = "get_title", help = "Returns 'Helo ' + argument")
  35. public static String get_title() {
  36. return "Hello";
  37. }
  38. @XRMethod(value = "get_message")
  39. public static String get_message(Object s) {
  40. return "asdfasdfas";
  41. }
  42. }