Preliminary implementation of SwissMX RT

This commit is contained in:
2023-04-26 09:22:59 +02:00
parent f961ee0758
commit a904eac8eb
9 changed files with 321 additions and 137 deletions

View File

@@ -0,0 +1,47 @@
package ch.psi.mxsc;
import static ch.psi.mxsc.Controller.NUMBER_OF_PUCKS;
import static ch.psi.mxsc.Controller.instance;
import ch.psi.pshell.core.Context;
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.ui.Panel;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
*/
public class ControllerRT extends Controller{
ControllerRT(Panel mainFrame) {
//basePlate = new BasePlate();
basePlate.addListener(basePlateListener);
setPuckLoading(false);
}
final DeviceListener basePlateListener = new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
if (value != null) {
String segment = ((Object[]) value)[0].toString();
Integer puck = (Integer) ((Object[]) value)[1];
Integer sample = (Integer) ((Object[]) value)[2];
mainFrame.onSelectionChanged(segment, puck, sample);
} else {
mainFrame.onSelectionChanged(null, null, null);
}
}
};
void onTimer() {
try {
refreshSamplesTable();
} catch (Exception ex) {
Logger.getLogger(Controller.class.getName()).log(Level.WARNING, null, ex);
}
}
}