This commit is contained in:
gac-S_Changer
2018-06-08 16:27:07 +02:00
parent 01528ae2b1
commit eb45f26d1c
6 changed files with 703 additions and 164 deletions

View File

@@ -4,19 +4,20 @@
package ch.psi.mxsc;
import ch.psi.pshell.core.Context;
import ch.psi.pshell.core.DevicePool;
import ch.psi.pshell.core.DevicePoolListener;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.DeviceListener;
import ch.psi.pshell.device.GenericDevice;
import ch.psi.pshell.device.ProcessVariableBase;
import ch.psi.pshell.device.ReadbackDevice;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.script.ScriptException;
import javax.swing.JComponent;
@@ -28,7 +29,7 @@ public class Controller {
static Controller instance;
final BasePlate basePlate;
final /*Panel*/ MainPanel mainFrame;
Device hexaposi;
Device hexiposi;
public static Controller getInstance() {
return instance;
@@ -69,7 +70,7 @@ public class Controller {
}
void onInitialize(int runCount) {
GenericDevice former = getMainFrame().getDevice("BasePlate");
GenericDevice former = getDevice("BasePlate");
if (former != null) {
getMainFrame().removeDevice(former);
}
@@ -101,13 +102,17 @@ public class Controller {
detection = new EseraDetection((Device) getMainFrame().getDevice(PUCK_ESERA_DEVICE));
}
}
hexaposi = (Device) getMainFrame().getDevice("hexiposi");
hexaposi.addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateView();
}
});
hexiposi = (Device) getMainFrame().getDevice("hexiposi");
if (hexiposi!=null){
hexiposi.addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateView();
}
});
} else {
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, "No hexiposi detected.");
}
}
final PuckState[] puckState;
@@ -145,7 +150,7 @@ public class Controller {
}
public String getHexiposiPosition() {
return (String) ((ReadbackDevice) hexaposi).getReadback().take();
return (String) ((ReadbackDevice) hexiposi).getReadback().take();
}
public Boolean isLedRoomTemp() {
@@ -203,5 +208,16 @@ public class Controller {
onPuckPressed(sample.getPuck());
}
GenericDevice getDevice(String name){
return getMainFrame().getDevice(name);
}
DevicePool getDevicePool(){
return getMainFrame().getContext().getDevicePool();
}
Context getContext(){
return getMainFrame().getContext();
}
}