Commit Graph
126 Commits
Author SHA1 Message Date
fjc40 a32775eab6 Fixed a few javadoc issues. 2017-05-08 10:59:13 +12:00
fjc40 b247244665 Did some large tidy ups, refactoring, and documenting.
Network:
Moved the Network message classes from the Utils package to the Messages package.
Renamed BoatLocationMessage to BoatLocation and BoatStatusMessage to BoatStatus to be consistent with other message classes.
Renamed the BoatStatus enumeration to BoatStatusEnum as it conflicted with BoatStatus (the message).
Moved the BoatStatusEnum and MessageType enumerations from the Utils package to the Messages/Enums package.
Changed the BoatStatusEnum and MessageType enumerations to use map look ups in the enum.fromByte(b) method - this means that there's less copy and pasted values, and the fromByte function doesn't need to be modified if new enumerations are added.
Added a sequenceNumber member to the Heartbeat class.
Added an InvalidMessageException in the package Networking/Exceptions. This is thrown when a message is read, but it is invalid in some way.
Refactored/tidied up the Networking/BinaryMessageEncoder and Decoder classes. The decoder throws InvalidMessageExceptions instead of returning null.

Visualiser:
VisualiserInput now wraps a DataInputStream around the socket. This provides the stream.readFully(buffer) function, which is a blocking read, removing the need for busy wait loops. Replaced the getBytes() function with getNextMessage() and getNextMessageBytes(). These read the next message from the socket, and return it as a message object and a byte array, respectively.
Changed the current heartbeat timeout to 10 seconds. Added some work-in-progress code to attempt to reconnect when connection is lost. It currently doesn't work. I think Fan-Wu was doing a proper implementation, however.
VisualiserInput also has a queue of received events. Currently not really used, but could be useful in the future. Events get added as they are read.
Changed VisualiserInputs main loop to use instanceOf instead of switch+case. Feedback wanted - are there any downsides to using this instanceOf method?

#story[778,782]
2017-05-08 03:29:33 +12:00
fjc40 466e22437b Visualiser. The nullptr issues relating to the XML data files appears to be fixed. Essentially, the StartController.startRaceNoScaling() function was being called as soon possible, before it was even ready - setRaceClock either hadn't been called or hadn't finished executing yet, so the StartController.raceClock member was null, causing crashes.
Also changed the while(visualiserInput.getRaceStatus() == null) loops to an if-then-return early block. They caused the program to freeze if the race data source wasn't sending any race status messages (currently, our mock doesn't send any once the race has finished).

#story[782]
2017-05-07 18:34:44 +12:00
fjc40 020c0329b0 Merge remote-tracking branch 'origin/TCPDisconnection' into submission 2017-05-07 16:55:07 +12:00
fjc40 83ce9b99d2 Mockoutput's main loop now pops messages off the message queue, rather than iterating over it like an array, and clearing it (this could have threading issues where the iteration starts (with e.g., 5 messages), as it is sending the messages another one is added, and then it ends up clearing the sent messages, and the unsent message.
Made a few quick fixes (to be tidied a bit later) to Mock.Race class. It now has this.startTime, instead of the AnimationTimers having their own starTime value. RaceStatus messages are now sent properly (still need a refactor though), so they actually send the race star time - this means that the visualizer using the mock data source displays the correct time instead of (midnight, jan 1, 1970).

Removed one of the constructors from RaceStatus - it allowed for constructing and sending essentially invalid RaceStatus messages, and simply wasn't needed.

Added a temporary title ("RaceVision - Team 7") to the visualiser - may be worth changing when we decide on a team name.

Fixed a bug with the order of operations in visualiser.StartController.countdownTimer(). Calling begin race before hiding panes caused them to never be hidden.

Mock.Event. Changed the scaleFactor to 5x for the time being - to easier testing of things like pre-race timers, countdowns, etc...

