diff options
Diffstat (limited to 'mobileapp/src/smoots/udesign/packet/PhoneToServerPacket.java')
-rwxr-xr-x | mobileapp/src/smoots/udesign/packet/PhoneToServerPacket.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mobileapp/src/smoots/udesign/packet/PhoneToServerPacket.java b/mobileapp/src/smoots/udesign/packet/PhoneToServerPacket.java new file mode 100755 index 0000000..f677034 --- /dev/null +++ b/mobileapp/src/smoots/udesign/packet/PhoneToServerPacket.java @@ -0,0 +1,25 @@ +package smoots.udesign.packet;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+/**
+ * Packet object from phone to the server.
+ */
+public class PhoneToServerPacket implements Packet {
+ private HashMap<String, Float> packetMap;
+
+ public PhoneToServerPacket(int type, float x, float y, float color) {
+ this.packetMap = new HashMap<String, Float>();
+ this.packetMap.put("type", (float) type);
+ this.packetMap.put("x", x);
+ this.packetMap.put("y", y);
+ this.packetMap.put("color", color);
+ }
+
+ public String packetToText() {
+ return new JSONObject(this.packetMap).toString();
+ }
+
+}
|