Initial commit V2
This commit is contained in:
@@ -56,7 +56,6 @@ public class Controller {
|
||||
final BasePlate basePlate;
|
||||
RoomTemperatureBasePlate roomTemperatureBasePlate;
|
||||
static /*Panel*/ MainPanel mainFrame;
|
||||
Device hexiposi;
|
||||
Device barcode_reader;
|
||||
Device barcode_reader_puck;
|
||||
Device puck_detection;
|
||||
@@ -305,12 +304,6 @@ public class Controller {
|
||||
}
|
||||
}
|
||||
|
||||
final DeviceListener hexiposiListener = new DeviceAdapter() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
updateView();
|
||||
}
|
||||
};
|
||||
|
||||
final DeviceListener barcodeReaderListener = new DeviceAdapter() {
|
||||
@Override
|
||||
@@ -346,22 +339,6 @@ public class Controller {
|
||||
};
|
||||
|
||||
void updateDevices() {
|
||||
if (hexiposi != null) {
|
||||
hexiposi.removeListener(hexiposiListener);
|
||||
}
|
||||
if (barcode_reader != null) {
|
||||
hexiposi.removeListener(barcodeReaderListener);
|
||||
}
|
||||
if (puck_detection != null) {
|
||||
hexiposi.removeListener(puckDetectionListener);
|
||||
}
|
||||
hexiposi = (Device) getMainFrame().getDevice("hexiposi");
|
||||
if (hexiposi != null) {
|
||||
hexiposi.addListener(hexiposiListener);
|
||||
} else {
|
||||
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, "No hexiposi detected.");
|
||||
}
|
||||
mainFrame.hexiposiPanel.setDevice(hexiposi);
|
||||
barcode_reader = (Device) getDevice("barcode_reader");
|
||||
if (barcode_reader != null) {
|
||||
barcode_reader.addListener(barcodeReaderListener);
|
||||
@@ -429,16 +406,8 @@ public class Controller {
|
||||
updateView();
|
||||
}
|
||||
|
||||
public String getHexiposiPosition() {
|
||||
try {
|
||||
return (String) ((ReadbackDevice) hexiposi).getReadback().take();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSelectedPuck(Puck puck) {
|
||||
return ("" + puck.getSegment()).equalsIgnoreCase(getHexiposiPosition());
|
||||
return puck.isSegmentSelected();
|
||||
}
|
||||
|
||||
public List<Puck> getSelectedPucks() {
|
||||
@@ -773,7 +742,7 @@ public class Controller {
|
||||
Puck.Detection[] detection = basePlate.getDetection();
|
||||
for (int i = 0; i < Controller.NUMBER_OF_PUCKS; i++) {
|
||||
Puck puck = basePlate.getPucks()[i];
|
||||
//Only manage pucks for current hexiposi position
|
||||
|
||||
if (isSelectedPuck(puck)) {
|
||||
boolean detectedPuckInserted = (currentDetection[i] != Puck.Detection.Present) && (detection[i] == Puck.Detection.Present);
|
||||
boolean detectedPuckRemoved = (currentDetection[i] != Puck.Detection.Empty) && (detection[i] == Puck.Detection.Empty);
|
||||
|
||||
Reference in New Issue
Block a user