Skip to content
Snippets Groups Projects
Commit 6e8cd85f authored by Lukas Friedrichsen's avatar Lukas Friedrichsen
Browse files

final release v2

parent 11f96b72
Branches
No related tags found
No related merge requests found
Showing
with 35 additions and 27 deletions
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
<classpathentry kind="lib" path="D:/Users/Philipp/gitlab/VInf/Praktikum/VINF_MaerklinControl/controlsfx-8.40.12.jar"/> <classpathentry kind="lib" path="/home/lukas/VInf/Praktikum/VINF_MaerklinControl/controlsfx-8.40.12.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
/gui/ /gui/
/server/
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -87,7 +87,7 @@ public class MainApp extends Application { ...@@ -87,7 +87,7 @@ public class MainApp extends Application {
@Override @Override
public void start(Stage primaryStage) { public void start(Stage primaryStage) {
this.primaryStage = primaryStage; this.primaryStage = primaryStage;
this.primaryStage.setTitle("Mrklin Control Client"); this.primaryStage.setTitle("Mrklin Control Client");
this.primaryStage.getIcons().add(new Image("file:res/BO.png")); this.primaryStage.getIcons().add(new Image("file:res/BO.png"));
initRootLayout(); initRootLayout();
initTabs(); initTabs();
...@@ -394,6 +394,7 @@ public class MainApp extends Application { ...@@ -394,6 +394,7 @@ public class MainApp extends Application {
e.printStackTrace(); e.printStackTrace();
} }
finally { finally {
if (connectionEstablished) {
try { try {
// Properly shuts down the connection to the server in case of an unexpected termination of the client-instance // Properly shuts down the connection to the server in case of an unexpected termination of the client-instance
byte[] datagram = {Properties.SEPERATOR, (byte) 0x00, (byte) 0x00, (byte) Properties.SESSION_ABORT, (byte) 0x00, (byte) 0x00}; byte[] datagram = {Properties.SEPERATOR, (byte) 0x00, (byte) 0x00, (byte) Properties.SESSION_ABORT, (byte) 0x00, (byte) 0x00};
...@@ -401,8 +402,15 @@ public class MainApp extends Application { ...@@ -401,8 +402,15 @@ public class MainApp extends Application {
client.close(); client.close();
connectionEstablished = false; connectionEstablished = false;
running = false; running = false;
settingsController.updateSettingsStatus(); Platform.runLater(new Runnable() {
// Sets the connection-esttablishing-buttons text to "Verbindung herstellen"
@Override
public void run() {
CONTROLLER_INSTANCE.settingsController.updateSettingsStatus();
}
});
} catch (Exception e) { } catch (Exception e) {
setStatus("Error at: establishConnection (shutting down connection)"); setStatus("Error at: establishConnection (shutting down connection)");
e.printStackTrace(); e.printStackTrace();
...@@ -411,6 +419,7 @@ public class MainApp extends Application { ...@@ -411,6 +419,7 @@ public class MainApp extends Application {
} }
} }
} }
}
/* /*
* Diese Runnable-Klasse lauscht auf dem Update-Port des Servers auf Status-Updates, * Diese Runnable-Klasse lauscht auf dem Update-Port des Servers auf Status-Updates,
......
...@@ -66,7 +66,6 @@ public class EngineController { ...@@ -66,7 +66,6 @@ public class EngineController {
public void handleEngineDirection(){ public void handleEngineDirection(){
eng.setDirection(engineFwdButton.isSelected()); eng.setDirection(engineFwdButton.isSelected());
eng.setSpeed(0);
mainApp.setEngineDirection(eng); mainApp.setEngineDirection(eng);
updateEngineStatus(); updateEngineStatus();
} }
...@@ -81,15 +80,15 @@ public class EngineController { ...@@ -81,15 +80,15 @@ public class EngineController {
engineFwdButton.setSelected(eng.getDirection().get()); engineFwdButton.setSelected(eng.getDirection().get());
engineRevButton.setSelected(!eng.getDirection().get()); engineRevButton.setSelected(!eng.getDirection().get());
if (eng.getDirection().get()) if (eng.getDirection().get())
status.append("vorwrts"); status.append("vorwrts");
else else
status.append("rckwrts"); status.append("rckwrts");
mainApp.setStatus(status.toString()); mainApp.setStatus(status.toString());
} }
public void setSelectedEngine(Engine eng){ public void setSelectedEngine(Engine eng){
this.eng = eng; this.eng = eng;
mainApp.setStatus(eng.toString() + " ausgewhlt"); mainApp.setStatus(eng.toString() + " ausgewhlt");
updateEngineStatus(); updateEngineStatus();
} }
......
...@@ -67,7 +67,6 @@ public class Engine { ...@@ -67,7 +67,6 @@ public class Engine {
throw e; throw e;
} }
udpProtocol.changeEngineDirection(engineID, engineDirection); udpProtocol.changeEngineDirection(engineID, engineDirection);
listener.listen();
} }
public void setEngineSpeed(int newEngineSpeed) throws Exception { public void setEngineSpeed(int newEngineSpeed) throws Exception {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment