r) {
+ Class fc;
+ fc = f.getType();
+ if (fc.isArray())
+ fc = f.getType().getComponentType();
+ if (Indication.isIndicated(f) && (jo != null)) {
+ //fc = Indication.getIndication(parent,
+ // (String) jo.get(Indication.getIndicatorName(parent.getClass())));
+ fc = r.lookup(parent.getClass(),
+ (String) jo.get(Indication.getIndicatorName(parent.getClass())));
+ //System.out.println("JSON.getFieldClass: parent class " + parent.getClass().getName() +
+ // " Indicator: " + Indication.getIndicatorName(parent.getClass()) +
+ // " result: " + fc.getName());
+ }
+ return fc;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/implementation/PublishEvent.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/implementation/PublishEvent.java
new file mode 100644
index 0000000..6f53dde
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/implementation/PublishEvent.java
@@ -0,0 +1,24 @@
+package com.jilk.ros.message.ros.rosbridge.implementation;
+
+import com.jilk.ros.message.ros.rosbridge.operation.Operation;
+
+/**EventBus event entity,describe ros server response info
+ * Created by xxhong on 16-11-22.
+ */
+
+public class PublishEvent {
+ public String msg;
+ public String id;
+ public String name;
+ public String op;
+
+
+ public PublishEvent(Operation operation, String name, String content) {
+ if(operation != null) {
+ id = operation.id;
+ op = operation.op;
+ }
+ this.name = name;
+ msg = content;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/implementation/ROSBridgeWebSocketClient.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/implementation/ROSBridgeWebSocketClient.java
new file mode 100644
index 0000000..9f64f75
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/implementation/ROSBridgeWebSocketClient.java
@@ -0,0 +1,209 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ */
+package com.jilk.ros.message.ros.rosbridge.implementation;
+
+import com.jilk.ros.message.ros.ROSClient;
+import com.jilk.ros.message.ros.message.Message;
+import com.jilk.ros.message.ros.rosbridge.FullMessageHandler;
+import com.jilk.ros.message.ros.rosbridge.operation.Operation;
+import com.jilk.ros.message.ros.rosbridge.operation.Publish;
+import com.jilk.ros.message.ros.rosbridge.operation.ServiceResponse;
+
+import org.java_websocket.client.WebSocketClient;
+import org.java_websocket.framing.CloseFrame;
+import org.java_websocket.handshake.ServerHandshake;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+import java.lang.reflect.Field;
+import java.net.Socket;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.channels.SocketChannel;
+
+import de.greenrobot.event.EventBus;
+
+public class ROSBridgeWebSocketClient extends WebSocketClient {
+ private Registry classes;
+ private Registry handlers;
+ private boolean debug;
+ private ROSClient.ConnectionStatusListener listener;
+
+ ROSBridgeWebSocketClient(URI serverURI) {
+ super(serverURI);
+ classes = new Registry();
+ handlers = new Registry();
+ Operation.initialize(classes); // note, this ensures that the Message Map is initialized too
+ listener = null;
+ }
+
+ public static ROSBridgeWebSocketClient create(String URIString) {
+ ROSBridgeWebSocketClient client = null;
+ try {
+ URI uri = new URI(URIString);
+ client = new ROSBridgeWebSocketClient(uri);
+ } catch (URISyntaxException ex) {
+ ex.printStackTrace();
+ } finally {
+
+ }
+ return client;
+ }
+
+ public void setListener(ROSClient.ConnectionStatusListener listener) {
+ this.listener = listener;
+ }
+
+ @Override
+ public void onOpen(ServerHandshake handshakedata) {
+ if (listener != null)
+ listener.onConnect();
+ }
+
+ @Override
+ public void onMessage(String message) {
+ if (debug) System.out.println(" " + json);
+ send(json);
+ }
+
+ public void register(Class extends Operation> c,
+ String s,
+ Class extends Message> m,
+ FullMessageHandler h) {
+ Message.register(m, classes.get(Message.class));
+ classes.register(c, s, m);
+ if (h != null)
+ handlers.register(c, s, h);
+ }
+
+ public void unregister(Class extends Operation> c, String s) {
+ handlers.unregister(c, s);
+ // Note that there is no concept of unregistering a class - it can get replaced is all
+ }
+
+ public Class extends Message> getRegisteredMessage(String messageString) {
+ return classes.lookup(Message.class, messageString);
+ }
+
+ public void setDebug(boolean debug) {
+ this.debug = debug;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/implementation/Registry.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/implementation/Registry.java
new file mode 100644
index 0000000..ede00ee
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/implementation/Registry.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.implementation;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Registry extends HashMap> {
+
+ public void register(Class c, String s, T t) {
+ Map table = get(c);
+ if (table == null) {
+ table = new HashMap();
+ put(c, table);
+ }
+ table.put(s, t);
+ }
+
+ public void unregister(Class c, String s) {
+ Map table = get(c);
+ if (table != null)
+ table.remove(s);
+ }
+
+ public T lookup(Class c, String s) {
+ T result = null;
+ Map table = get(c);
+ if (table != null)
+ result = table.get(s);
+ return result;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/AsArray.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/AsArray.java
new file mode 100644
index 0000000..52fb9d0
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/AsArray.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.indication;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface AsArray {
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Base64Encoded.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Base64Encoded.java
new file mode 100644
index 0000000..4cb70dd
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Base64Encoded.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.indication;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Base64Encoded {
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indicate.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indicate.java
new file mode 100644
index 0000000..52b6a50
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indicate.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.indication;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface Indicate {
+ // if later we want multiple indicated fields, use an int here
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indicated.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indicated.java
new file mode 100644
index 0000000..d8c4b18
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indicated.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.indication;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Indicated {
+ // if later we want multiple indicated fields, use an int here
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indication.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indication.java
new file mode 100644
index 0000000..c132f36
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indication.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.indication;
+
+import java.lang.reflect.Field;
+
+public class Indication {
+ public static boolean isIndicated(Field f) {
+ return (f.getAnnotation(Indicated.class) != null);
+ }
+
+ public static boolean asArray(Field f) {
+ return (f.getAnnotation(AsArray.class) != null);
+ }
+
+ public static boolean isBase64Encoded(Field f) {
+ return ((f.getAnnotation(Base64Encoded.class) != null) &&
+ f.getType().isArray() &&
+ f.getType().getComponentType().equals(byte.class));
+ }
+
+ public static String getIndicatorName(Class c) {
+ return getName(c, Indicator.class);
+ }
+
+ public static String getIndicatedName(Class c) {
+ return getName(c, Indicated.class);
+ }
+
+ private static String getName(Class c, Class annotation) {
+ String result = null;
+ for (Field f : c.getFields()) {
+ if (f.getAnnotation(annotation) != null) {
+ result = f.getName();
+ break;
+ }
+ }
+ return result;
+ }
+
+ /*
+ public static Class getIndication(Object o, String s) {
+ Class c = o.getClass();
+ Class result = null;
+ try {
+ Method m = getIndicateMethod(c);
+ result = (Class) (m.invoke(o, s));
+ }
+ catch (ReflectiveOperationException ex) {
+ ex.printStackTrace();
+ }
+ return result;
+ }
+
+ private static Method getIndicateMethod(Class c) {
+ Method result = null;
+ for (Method m : c.getMethods()) {
+ if (m.getAnnotation(Indicate.class) != null) {
+ result = m;
+ break;
+ }
+ }
+ return result;
+ }
+ */
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indicator.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indicator.java
new file mode 100644
index 0000000..50b7a0e
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/indication/Indicator.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.indication;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Indicator {
+ // if later we want multiple indicated fields, use an int here
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Advertise.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Advertise.java
new file mode 100644
index 0000000..4c87088
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Advertise.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.MessageType;
+
+@MessageType(string = "advertise")
+public class Advertise extends Operation {
+ public String topic;
+ public String type;
+
+ public Advertise() {}
+
+ public Advertise(String topic, String type) {
+ this.topic = topic;
+ this.type = type;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Authenticate.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Authenticate.java
new file mode 100644
index 0000000..6b88ce7
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Authenticate.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.MessageType;
+
+@MessageType(string = "auth")
+public class Authenticate extends Operation {
+ public String mac;
+ public String client;
+ public String dest;
+ public String rand;
+ public int t;
+ public String level;
+ public int end;
+
+ public Authenticate() {}
+
+ public Authenticate(
+ String mac,
+ String client,
+ String dest,
+ String rand,
+ int t,
+ String level,
+ int end)
+ {
+ this.mac = mac;
+ this.client = client;
+ this.dest = dest;
+ this.rand = rand;
+ this.t = t;
+ this.level = level;
+ this.end = end;
+
+ this.id = null; // even though id is on EVERY OTHER operation type
+ }
+
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/CallService.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/CallService.java
new file mode 100644
index 0000000..ac4a7a9
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/CallService.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.Message;
+import com.jilk.ros.message.ros.message.MessageType;
+import com.jilk.ros.message.ros.rosbridge.indication.AsArray;
+import com.jilk.ros.message.ros.rosbridge.indication.Indicated;
+import com.jilk.ros.message.ros.rosbridge.indication.Indicator;
+
+@MessageType(string = "call_service")
+public class CallService extends Operation {
+ @Indicator
+ public String service;
+ @Indicated
+ @AsArray
+ public Message args;
+ public Integer fragment_size; // use Integer for optional items
+ public String compression;
+
+ public CallService() {}
+
+ public CallService(String service, Message args) {
+ this.service = service;
+ this.args = args;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Fragment.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Fragment.java
new file mode 100644
index 0000000..7e95333
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Fragment.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.MessageType;
+
+@MessageType(string = "fragment")
+public class Fragment extends Operation {
+ public String data;
+ public int num;
+ public int total;
+
+ public Fragment() {}
+
+ public Fragment(String data, int num, int total) {
+ this.data = data;
+ this.num = num;
+ this.total = total;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Operation.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Operation.java
new file mode 100644
index 0000000..0477e39
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Operation.java
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.Message;
+import com.jilk.ros.message.ros.message.MessageType;
+import com.jilk.ros.message.ros.rosbridge.implementation.JSON;
+import com.jilk.ros.message.ros.rosbridge.implementation.Registry;
+
+@MessageType(string = "operation")
+public class Operation extends Message {
+ private static Long uid = 0L;
+
+ public String op;
+ public String id;
+
+ public Operation() {
+ this.op = getMessageType(getClass());
+ this.id = nextId();
+ }
+
+ private static synchronized String nextId() {
+ String result = uid.toString();
+ uid++;
+ return result;
+ }
+
+ public String toJSON() {
+ return JSON.toJSON(this);
+ }
+
+ public static Operation toOperation(String json, Registry registry) {
+ return ((Wrapper) JSON.toMessage(json, Wrapper.class, registry)).msg;
+ }
+
+ public static void initialize(Registry registry) {
+ initClass(registry, Advertise.class);
+ initClass(registry, Authenticate.class);
+ initClass(registry, CallService.class);
+ initClass(registry, Fragment.class);
+ initClass(registry, Operation.class);
+ initClass(registry, PNG.class);
+ initClass(registry, Publish.class);
+ initClass(registry, ServiceResponse.class);
+ initClass(registry, SetStatusLevel.class);
+ initClass(registry, Status.class);
+ initClass(registry, Subscribe.class);
+ initClass(registry, Unadvertise.class);
+ initClass(registry, Unsubscribe.class);
+ initClass(registry, Wrapper.class);
+
+ registry.register(Wrapper.class, Message.getMessageType(Publish.class), Publish.class);
+ registry.register(Wrapper.class, Message.getMessageType(CallService.class), CallService.class);
+ registry.register(Wrapper.class, Message.getMessageType(ServiceResponse.class), ServiceResponse.class);
+ }
+
+ private static void initClass(Registry registry, Class extends Message> c) {
+ registry.register(Message.class, Message.getMessageType(c), c);
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/PNG.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/PNG.java
new file mode 100644
index 0000000..1544a01
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/PNG.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.MessageType;
+
+@MessageType(string = "png")
+public class PNG extends Operation {
+ public String data;
+ public Integer num; // use Integer for optional items
+ public Integer total; // use Integer for optional items
+
+ public PNG() {}
+
+ public PNG(String data) {
+ this.data = data;
+ }
+
+ public PNG(String data, int num, int total) {
+ this.data = data;
+ this.num = num;
+ this.total = total;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Publish.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Publish.java
new file mode 100644
index 0000000..c1a85ab
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Publish.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.Message;
+import com.jilk.ros.message.ros.message.MessageType;
+import com.jilk.ros.message.ros.rosbridge.indication.Indicated;
+import com.jilk.ros.message.ros.rosbridge.indication.Indicator;
+
+@MessageType(string = "publish")
+public class Publish extends Operation {
+
+ @Indicator
+ public String topic;
+ @Indicated
+ public Message msg;
+
+ public Publish() {}
+
+ public Publish(String topic, Message msg) {
+ this.topic = topic;
+ this.msg = msg;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/ServiceResponse.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/ServiceResponse.java
new file mode 100644
index 0000000..79f447f
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/ServiceResponse.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.Message;
+import com.jilk.ros.message.ros.message.MessageType;
+import com.jilk.ros.message.ros.rosbridge.indication.Indicated;
+import com.jilk.ros.message.ros.rosbridge.indication.Indicator;
+
+@MessageType(string = "service_response")
+public class ServiceResponse extends Operation {
+ @Indicator
+ public String service;
+ public boolean result;
+ @Indicated
+ public Message values;
+
+ public ServiceResponse() {}
+
+ public ServiceResponse(String service) {
+ this.service = service;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/SetStatusLevel.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/SetStatusLevel.java
new file mode 100644
index 0000000..6ce1737
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/SetStatusLevel.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.MessageType;
+
+@MessageType(string = "set_level")
+public class SetStatusLevel extends Operation {
+ public String level;
+
+ public SetStatusLevel() {}
+
+ public SetStatusLevel(String level) {
+ this.level = null;
+ if ("none".equals(level) ||
+ "warning".equals(level) ||
+ "error".equals(level) ||
+ "info".equals(level))
+ this.level = level;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Status.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Status.java
new file mode 100644
index 0000000..cc21bc3
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Status.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.MessageType;
+
+@MessageType(string = "status")
+public class Status extends Operation {
+ String level;
+ String msg;
+
+ public Status() {}
+
+ public Status(String level, String msg) {
+ this.level = level;
+ this.msg = msg;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Subscribe.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Subscribe.java
new file mode 100644
index 0000000..af18a6c
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Subscribe.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.MessageType;
+
+@MessageType(string = "subscribe")
+public class Subscribe extends Operation {
+ public String topic;
+ public String type;
+ public Integer throttle_rate; // use Integer for optional items
+ public Integer queue_length; // use Integer for optional items
+ public Integer fragment_size; // use Integer for optional items
+ public String compression;
+
+ public Subscribe() {}
+
+ public Subscribe(String topic, String type) {
+ this.topic = topic;
+ this.type = type;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Unadvertise.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Unadvertise.java
new file mode 100644
index 0000000..b3fd482
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Unadvertise.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.MessageType;
+
+@MessageType(string = "unadvertise")
+public class Unadvertise extends Operation {
+ public String topic;
+
+ public Unadvertise() {}
+
+ public Unadvertise(String topic) {
+ this.topic = topic;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Unsubscribe.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Unsubscribe.java
new file mode 100644
index 0000000..108e3ac
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Unsubscribe.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.MessageType;
+
+@MessageType(string = "unsubscribe")
+public class Unsubscribe extends Operation {
+ public String topic;
+
+ public Unsubscribe() {}
+
+ public Unsubscribe(String topic) {
+ this.topic = topic;
+ }
+}
diff --git a/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Wrapper.java b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Wrapper.java
new file mode 100644
index 0000000..2a8cdc1
--- /dev/null
+++ b/src/Logistics/app/src/main/java/com/jilk/ros/message/ros/rosbridge/operation/Wrapper.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2014 Jilk Systems, Inc.
+ *
+ * This file is part of the Java ROSBridge Client.
+ *
+ * The Java ROSBridge Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Java ROSBridge Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
+ *
+ */
+package com.jilk.ros.message.ros.rosbridge.operation;
+
+import com.jilk.ros.message.ros.message.MessageType;
+import com.jilk.ros.message.ros.rosbridge.indication.Indicated;
+import com.jilk.ros.message.ros.rosbridge.indication.Indicator;
+
+@MessageType(string = "wrapper")
+public class Wrapper extends Operation {
+ @Indicator
+ public String op;
+ @Indicated
+ public Operation msg;
+
+ public Wrapper() {}
+}
diff --git a/src/Logistics/app/src/main/res/layout/activity_no_pick.xml b/src/Logistics/app/src/main/res/layout/activity_search.xml
similarity index 100%
rename from src/Logistics/app/src/main/res/layout/activity_no_pick.xml
rename to src/Logistics/app/src/main/res/layout/activity_search.xml
diff --git a/src/Logistics/app/src/main/res/layout/my_fragment1.xml b/src/Logistics/app/src/main/res/layout/frag_find.xml
similarity index 100%
rename from src/Logistics/app/src/main/res/layout/my_fragment1.xml
rename to src/Logistics/app/src/main/res/layout/frag_find.xml
diff --git a/src/Logistics/app/src/main/res/layout/my_fragment2.xml b/src/Logistics/app/src/main/res/layout/frag_pickup.xml
similarity index 100%
rename from src/Logistics/app/src/main/res/layout/my_fragment2.xml
rename to src/Logistics/app/src/main/res/layout/frag_pickup.xml
diff --git a/src/Logistics/app/src/main/res/layout/my_fragment3.xml b/src/Logistics/app/src/main/res/layout/frag_set.xml
similarity index 100%
rename from src/Logistics/app/src/main/res/layout/my_fragment3.xml
rename to src/Logistics/app/src/main/res/layout/frag_set.xml
diff --git a/src/Logistics/app/src/test/java/com/example/logistics/ExampleUnitTest.java b/src/Logistics/app/src/test/java/com/example/logistics/ExampleUnitTest.java
index 47cc96f..e7ae3eb 100644
--- a/src/Logistics/app/src/test/java/com/example/logistics/ExampleUnitTest.java
+++ b/src/Logistics/app/src/test/java/com/example/logistics/ExampleUnitTest.java
@@ -11,7 +11,8 @@ import static org.junit.Assert.*;
*/
public class ExampleUnitTest {
@Test
+
public void addition_isCorrect() {
- assertEquals(4, 2 + 2);
+ assertEquals(, 2 + 2);
}
}
\ No newline at end of file
diff --git a/src/server/src/main/java/com/example/testdemo/manager/QueueManager.java b/src/server/src/main/java/com/example/testdemo/manager/ServerManager.java
similarity index 97%
rename from src/server/src/main/java/com/example/testdemo/manager/QueueManager.java
rename to src/server/src/main/java/com/example/testdemo/manager/ServerManager.java
index b3f3898..829c657 100644
--- a/src/server/src/main/java/com/example/testdemo/manager/QueueManager.java
+++ b/src/server/src/main/java/com/example/testdemo/manager/ServerManager.java
@@ -24,17 +24,17 @@ import java.util.concurrent.atomic.AtomicInteger;
@Slf4j
@ServerEndpoint("/result")
@Component
-public class QueueManager {
+public class ServerManager {
@Autowired
private GoodManager gmanager;
private static String TAG = "SendObjectMessage";
private static AtomicInteger onlineCount = new AtomicInteger(0);
- private static ConcurrentLinkedQueue socket = new ConcurrentLinkedQueue();
+ private static ConcurrentLinkedQueue socket = new ConcurrentLinkedQueue();
private Session session;
- private QueueManager mObject = null;
+ private ServerManager mObject = null;
@OnOpen
public void onOpen(Session session) {