Skip to content
Snippets Groups Projects
Commit 78281ab8 authored by Philipp Stenkamp's avatar Philipp Stenkamp
Browse files

Cleanup

Installer experiments
Still work to do
parent 624d02be
No related branches found
No related tags found
No related merge requests found
Showing
with 49 additions and 39 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="/home/lukas/VInf/Praktikum/VINF_MaerklinControl/controlsfx-8.40.12.jar"/> <classpathentry kind="lib" path="D:/Users/Philipp/gitlab/VInf/Praktikum/VINF_MaerklinControl/controlsfx-8.40.12.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
/build/
/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
...@@ -97,15 +97,14 @@ ...@@ -97,15 +97,14 @@
<fx:application id="fxApplication" <fx:application id="fxApplication"
name="Märklin Control" name="Märklin Control"
mainClass="gui.MainApp" mainClass="gui.MainApp"
toolkit="fx" version="1.0"
version="0.9"
/> />
<mkdir dir="build/classes/META-INF" /> <mkdir dir="build/classes/META-INF" />
<fx:jar destfile="dist/VINF_MaerklinControl.jar"> <fx:jar destfile="dist/rklin Control.jar">
<fx:application refid="fxApplication"/> <fx:application refid="fxApplication"/>
<fileset dir="build/classes"> <fileset dir="build/classes">
</fileset> </fileset>
...@@ -114,7 +113,7 @@ ...@@ -114,7 +113,7 @@
<manifest> <manifest>
<attribute name="Implementation-Vendor" value="lf.ps"/> <attribute name="Implementation-Vendor" value="lf.ps"/>
<attribute name="Implementation-Title" value="Märklin Control"/> <attribute name="Implementation-Title" value="Märklin Control"/>
<attribute name="Implementation-Version" value="0.9"/> <attribute name="Implementation-Version" value="1.0"/>
<attribute name="JavaFX-Feature-Proxy" value="None"/> <attribute name="JavaFX-Feature-Proxy" value="None"/>
</manifest> </manifest>
</fx:jar> </fx:jar>
...@@ -128,11 +127,11 @@ ...@@ -128,11 +127,11 @@
includeDT="false" includeDT="false"
offlineAllowed="true" offlineAllowed="true"
outdir="${basedir}/deploy" outdir="${basedir}/deploy"
outfile="VINF_MaerklinControl" nativeBundles="exe" outfile="rklin Control" nativeBundles="exe"
updatemode="background" > updatemode="background" >
<fx:platform basedir="${java.home}"/> <fx:platform basedir="${java.home}"/>
<fx:info title="VINF_MaerklinControl" vendor="lf.ps"/> <fx:info title="rklin Control" vendor="lf.ps"/>
<fx:application refId="fxApplication"/> <fx:application refId="fxApplication"/>
<fx:resources refid="appRes"/> <fx:resources refid="appRes"/>
......
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
...@@ -7,8 +7,6 @@ import java.net.Socket; ...@@ -7,8 +7,6 @@ import java.net.Socket;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import javax.xml.bind.DatatypeConverter;
import gui.model.Engine; import gui.model.Engine;
import gui.model.Switch; import gui.model.Switch;
import gui.model.Settings; import gui.model.Settings;
...@@ -306,7 +304,7 @@ public class MainApp extends Application { ...@@ -306,7 +304,7 @@ public class MainApp extends Application {
settingsController.updateSettingsStatus(); 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();
} }
} }
...@@ -323,9 +321,15 @@ public class MainApp extends Application { ...@@ -323,9 +321,15 @@ public class MainApp extends Application {
CONTROLLER_INSTANCE = controller; CONTROLLER_INSTANCE = controller;
} }
public void updateGUI () {
engineController.updateEngineStatus();
for (Switch sw : switches){
sw.getController().get().updateSwitchStatus();
}
}
@Override @Override
public void run() { public void run() {
Thread.yield();
if (!connectionEstablished) { if (!connectionEstablished) {
try (Socket socket = new Socket(configuration.getSocketAddress().get().getHostName(), configuration.getSocketAddress().get().getPort())) { try (Socket socket = new Socket(configuration.getSocketAddress().get().getHostName(), configuration.getSocketAddress().get().getPort())) {
client = socket; client = socket;
...@@ -346,22 +350,44 @@ public class MainApp extends Application { ...@@ -346,22 +350,44 @@ public class MainApp extends Application {
}); });
while (connectionEstablished) { while (connectionEstablished) {
Thread.sleep(100); Platform.runLater(new Runnable() {
@Override
public void run() {
updateGUI();
}
});
Thread.sleep(50);
} }
} }
catch (Exception e) { catch (Exception e) {
connectionEstablished = false;
running = false;
Platform.runLater(new Runnable() { Platform.runLater(new Runnable() {
@Override @Override
public void run() { public void run() {
CONTROLLER_INSTANCE.setStatus("Error at: establishConnection (establishing connection"); CONTROLLER_INSTANCE.setStatus("Error at: establishConnection (establishing connection)");
CONTROLLER_INSTANCE.settingsController.updateSettingsStatus();
} }
}); });
e.printStackTrace(); e.printStackTrace();
} }
finally { finally {
CONTROLLER_INSTANCE.UTILITY_THREAD_EXECUTOR.shutdownNow(); try {
byte[] datagram = {Properties.SEPERATOR, (byte) 0x00, (byte) 0x00, (byte) Properties.SESSION_ABORT, (byte) 0x00, (byte) 0x00};
out.write(datagram);
client.close();
connectionEstablished = false;
running = false;
settingsController.updateSettingsStatus();
} catch (Exception e) {
setStatus("Error at: establishConnection (shutting down connection)");
e.printStackTrace();
}
} }
} }
} }
...@@ -378,7 +404,7 @@ public class MainApp extends Application { ...@@ -378,7 +404,7 @@ public class MainApp extends Application {
} }
public void parseDatagram (byte[] datagram) { public void parseDatagram (byte[] datagram) {
System.out.println("2: "+DatatypeConverter.printHexBinary(datagram)); //System.out.println("2: "+DatatypeConverter.printHexBinary(datagram));
if (datagram.length < 5) { if (datagram.length < 5) {
setStatus("Error while updating!"); setStatus("Error while updating!");
return; return;
...@@ -409,13 +435,6 @@ public class MainApp extends Application { ...@@ -409,13 +435,6 @@ public class MainApp extends Application {
} }
} }
public void updateGUI () {
engineController.updateEngineStatus();
for (Switch sw : switches){
sw.getController().get().updateSwitchStatus();
}
}
@Override @Override
public void run() { public void run() {
int stopCounter, dataCounter, counter; int stopCounter, dataCounter, counter;
...@@ -445,7 +464,7 @@ public class MainApp extends Application { ...@@ -445,7 +464,7 @@ public class MainApp extends Application {
for (int i = 0; i < Properties.IN_BUFFER_SIZE; i++) { for (int i = 0; i < Properties.IN_BUFFER_SIZE; i++) {
datagram[i] = buffer[counter-Properties.IN_BUFFER_SIZE+i+1]; datagram[i] = buffer[counter-Properties.IN_BUFFER_SIZE+i+1];
} }
System.out.println("1: "+DatatypeConverter.printHexBinary(datagram)); //System.out.println("1: "+DatatypeConverter.printHexBinary(datagram));
parseDatagram(datagram); parseDatagram(datagram);
} }
else if (dataCounter > 5 && startByte) { else if (dataCounter > 5 && startByte) {
...@@ -457,14 +476,6 @@ public class MainApp extends Application { ...@@ -457,14 +476,6 @@ public class MainApp extends Application {
while (INPUT_STREAM.available() != 0) { while (INPUT_STREAM.available() != 0) {
INPUT_STREAM.read(); INPUT_STREAM.read();
} }
Platform.runLater(new Runnable() {
@Override
public void run() {
updateGUI();
}
});
Thread.sleep(50); Thread.sleep(50);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment