Merged Mock49 and fixed bugs
- Error where mock would not read in the files when running from the jar. - Error where the AC35 stream now no longer sends us packets with information that is set for 0 for boat location. #story[881] #pair[fwy13, esa46
This commit is contained in:
@@ -36,44 +36,100 @@ public class BoatLocationDecoder {
|
||||
private BoatLocation message;
|
||||
|
||||
public BoatLocationDecoder(byte[] encodedBoatLocation) {
|
||||
messageVersionNumber = encodedBoatLocation[0];
|
||||
time = Arrays.copyOfRange(encodedBoatLocation, 1, 7);
|
||||
sourceID = Arrays.copyOfRange(encodedBoatLocation, 7, 11);
|
||||
seqNum = Arrays.copyOfRange(encodedBoatLocation, 11, 15);
|
||||
deviceType = encodedBoatLocation[15];
|
||||
latitude = Arrays.copyOfRange(encodedBoatLocation, 16, 20);
|
||||
longitude = Arrays.copyOfRange(encodedBoatLocation,20, 24);
|
||||
altitude = Arrays.copyOfRange(encodedBoatLocation, 24, 28);
|
||||
heading = Arrays.copyOfRange(encodedBoatLocation,28, 30);
|
||||
pitch =Arrays.copyOfRange(encodedBoatLocation,30,32);
|
||||
roll = Arrays.copyOfRange(encodedBoatLocation,32,34);
|
||||
boatSpeed = Arrays.copyOfRange(encodedBoatLocation,34,36);
|
||||
cog = Arrays.copyOfRange(encodedBoatLocation,36,38);
|
||||
sog = Arrays.copyOfRange(encodedBoatLocation,38, 40);
|
||||
apparentWindSpeed = Arrays.copyOfRange(encodedBoatLocation, 40, 42);
|
||||
apparentWindAngle = Arrays.copyOfRange(encodedBoatLocation, 42, 44);
|
||||
trueWindSpeed = Arrays.copyOfRange(encodedBoatLocation,44, 46);
|
||||
trueWindDirection = Arrays.copyOfRange(encodedBoatLocation, 46, 48);
|
||||
trueWindAngle = Arrays.copyOfRange(encodedBoatLocation, 48, 50);
|
||||
currentDrift = Arrays.copyOfRange(encodedBoatLocation,50,52);
|
||||
currentSet = Arrays.copyOfRange(encodedBoatLocation,52, 54);
|
||||
rudderAngle = Arrays.copyOfRange(encodedBoatLocation,54, 56);
|
||||
byte numMessageVersionNumber = 0;
|
||||
long numTime = 0;
|
||||
int numSourceID = 0;
|
||||
int numSeqNum = 0;
|
||||
byte numDeviceType = 0;
|
||||
int numLatitude = 0;
|
||||
int numLongitude = 0;
|
||||
int numAltitude = 0;
|
||||
int numHeading = 0;
|
||||
short numPitch = 0;
|
||||
short numRoll = 0;
|
||||
int numBoatSpeed = 0;
|
||||
int numCog = 0;
|
||||
int numSog = 0;
|
||||
int numApparentWindSpeed = 0;
|
||||
short numApparentWindAngle = 0;
|
||||
int numTrueWindSpeed = 0;
|
||||
short numTrueWindDirection = 0;
|
||||
short numTrueWindAngle = 0;
|
||||
int numCurrentDrift = 0;
|
||||
int numCurrentSet = 0;
|
||||
short numRudderAngle = 0;
|
||||
|
||||
try {
|
||||
messageVersionNumber = encodedBoatLocation[0];
|
||||
numMessageVersionNumber = messageVersionNumber;
|
||||
time = Arrays.copyOfRange(encodedBoatLocation, 1, 7);
|
||||
numTime = bytesToLong(time);
|
||||
sourceID = Arrays.copyOfRange(encodedBoatLocation, 7, 11);
|
||||
numSourceID = bytesToInt(sourceID);
|
||||
seqNum = Arrays.copyOfRange(encodedBoatLocation, 11, 15);
|
||||
numSeqNum = bytesToInt(seqNum);
|
||||
deviceType = encodedBoatLocation[15];
|
||||
numDeviceType = deviceType;
|
||||
latitude = Arrays.copyOfRange(encodedBoatLocation, 16, 20);
|
||||
numLatitude = bytesToInt(latitude);
|
||||
longitude = Arrays.copyOfRange(encodedBoatLocation, 20, 24);
|
||||
numLongitude = bytesToInt(longitude);
|
||||
altitude = Arrays.copyOfRange(encodedBoatLocation, 24, 28);
|
||||
numAltitude = bytesToInt(altitude);
|
||||
heading = Arrays.copyOfRange(encodedBoatLocation, 28, 30);
|
||||
numHeading = bytesToInt(heading);
|
||||
pitch = Arrays.copyOfRange(encodedBoatLocation, 30, 32);
|
||||
numPitch = bytesToShort(pitch);
|
||||
roll = Arrays.copyOfRange(encodedBoatLocation, 32, 34);
|
||||
numRoll = bytesToShort(roll);
|
||||
boatSpeed = Arrays.copyOfRange(encodedBoatLocation, 34, 36);
|
||||
numBoatSpeed = bytesToInt(boatSpeed);
|
||||
cog = Arrays.copyOfRange(encodedBoatLocation, 36, 38);
|
||||
numCog = bytesToInt(cog);
|
||||
sog = Arrays.copyOfRange(encodedBoatLocation, 38, 40);
|
||||
numSog = bytesToInt(sog);
|
||||
apparentWindSpeed = Arrays.copyOfRange(encodedBoatLocation, 40, 42);
|
||||
numApparentWindSpeed = bytesToInt(apparentWindSpeed);
|
||||
apparentWindAngle = Arrays.copyOfRange(encodedBoatLocation, 42, 44);
|
||||
numApparentWindAngle = bytesToShort(apparentWindAngle);
|
||||
trueWindSpeed = Arrays.copyOfRange(encodedBoatLocation, 44, 46);
|
||||
numTrueWindSpeed = bytesToInt(trueWindSpeed);
|
||||
trueWindDirection = Arrays.copyOfRange(encodedBoatLocation, 46, 48);
|
||||
numTrueWindDirection = bytesToShort(trueWindSpeed);
|
||||
trueWindAngle = Arrays.copyOfRange(encodedBoatLocation, 48, 50);
|
||||
numTrueWindAngle = bytesToShort(trueWindSpeed);
|
||||
currentDrift = Arrays.copyOfRange(encodedBoatLocation, 50, 52);
|
||||
numCurrentDrift = bytesToInt(currentDrift);
|
||||
currentSet = Arrays.copyOfRange(encodedBoatLocation, 52, 54);
|
||||
numCurrentSet = bytesToShort(currentSet);
|
||||
rudderAngle = Arrays.copyOfRange(encodedBoatLocation, 54, 56);
|
||||
numRudderAngle = bytesToShort(rudderAngle);
|
||||
} catch(ArrayIndexOutOfBoundsException e){
|
||||
|
||||
}
|
||||
|
||||
message = new BoatLocation(numMessageVersionNumber, numTime,
|
||||
numSourceID, numSeqNum, numDeviceType, numLatitude,
|
||||
numLongitude, numAltitude, numHeading, numPitch,
|
||||
numRoll, numBoatSpeed, numCog, numSog, numApparentWindSpeed,
|
||||
numApparentWindAngle, numTrueWindSpeed, numTrueWindDirection,
|
||||
numTrueWindAngle, numCurrentDrift, numCurrentSet, numRudderAngle
|
||||
);/*
|
||||
message = new BoatLocation(messageVersionNumber, bytesToLong(time),
|
||||
bytesToInt(sourceID), bytesToInt(seqNum),
|
||||
deviceType, bytesToInt(latitude),
|
||||
bytesToInt(longitude), bytesToInt(altitude),
|
||||
bytesToInt(heading), bytesToShort(pitch),
|
||||
bytesToShort(roll), bytesToInt(boatSpeed),
|
||||
bytesToInt(cog), bytesToInt(sog),
|
||||
bytesToInt(apparentWindSpeed), bytesToShort(apparentWindAngle),
|
||||
bytesToInt(trueWindSpeed), bytesToShort(trueWindDirection),
|
||||
bytesToShort(trueWindAngle), bytesToInt(currentDrift),
|
||||
bytesToInt(currentSet), bytesToShort(rudderAngle)
|
||||
);*/
|
||||
|
||||
// System.out.println(bytesToInt(sourceID));
|
||||
// System.out.println(bytesToInt(boatSpeed));
|
||||
|
||||
message = new BoatLocation(messageVersionNumber, bytesToLong(time),
|
||||
bytesToInt(sourceID), bytesToInt(seqNum),
|
||||
deviceType, bytesToInt(latitude),
|
||||
bytesToInt(longitude), bytesToInt(altitude),
|
||||
bytesToInt(heading), bytesToShort(pitch),
|
||||
bytesToShort(roll), bytesToInt(boatSpeed),
|
||||
bytesToInt(cog), bytesToInt(sog),
|
||||
bytesToInt(apparentWindSpeed), bytesToShort(apparentWindAngle),
|
||||
bytesToInt(trueWindSpeed), bytesToShort(trueWindDirection),
|
||||
bytesToShort(trueWindAngle), bytesToInt(currentDrift),
|
||||
bytesToInt(currentSet), bytesToShort(rudderAngle)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class RaceStatus extends AC35Data {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use status booleans
|
||||
*
|
||||
* @return race status number
|
||||
*/
|
||||
public int getRaceStatus()
|
||||
|
||||
Reference in New Issue
Block a user