mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user