This commit is contained in:
@@ -14,17 +14,17 @@ import ch.psi.pshell.device.DeviceListener;
|
||||
import ch.psi.pshell.device.GenericDevice;
|
||||
import ch.psi.pshell.device.ReadbackDevice;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.Audio;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Window;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -245,7 +245,7 @@ public class Controller {
|
||||
refreshSamplesTable();
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(Controller.class.getName()).log(Level.WARNING, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final DeviceListener hexiposiListener = new DeviceAdapter() {
|
||||
@@ -689,8 +689,16 @@ public class Controller {
|
||||
return puckLoading;
|
||||
}
|
||||
|
||||
void playSound(String name){
|
||||
try{
|
||||
Audio.playFile(new File(Context.getInstance().getSetup().expandPath("{home}/sounds/" + name + ".wav")));
|
||||
} catch (Exception ex){
|
||||
Logger.getLogger(Controller.class.getName()).log(Level.FINE, null, ex);
|
||||
}
|
||||
}
|
||||
void onPuckBarcode(String datamatrix) {
|
||||
if (isPuckLoading()) {
|
||||
playSound("mounted");
|
||||
getMainFrame().setPuckDatamatrix(datamatrix);
|
||||
System.out.println("Detected Puck: " + datamatrix);
|
||||
}
|
||||
@@ -712,6 +720,7 @@ public class Controller {
|
||||
boolean detectedPuckInserted = (currentDetection[i] != Puck.Detection.Present) && (detection[i] == Puck.Detection.Present);
|
||||
boolean detectedPuckRemoved = (currentDetection[i] != Puck.Detection.Empty) && (detection[i] == Puck.Detection.Empty);
|
||||
if (detectedPuckInserted) {
|
||||
playSound("mounted");
|
||||
if (!datamatrix.isEmpty()) {
|
||||
getMainFrame().setPuckDatamatrix(null);
|
||||
linkPuckDatamatrix(puck, datamatrix);
|
||||
@@ -719,6 +728,7 @@ public class Controller {
|
||||
askPuckDatamatrix(puck);
|
||||
}
|
||||
} else if (detectedPuckRemoved) {
|
||||
playSound("unmounted");
|
||||
linkPuckDatamatrix(puck, null);
|
||||
}
|
||||
}
|
||||
@@ -832,5 +842,5 @@ public class Controller {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user