Created packet enum to class packets and started progress on how the packets are read and parsed according to the type of packet.

#story[820]
This commit is contained in:
Kusal Ekanayake
2017-04-24 15:50:21 +12:00
parent 3dc1a7f9c0
commit 403dc480c4
4 changed files with 85 additions and 3 deletions
@@ -6,16 +6,21 @@ package seng302.models.parsers;
public class StreamPacket {
//Change int to an ENUM for the type
private int type;
private PacketType type;
private long messageLength;
private long timeStamp;
private byte[] payload;
public StreamPacket(int type, long messageLength, long timeStamp, byte[] payload) {
this.type = type;
this.type = PacketType.assignPacketType(type);
this.messageLength = messageLength;
this.timeStamp = timeStamp;
this.payload = payload;
// System.out.println("type = " + type);
if (this.type == PacketType.BOAT_LOCATION){
System.out.println(this.type.toString());
StreamParser.extractBoatLocation(payload);
}
}
}