#story[778,782]
2017-05-07 15:52:34 +12:00
David Wu 61ecdc2269 Merge branch 'submission' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into submission
# Conflicts:
#	visualiser/src/main/java/seng302/Controllers/MainController.java
#	visualiser/src/main/java/seng302/Controllers/StartController.java
#	visualiser/src/main/java/seng302/Model/Race.java
2017-05-06 20:23:01 +12:00
David Wu 61afe8d608 Created finish view to see when a race finishes.
-Implemented FinishController
-Fixed mock not sending Finish race status.

#Story[782]
2017-05-06 20:14:10 +12:00
cbt24 c038010bd2 Draws track for racing boats only to reduce information clutter.
- Add track point only when boat status is "Racing"

#story[782]
2017-05-06 19:22:20 +12:00
cbt24 cc824aa89a Removed unnecessary countdownTimer from Race in visualiser module
- Run method now calls simulateRace directly

#story[782]
2017-05-06 18:20:41 +12:00
cbt24 a6adfb4960 Refactored RaceClock to act as central source of time and duration information throughout visualiser.
- StartController and RaceController use same RaceClock instance
- RaceClock updates automatically as Runnable for consistent operation
- Duration between starting and current time is now an observable property of RaceClock

#story[782]
2017-05-06 18:02:48 +12:00
Fan-Wu Yang bdf215d0f1 TCP connection at the front menu will no longer bug out if the socket is bugged.
- Timeout set on connection socket so that the socket will return false after 5 seconds.
#story[782]
2017-05-06 16:55:12 +12:00
hba56 12e457824d fix for issue #5 gate lines
-removed drawing of lines between the marks as only the start and finish line should have a line drawn

 #story[782]
2017-05-06 16:31:40 +12:00
Fan-Wu Yang d52b09e74a Visualiser Closes All threads on exit now.
- Added override for exiting the Visualiser which closes all threads: such as the TCP connection.
#story[782]
2017-05-06 15:58:12 +12:00
Fan-Wu Yang a20dafea11 Annotations go on top and boundaries now update
- Fixed FPS and other annotations being hidden under the map
- Fixed boundaries not updating with the visualiser.
#story[782]
2017-05-06 15:46:38 +12:00
Fan-Wu Yang 982b47943a Fixed blocking issue
- Fixed byte stream error where it would reinitilise every run
#story[782]
2017-05-06 15:27:21 +12:00
Fan-Wu Yang b7f010a2fa Fixed Network While loops
- Removed while blocking loops and replaced them with return statements
#story[782]
2017-05-06 14:36:37 +12:00
Fan-Wu Yang 565b7adaa2 Merge remote-tracking branch 'origin/race-timer-fixes' into layeredCanvas
# Conflicts:
#	visualiser/src/main/java/seng302/Controllers/StartController.java
2017-05-04 16:55:01 +12:00
Fan-Wu Yang 862391d7ef Canvas Layer Created
- Canvas is created via layering.
- Resizable canvas is now a seperate abstract class
#story[782]
2017-05-04 16:54:06 +12:00
cbt24 349bd50094 Everything works, don't ask questions
#story[782]
2017-05-04 16:52:33 +12:00
Erika Savell 62db7f333c Frantically cherry-picking commit by commit
#story[778]
2017-05-04 16:33:07 +12:00
hba56andErika Savell 6888d0bddc fixed all java doc errors
#story[782]
2017-05-04 16:29:41 +12:00
hba56 e409c8752c Fix for now - Need to change 2017-05-04 14:56:54 +12:00
cbt24 89ba0f278d Fixed StartController countdown
- Removed obsolete timer related code
- Consistently use RaceClock throughout StartController

#story[782]
2017-05-04 14:16:14 +12:00
cbt24 17afd9f775 Merge remote-tracking branch 'origin/splitIntoTwoModules' into splitIntoTwoModules
# Conflicts:
#	visualiser/src/main/java/seng302/Controllers/StartController.java
2017-05-04 14:15:21 +12:00
cbt24 336a15d1a2 Fixed StartController countdown
- Removed obsolete timer related code
- Consistently use RaceClock throughout StartController

