mock.app.App now tells mock.app.Event that the xml file strings are XMLFileType.Contents.

Made network.MessageEncoders.RaceVisionByteEncoder methods static (they were effectively static already).

shared.dataInput.XMLReader#readXMLFileToString(..) now throws an XMLReaderException if the file cannot be found.

visualiser.Controllers.StartController assumed XML messages were resource paths instead of file contents - fixed.

Testing:
networking tests now work again.
This commit is contained in:
fjc40
2017-07-20 01:01:29 +12:00
parent 4bcfc01ceb
commit 5cddaaed8e
24 changed files with 1031 additions and 142 deletions
@@ -84,7 +84,7 @@ public class RaceVisionByteEncoder {
return raceStatusMessage.array();
}
public byte[] displayTextMessage(RaceMessage[] message){
public static byte[] displayTextMessage(RaceMessage[] message){
//ByteBuffer result = ByteBuffer.allocate(4 + numLines * 32);
int messageVersionNumber = 0b1;//version number
short ackNum = 0;//no clue what this does just a placeholder for 2 bytes.
@@ -125,7 +125,7 @@ public class RaceVisionByteEncoder {
return result.array();
}
public byte[] raceStartStatus(long time, short ack, long startTime, int raceID, char notification){
public static byte[] raceStartStatus(long time, short ack, long startTime, int raceID, char notification){
int messageVersion = 0b1;
byte[] timestamp = longToBytes(time, 6);
byte[] ackNumber = intToBytes(ack, 2);
@@ -144,7 +144,7 @@ public class RaceVisionByteEncoder {
return result.array();
}
public byte[] yachtEventCode(long time, short acknowledgeNumber, int raceID, int destSourceID, int incidentID,
public static byte[] yachtEventCode(long time, short acknowledgeNumber, int raceID, int destSourceID, int incidentID,
int eventID){
int messageVersion = 0b10;
byte[] encodeTime = longToBytes(time, 6);
@@ -165,7 +165,7 @@ public class RaceVisionByteEncoder {
return result.array();
}
public byte[] chatterText(int messageType, String message){
public static byte[] chatterText(int messageType, String message){
int messageVersion = 0b1;
byte[] type = intToBytes(messageType, 1);
byte[] text = message.getBytes();
@@ -268,7 +268,7 @@ public class RaceVisionByteEncoder {
return result.array();
}
public byte[] markRounding(int time, int ackNumber, int raceID, int sourceID, int boatStatus, int roundingSide, int markType, int markID){
public static byte[] markRounding(int time, int ackNumber, int raceID, int sourceID, int boatStatus, int roundingSide, int markType, int markID){
int messageVersionNumber = 0b1;
byte[] byteTime = longToBytes(time, 6);
byte[] byteAck = intToBytes(ackNumber, 2);
@@ -292,7 +292,7 @@ public class RaceVisionByteEncoder {
return result.array();
}
public byte[] courseWind(byte windID, ArrayList<CourseWind> courseWinds){
public static byte[] courseWind(byte windID, ArrayList<CourseWind> courseWinds){
int messageVersionNumber = 0b1;
byte byteWindID = windID;
byte[] loopcount = intToBytes(courseWinds.size(), 1);
@@ -313,7 +313,7 @@ public class RaceVisionByteEncoder {
return result.array();
}
public byte[] averageWind(int time, int rawPeriod, int rawSampleSpeed, int period2, int speed2, int period3, int speed3, int period4, int speed4){
public static byte[] averageWind(int time, int rawPeriod, int rawSampleSpeed, int period2, int speed2, int period3, int speed3, int period4, int speed4){
int messageVersionNumber = 0b1;
byte[] byteTime = longToBytes(time,6);
byte[] byteRawPeriod = intToBytes(rawPeriod, 2);