Removed BoatInRace from shared model, refactored
#story[778]
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package seng302.Networking;
|
||||
|
||||
import SharedModel.BoatInRace;
|
||||
import com.sun.jmx.remote.internal.ArrayQueue;
|
||||
|
||||
import seng302.Model.Boat;
|
||||
import seng302.Networking.MessageEncoders.RaceVisionByteEncoder;
|
||||
import seng302.Networking.MessageEncoders.XMLMessageEncoder;
|
||||
import seng302.Networking.Utils.BoatLocationMessage;
|
||||
@@ -10,7 +10,7 @@ import seng302.Networking.Utils.RaceStatus;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ public class MockOutput implements Runnable
|
||||
|
||||
public MockOutput() throws IOException {
|
||||
lastHeartbeatTime = System.currentTimeMillis();
|
||||
serverSocket = new ServerSocket(5003);
|
||||
serverSocket = new ServerSocket(4942);
|
||||
}
|
||||
/**
|
||||
* calculates the time since last heartbeat
|
||||
@@ -78,7 +78,7 @@ public class MockOutput implements Runnable
|
||||
/**
|
||||
* Used to give the mocOutput information about boat location to be made into a message and sent
|
||||
*/
|
||||
public synchronized void parseBoatLocation(BoatInRace boat){
|
||||
public synchronized void parseBoatLocation(Boat boat){
|
||||
BoatLocationMessage boatLocationMessage = new BoatLocationMessage(boat, boatLocationSequenceNumber);
|
||||
//iterates the sequence number
|
||||
boatLocationSequenceNumber++;
|
||||
|
||||
@@ -4,9 +4,8 @@ package seng302.Networking.Utils;
|
||||
* Created by f123 on 21-Apr-17.
|
||||
*/
|
||||
|
||||
import SharedModel.BoatInRace;
|
||||
import SharedModel.Constants;
|
||||
import SharedModel.GPSCoordinate;
|
||||
import seng302.Model.Boat;
|
||||
|
||||
/**
|
||||
* Represents the information in a boat location message (AC streaming spec: 4.9).
|
||||
@@ -149,7 +148,7 @@ public class BoatLocationMessage extends AC35Data
|
||||
this.rudderAngle = rudderAngle;
|
||||
}
|
||||
|
||||
public BoatLocationMessage(BoatInRace boat, long sequenceNumber) {
|
||||
public BoatLocationMessage(Boat boat, long sequenceNumber) {
|
||||
super(MessageType.BOATLOCATION);
|
||||
|
||||
this.messageVersionNumber = (byte) 1;
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
package seng302.Networking;
|
||||
import org.xml.sax.SAXException;
|
||||
import seng302.Mock.*;
|
||||
import seng302.Networking.BinaryMessageDecoder;
|
||||
import seng302.Networking.MessageDecoders.*;
|
||||
import seng302.Networking.Utils.*;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.text.ParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static seng302.Networking.Utils.ByteConverter.bytesToInt;
|
||||
import static seng302.Networking.Utils.ByteConverter.bytesToShort;
|
||||
import static seng302.Networking.Utils.MessageType.*;
|
||||
|
||||
/**
|
||||
* TCP server to act as the mock AC35 streaming interface
|
||||
@@ -99,6 +92,7 @@ public class VisualiserInput implements Runnable
|
||||
|
||||
public void run(){
|
||||
try{
|
||||
System.out.println("running");
|
||||
//receiver loop that gets the input
|
||||
boolean receiverLoop = true;
|
||||
while(receiverLoop) {
|
||||
@@ -132,7 +126,7 @@ public class VisualiserInput implements Runnable
|
||||
//no decoder for this.
|
||||
break;
|
||||
case XMLMESSAGE:
|
||||
// System.out.println("XML Message!");
|
||||
System.out.println("XML Message!");
|
||||
XMLMessage xml = (XMLMessage) data;
|
||||
try {
|
||||
if (xml.getXmlMsgSubType() == xml.XMLTypeRegatta){
|
||||
|
||||
Reference in New Issue
Block a user