Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules

This commit is contained in:
Fan-Wu Yang
2017-05-04 13:42:28 +12:00
15 changed files with 109 additions and 42 deletions
@@ -100,28 +100,28 @@ public class BoatLocationMessage extends AC35Data
/**
* Ctor, with all parameters.
*
* @param messageVersionNumber
* @param time
* @param sourceID
* @param sequenceNumber
* @param deviceType
* @param latitude
* @param longitude
* @param altitude
* @param heading
* @param pitch
* @param roll
* @param boatSpeed
* @param boatCOG
* @param boatSOG
* @param apparentWindSpeed
* @param apparentWindAngle
* @param trueWindSpeed
* @param trueWindDirection
* @param trueWindAngle
* @param currentDrift
* @param currentSet
* @param rudderAngle
* @param messageVersionNumber message number
* @param time time of message
* @param sourceID id of boat
* @param sequenceNumber number of boat message
* @param deviceType type of boat
* @param latitude lat of boat
* @param longitude lon of boat
* @param altitude altitude of boat
* @param heading heading of boat
* @param pitch pitch of boat
* @param roll roll of boat
* @param boatSpeed boats speed
* @param boatCOG boat cog
* @param boatSOG boat sog
* @param apparentWindSpeed wind speed
* @param apparentWindAngle wind angle
* @param trueWindSpeed true wind speed
* @param trueWindDirection true wind direction
* @param trueWindAngle true wind angle
* @param currentDrift current drift
* @param currentSet current set
* @param rudderAngle rudder angle
*/
public BoatLocationMessage(byte messageVersionNumber, long time, int sourceID, long sequenceNumber, byte deviceType, int latitude, int longitude, int altitude, int heading, short pitch, short roll, int boatSpeed, int boatCOG, int boatSOG, int apparentWindSpeed, short apparentWindAngle, int trueWindSpeed, int trueWindDirection, short trueWindAngle, int currentDrift, int currentSet, short rudderAngle) {
super(MessageType.BOATLOCATION);
@@ -25,15 +25,28 @@ public class ByteConverter {
//Integer
//////////////////////////////////////////////////
/**
* @param bite bite to convert
* @return int
*/
public static int bytesToInt(byte bite){
byte[] bytes = {bite};
return bytesToInt(bytes, ByteOrder.LITTLE_ENDIAN);
}
/**
* @param bytes bytes to convert
* @return int
*/
public static int bytesToInt(byte[] bytes){
return bytesToInt(bytes, ByteOrder.LITTLE_ENDIAN);
}
/**
* @param bytes bytes to convert
* @param byteOrder order of the bytes
* @return int
*/
public static int bytesToInt(byte[] bytes, ByteOrder byteOrder){
byte[] bites = convertBytesToNum(bytes,byteOrder, IntegerSize);
return ByteBuffer.wrap(bites).order(byteOrder).getInt();
@@ -144,7 +157,7 @@ public class ByteConverter {
* @param i the integer to be converted
* @param size Size that the byte array should be
* @param byteOrder the order that the bytes should be ie Big Endian
* @return
* @return bytes array
*/
public static byte[] intToBytes(int i ,int size, ByteOrder byteOrder){
ByteBuffer buffer = ByteBuffer.allocate(IntegerSize);
@@ -171,7 +184,7 @@ public class ByteConverter {
* @param i the Long to be converted
* @param size Size that the byte array should be
* @param byteOrder the order that the bytes should be ie Big Endian
* @return
* @return byte array
*/
public static byte[] longToBytes(long i ,int size, ByteOrder byteOrder){
ByteBuffer buffer = ByteBuffer.allocate(LongSize);
@@ -198,7 +211,7 @@ public class ByteConverter {
* @param i the Short to be converted
* @param size Size that the byte array should be
* @param byteOrder the order that the bytes should be ie Big Endian
* @return
* @return byte array
*/
public static byte[] shortToBytes(short i ,int size, ByteOrder byteOrder){
ByteBuffer buffer = ByteBuffer.allocate(ShortSize);
@@ -225,7 +238,7 @@ public class ByteConverter {
* @param i the Char to be converted
* @param size Size that the byte array should be
* @param byteOrder the order that the bytes should be ie Big Endian
* @return
* @return byte array
*/
public static byte[] charToBytes(char i ,int size, ByteOrder byteOrder){
ByteBuffer buffer = ByteBuffer.allocate(CharSize);