#story[782]
2017-05-04 14:11:00 +12:00
hba56 1f8941e37c Merge remote-tracking branch 'origin/splitIntoTwoModules' into splitIntoTwoModules 2017-05-04 13:41:14 +12:00
hba56 ccd90b91d7 Merge remote-tracking branch 'origin/splitIntoTwoModules' into splitIntoTwoModules 2017-05-04 13:40:45 +12:00
hba56 62ecd40967 fixed all java doc errors
#story[782]
2017-05-04 13:40:37 +12:00
David Wu 545ef7aa7f Fix lobby not entering race when race status is "started".
-Race was previously stuck in lobby screen when race status was not 2.

#Story[782]
2017-05-04 13:36:39 +12:00
cbt24 e345f08ad8 Fixed AC35 stream crashing before status sent.
#story[782]
2017-05-04 13:19:39 +12:00
hba56 aa1d38ca9f removed import * lines
#story[782]
2017-05-04 13:17:07 +12:00
David Wu a07a90dfea Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules 2017-05-04 13:14:35 +12:00
David Wu 88bb568ec7 Set it so the lobby view switches to race view depending on the race status passed in by the mock.
-Removed start button in lobby as it should be automatic.
-TODO: Synchronize the times across the whole race as they do not matching.

#Story[782]
2017-05-04 13:14:29 +12:00
cbt24 099995c41b Fixed start controller visibility issues.
#story[782]
2017-05-04 13:13:44 +12:00
hba56 15179a1cdf Merge remote-tracking branch 'origin/splitIntoTwoModules' into splitIntoTwoModules 2017-05-04 13:11:58 +12:00
hba56 810c3837c1 adding java doc tags
#story[782]
2017-05-04 13:11:14 +12:00
Fan-Wu Yang 43fb0df5be Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules 2017-05-04 13:07:13 +12:00
Fan-Wu Yang 874953f763 Fixed issue win ResizableRaceCanvas
- Issue where the boat position may mess up if it is called before the server has sent us information about hte location.
#story[782]
2017-05-04 13:07:05 +12:00
David Wu 34ef1172ce Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules 2017-05-04 12:48:24 +12:00
David Wu bf12f77796 Set it so the lobby view switches to race view depending on the race status passed in by the mock.
-Removed start button in lobby as it should be automatic.
-TODO: Synchronize the times across the whole race as they do not matching.

#Story[782]
2017-05-04 12:48:17 +12:00
hba56 db43acf935 Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules 2017-05-04 12:46:46 +12:00
hba56 86db16c83d updated the connection scene to let a user add their own connection
-added textfields to the fxml
-added scaling to the connection scene(in mainController)
-added a newConnection method and a method for getting the wrapper anchor pane

#story[782]
2017-05-04 12:46:27 +12:00
David Wu b60b4b257f Remove start button from StartController.
#story[778]
2017-05-04 12:41:14 +12:00
cbt24 cd55052654 Merge remote-tracking branch 'origin/splitIntoTwoModules' into splitIntoTwoModules 2017-05-04 12:38:26 +12:00
cbt24 c1fa760dde Streamlined clock handling.
- Set starting time from network
- Update RaceClock instance to current time from network

#story[782]
2017-05-04 12:38:21 +12:00
Erika Savell 98723b88d4 Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules 2017-05-04 12:26:04 +12:00
Erika Savell cfa6ba1c3f Fixed speed notbeing displayed from AC35 live data
- Turns out the AC35 stream gives the speed in the SOG (speed over ground) section, not the boat speed section

#story[782]
2017-05-04 12:25:50 +12:00
Joseph Gardner 618073d04e Merge remote-tracking branch 'origin/splitIntoTwoModules' into splitIntoTwoModules 2017-05-04 12:11:47 +12:00
Joseph Gardner 94ad164a45 Boat table and positions now update. #story[782] 2017-05-04 12:11:36 +12:00
Joseph Gardner e43353c322 Boat table and positions now update. #story[782] 2017-05-04 12:10:13 +12:00