Commit 688c9e08 authored by Ivan Dages's avatar Ivan Dages
Browse files

debug termination

parent 9de55d50
......@@ -22,6 +22,7 @@ import fr.ill.ics.core.property.PropertyManager;
import fr.ill.ics.nscclient.servant.ControllerServant;
import fr.ill.ics.nscclient.serverconnection.ServerInstance;
import fr.ill.ics.util.ConfigManager;
import javafx.application.Platform;
/**
* @author dages
......@@ -47,6 +48,8 @@ public class NomadLinker {
}
public void init(String[] args) {
Logger.getLogger("nomad-3d").info("Initializing nomad server connection...");
Application.This.init(args);
// Initialize the ConfigManager at the very beginning because it is in this class where all .nomad/settings.properties are initialized!
......@@ -71,7 +74,9 @@ public class NomadLinker {
// System.out.println("server value : " + prop.getServerValue());
}
// System.out.println("Loaded controllers : \n" + controllers);
displayActualPositions();
// displayActualPositions();
Logger.getLogger("nomad-3d").info("Nomad server connection initialized.");
}
public Set<String> getAxisControllersNames() {
......@@ -92,18 +97,34 @@ public class NomadLinker {
// TODO TEST
private void displayActualPositions() {
System.out.println("Controllers positions : ");
String properties[] = {
"actual_position",
"wanted_position",
"min_position",
"max_position",
"unit"
};
System.out.println("Controllers : ");
for (String controllerName : getAxisControllersNames()) {
double pos = Double.parseDouble(getServerValue(controllerName, "actual_position"));
System.out.println("\t" + controllerName + " : " + pos);
System.out.println(controllerName + " :");
for (String propertyName : properties) {
String val = getServerValue(controllerName, propertyName);
System.out.println("\t" + propertyName + " : " + val);
}
}
}
public void terminate() {
Logger.getLogger("nomad-3d").info("Terminating nomad server connection...");
controllers.clear();
// Close connection with Nomad Server
LoginManager.getInstance().logout(CommandZoneWrapper.SERVER_ID);
Application.This.terminate();
Logger.getLogger("nomad-3d").info("Nomad server connection terminated.");
}
......@@ -118,7 +139,7 @@ public class NomadLinker {
} catch (ClientAlreadyLaunchedException e) {
loginState = LOGIN_REFUSED;
} catch (ConnectionFailure e) {
System.exit(1);
Platform.exit();
}
return loginState;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment