blob: f677034abd5565d1d10053694b5709c03631a6bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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();
}
}
|