Renamed sharedModel module to racevisionGame - this is intended to be our single module program.

Moved Boat/MockBoat/VisualiserBoat into it.
Moved Polars, polarParser, VMG, and polar exception.
Moved the networking stuff into it.
Moved angle, azimuth, bearing into it.
Moved gpscoordinate into it.
Moved mark/compoundMark into it.
Moved leg into it.
Moved trackpoint into it.
This commit is contained in:
fjc40
2017-07-04 15:53:17 +12:00
parent 93c1199392
commit bbbb1f2eb0
50 changed files with 5594 additions and 15 deletions
@@ -0,0 +1,71 @@
package network.PacketDump;
import seng302.Networking.BinaryMessageDecoder;
import seng302.Networking.Exceptions.InvalidMessageException;
import seng302.Networking.Messages.AC35Data;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by fwy13 on 25/04/17.
*/
public class AC35DumpReader {
private byte[] dump;
private ArrayList<AC35Packet> packets;
public AC35DumpReader(String url) throws IOException, URISyntaxException {
URL uri = getClass().getClassLoader().getResource(url);
Path path = Paths.get(uri.toURI());
dump = Files.readAllBytes(path);
packets = new ArrayList<>();
readAllPackets();
}
private void readAllPackets(){
int pointer = 0;
while(pointer < dump.length){
byte[] messLen = new byte[2];
messLen[1] = dump[pointer + 13];
messLen[0] = dump[pointer + 14];
int messageLength = ByteBuffer.wrap(messLen).getShort();
//System.out.println(messageLength);
packets.add(new AC35Packet(Arrays.copyOfRange(dump, pointer, pointer + messageLength + 19)));
pointer += 19 + messageLength;
}
for (AC35Packet pack: packets){
BinaryMessageDecoder decoder = new BinaryMessageDecoder(pack.getData());
try {
AC35Data data = decoder.decode();
}
catch (InvalidMessageException e) {
System.out.println(e.getMessage());
}
}
}
public static void main(String[] args){
try {
AC35DumpReader ac35DumpReader = new AC35DumpReader("dataDumps/ac35.bin");
} catch (IOException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,17 @@
package network.PacketDump;
/**
* Created by fwy13 on 25/04/17.
*/
public class AC35Packet {
byte[] data;
public AC35Packet(byte[] data){
this.data = data;
}
public byte[] getData() {
return data;
}
}