mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Fixed a method that was converting the timestamp bytes incorrectly
- If an argument is passed to the application, it will use the internal mock server Tags: #story[820]
This commit is contained in:
@@ -12,21 +12,28 @@ public class App extends Application
|
|||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
|
||||||
Parent root = FXMLLoader.load(getClass().getResource("/views/MainView.fxml"));
|
Parent root = FXMLLoader.load(getClass().getResource("/views/MainView.fxml"));
|
||||||
primaryStage.setTitle("RaceVision");
|
primaryStage.setTitle("RaceVision");
|
||||||
primaryStage.setScene(new Scene(root));
|
primaryStage.setScene(new Scene(root));
|
||||||
|
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
StreamReceiver sr;
|
||||||
|
|
||||||
|
if (args.length > 1){
|
||||||
|
sr = new StreamReceiver("localhost", 8085, "TestThread1");
|
||||||
|
}
|
||||||
|
else{
|
||||||
//StreamReceiver sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941,"TestThread1");
|
//StreamReceiver sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941,"TestThread1");
|
||||||
StreamReceiver sr = new StreamReceiver("livedata.americascup.com", 4941, "TestThread1");
|
sr = new StreamReceiver("livedata.americascup.com", 4941, "TestThread1");
|
||||||
|
}
|
||||||
|
|
||||||
sr.start();
|
sr.start();
|
||||||
StreamParser streamParser = new StreamParser("TestThread2");
|
StreamParser streamParser = new StreamParser("TestThread2");
|
||||||
streamParser.start();
|
streamParser.start();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
launch(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,11 +139,11 @@ public class StreamParser extends Thread{
|
|||||||
private static void extractRaceStatus(StreamPacket packet){
|
private static void extractRaceStatus(StreamPacket packet){
|
||||||
byte[] payload = packet.getPayload();
|
byte[] payload = packet.getPayload();
|
||||||
int messageVersionNo = payload[0];
|
int messageVersionNo = payload[0];
|
||||||
long currentTime = extractTimeStamp(Arrays.copyOfRange(payload,1,7), 6);
|
long currentTime = bytesToLong(Arrays.copyOfRange(payload,1,7));
|
||||||
long raceId = bytesToLong(Arrays.copyOfRange(payload,7,11));
|
long raceId = bytesToLong(Arrays.copyOfRange(payload,7,11));
|
||||||
int raceStatus = payload[11];
|
int raceStatus = payload[11];
|
||||||
// System.out.println("raceStatus = " + raceStatus);
|
// System.out.println("raceStatus = " + raceStatus);
|
||||||
long expectedStartTime = extractTimeStamp(Arrays.copyOfRange(payload,12,18), 6);
|
long expectedStartTime = bytesToLong(Arrays.copyOfRange(payload,12,18));
|
||||||
DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||||
format.setTimeZone(TimeZone.getTimeZone("UTC"));
|
format.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
long timeTillStart = ((new Date (expectedStartTime)).getTime() - (new Date (currentTime)).getTime())/1000;
|
long timeTillStart = ((new Date (expectedStartTime)).getTime() - (new Date (currentTime)).getTime())/1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user