Merging main features into story 6. App now sends and receives key strokes. #story[1007, 1089]

This commit is contained in:
Joseph Gardner
2017-07-27 12:36:34 +12:00
parent 0ea7fb8c84
commit 6492ba89ab
6 changed files with 58 additions and 21 deletions
@@ -43,7 +43,7 @@ public class Event {
private Event() {
try {
this.raceXML = getRaceXMLAtCurrentTime(XMLReader.readXMLFileToString("mock/mockXML/raceTest.xml", StandardCharsets.UTF_8));
this.boatXML = XMLReader.readXMLFileToString("mock/mockXML/boatTest.xml", StandardCharsets.UTF_8);
this.boatXML = XMLReader.readXMLFileToString("mock/mockXML/boatsSinglePlayer.xml", StandardCharsets.UTF_8);
this.regattaXML = XMLReader.readXMLFileToString("mock/mockXML/regattaTest.xml", StandardCharsets.UTF_8);
this.xmlFileType = XMLFileType.Contents;
@@ -60,6 +60,7 @@ public class ControllerClient {
BinaryMessageEncoder binaryMessage = new BinaryMessageEncoder(MessageType.BOATACTION, System.currentTimeMillis(), 0,
(short) encodedBoatAction.length, encodedBoatAction);
System.out.println("Sending out key: " + protocolCode);
outputStream.write(binaryMessage.getFullMessage());
}
}
@@ -50,6 +50,7 @@ public class ControllerServer implements Runnable {
BoatActionDecoder boatActionDecoder = new BoatActionDecoder(encodedMessage.getMessageBody());
BoatActionEnum decodedMessage = boatActionDecoder.getBoatAction();
int key = decodedMessage.getValue();
System.out.println("Received key: " + key);
}
} catch (IOException e) {
e.printStackTrace();