Merge branch 'cbt-multi-controller' of eng-git.canterbury.ac.nz:seng302-2017/team-7 into cbt-multi-controller

main
fjc40 9 years ago
commit 669b8167cd

@ -52,15 +52,16 @@ public class ControllerClient {
byte[] bytes = new byte[4];
ByteBuffer.wrap(bytes).putInt(key.getProtocolCode());
BoatActionEnum boatActionEnum = BoatActionEnum.fromByte(bytes[3]);
BoatAction boatAction = new BoatAction(BoatActionEnum.fromByte(bytes[3]));
BoatAction boatAction = new BoatAction(boatActionEnum);
byte[] encodedBoatAction = RaceVisionByteEncoder.boatActionMessage(boatAction);
BinaryMessageEncoder binaryMessage = new BinaryMessageEncoder(MessageType.BOATACTION, System.currentTimeMillis(), 0,
(short) encodedBoatAction.length, encodedBoatAction);
System.out.println("Sending out key: " + protocolCode);
System.out.println("Sending out key: " + boatActionEnum);
outputStream.write(binaryMessage.getFullMessage());
}
}

@ -49,8 +49,7 @@ public class ControllerServer implements Runnable {
BinaryMessageDecoder encodedMessage = new BinaryMessageDecoder(message);
BoatActionDecoder boatActionDecoder = new BoatActionDecoder(encodedMessage.getMessageBody());
BoatActionEnum decodedMessage = boatActionDecoder.getBoatAction();
int key = decodedMessage.getValue();
System.out.println("Received key: " + key);
System.out.println("Received key: " + decodedMessage);
}
} catch (IOException e) {
e.printStackTrace();

Loading…
Cancel
Save