commit 21/03/2025
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#Mon Mar 17 15:01:40 WIB 2025
|
||||
#Fri Mar 21 14:45:24 ICT 2025
|
||||
AudioPhase1=C\:\\Users\\rdkar\\OneDrive\\Documents\\IntelliJ Project\\ErhaCam\\audio\\phase1.mp3
|
||||
AudioPhase2=C\:\\Users\\rdkar\\OneDrive\\Documents\\IntelliJ Project\\ErhaCam\\audio\\phase2.mp3
|
||||
AudioPhase3=C\:\\Users\\rdkar\\OneDrive\\Documents\\IntelliJ Project\\ErhaCam\\audio\\phase3.mp3
|
||||
@@ -11,7 +11,7 @@ CameraConfigLeft90={"Brightness"\:0.0,"Contrast"\:0.0,"Saturation"\:0.0,"Hue"\:0
|
||||
CameraConfigRight45={"Brightness"\:0.0,"Contrast"\:0.0,"Saturation"\:0.0,"Hue"\:0.0,"Gain"\:1.0,"Exposure"\:1.0,"Sharpness"\:0.0,"Gamma"\:0.0,"AutoExposure"\:true,"AutoFocus"\:true,"AutoWhiteBalance"\:true}
|
||||
CameraConfigRight90={"Brightness"\:0.0,"Contrast"\:0.0,"Saturation"\:0.0,"Hue"\:0.0,"Gain"\:1.0,"Exposure"\:1.0,"Sharpness"\:0.0,"Gamma"\:0.0,"AutoExposure"\:true,"AutoFocus"\:true,"AutoWhiteBalance"\:true}
|
||||
CameraLeft45=
|
||||
CameraLeft90=ACER QHD User Facing
|
||||
CameraLeft90=OBSBOT Meet 2 StreamCamera
|
||||
CameraRight45=
|
||||
CameraRight90=
|
||||
FTPHost=192.168.10.2
|
||||
@@ -19,7 +19,7 @@ FTPPass=password
|
||||
FTPPath=/
|
||||
FTPPort=21
|
||||
FTPUser=user
|
||||
PhotoDirectory=C\:\\Users\\rdkar\\OneDrive\\Desktop\\Erha Capture
|
||||
PhotoDirectory=C\:\\Users\\Erha\\Desktop\\ErhaCapture
|
||||
cascadeMaxSize=500
|
||||
cascadeMinNeighbors=3
|
||||
cascadeMinSize=250
|
||||
|
||||
BIN
countdown321.wav
Normal file
BIN
countdown321.wav
Normal file
Binary file not shown.
BIN
data_barcode_tidak_ditemukan.wav
Normal file
BIN
data_barcode_tidak_ditemukan.wav
Normal file
Binary file not shown.
24350
haarcascade_frontalface_alt.xml
Normal file
24350
haarcascade_frontalface_alt.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
kesalahan_server.wav
Normal file
BIN
kesalahan_server.wav
Normal file
Binary file not shown.
@@ -13,6 +13,7 @@ import javafx.stage.StageStyle;
|
||||
import javafx.util.Duration;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class AutoCloseAlert {
|
||||
|
||||
@@ -43,8 +44,9 @@ public class AutoCloseAlert {
|
||||
* @param header the header of the alert
|
||||
* @param content the content of the alert
|
||||
* @param seconds the number of seconds before the alert is closed, or put 0 to keep it open
|
||||
* @param onClose What to do after auto close
|
||||
*/
|
||||
public static void show(String title, String header, String content, int seconds) {
|
||||
public static void show(String title, String header, String content, int seconds, Consumer<String> onClose) {
|
||||
Platform.runLater(()->{
|
||||
// close previous alert before showing a new one
|
||||
Optional.ofNullable(currentAlertStage).ifPresent(Stage::close);
|
||||
@@ -88,6 +90,7 @@ public class AutoCloseAlert {
|
||||
if (currentAlertStage == alertStage) {
|
||||
currentAlertStage = null;
|
||||
}
|
||||
if (onClose!=null) onClose.accept(shownTitle);
|
||||
clear();
|
||||
} );
|
||||
delay.play();
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javafx.scene.control.Alert.AlertType;
|
||||
import org.bytedeco.javacv.OpenCVFrameGrabber;
|
||||
@@ -77,6 +78,8 @@ public class CaptureView {
|
||||
private String audio_upload_gagal = "upload_gagal.wav";
|
||||
private String audio_countdown = "countdown321.wav";
|
||||
private String audio_tahan_posisi = "tahan_posisi.wav";
|
||||
private String audio_data_barcode_tidak_ditemukan = "data_barcode_tidak_ditemukan.wav";
|
||||
private String audio_kesalahan_server = "kesalahan_server.wav";
|
||||
|
||||
private List<String> cams;
|
||||
|
||||
@@ -131,7 +134,7 @@ public class CaptureView {
|
||||
private void TakePhotos(){
|
||||
boolean has_face = Arrays.stream(have_face).anyMatch(AtomicBoolean::get);
|
||||
if (has_face){
|
||||
AutoCloseAlert.show("Pengambilan Foto", "Tahan Posisi Anda", "Proses ini kurang lebih 3 detik", 5);
|
||||
AutoCloseAlert.show("Pengambilan Foto", "Tahan Posisi Anda", "Proses ini kurang lebih 3 detik", 5, null);
|
||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||
if (!audioPlayer.getCurrentFile().equals(audio_countdown)) {
|
||||
audioPlayer.StopCurrentPlayback();
|
||||
@@ -170,7 +173,7 @@ public class CaptureView {
|
||||
|
||||
double sharpness = CalculateSharpness(image1.getBestMat());
|
||||
if (sharpness<sharpness_threshold){
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at Camera 1 with sharpness score "+sharpness, 5);
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at Camera 1 with sharpness score "+sharpness, 5, null);
|
||||
return null;
|
||||
}
|
||||
PhotoResult p1 = image1.TakePhoto(directory,prefix);
|
||||
@@ -188,7 +191,7 @@ public class CaptureView {
|
||||
image2.RemapROI(0.1,0.3, false);
|
||||
double sharpness = CalculateSharpness(image2.getBestMat());
|
||||
if (sharpness<sharpness_threshold){
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at Camera 2 with sharpness score "+sharpness, 5);
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at Camera 2 with sharpness score "+sharpness, 5, null);
|
||||
return null;
|
||||
}
|
||||
PhotoResult p2 = image2.TakePhoto(directory,prefix);
|
||||
@@ -207,7 +210,7 @@ public class CaptureView {
|
||||
image3.RemapROI(0.1,0.3, false);
|
||||
double sharpness = CalculateSharpness(image3.getBestMat());
|
||||
if (sharpness<sharpness_threshold){
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at Camera 3 with sharpness score "+sharpness, 5);
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at Camera 3 with sharpness score "+sharpness, 5, null);
|
||||
return null;
|
||||
}
|
||||
PhotoResult p3 = image3.TakePhoto(directory,prefix);
|
||||
@@ -228,7 +231,7 @@ public class CaptureView {
|
||||
image4.RemapROI(0.1,0.3, false);
|
||||
double sharpness = CalculateSharpness(image4.getBestMat());
|
||||
if (sharpness<sharpness_threshold){
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at Camera 4 with sharpness score "+sharpness, 5);
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at Camera 4 with sharpness score "+sharpness, 5, null);
|
||||
return null;
|
||||
}
|
||||
PhotoResult p4 = image4.TakePhoto(directory,prefix);
|
||||
@@ -249,7 +252,7 @@ public class CaptureView {
|
||||
image5.RemapROI(0.1,0.3, false);
|
||||
double sharpness = CalculateSharpness(image5.getBestMat());
|
||||
if (sharpness<sharpness_threshold){
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at Camera 5 with sharpness score "+sharpness, 5);
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at Camera 5 with sharpness score "+sharpness, 5, null);
|
||||
return null;
|
||||
}
|
||||
PhotoResult p5 = image5.TakePhoto(directory,prefix);
|
||||
@@ -320,7 +323,7 @@ public class CaptureView {
|
||||
else if (lowest==score3) culprit = "camera 3";
|
||||
else if (lowest==score4) culprit = "camera 4";
|
||||
else if (lowest==score5) culprit = "camera 5";
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at "+culprit+" with sharpness score "+lowest, 5);
|
||||
AutoCloseAlert.show("Take Photos Failed", "Blurred Image Detected", "Blurred Image Detected at "+culprit+" with sharpness score "+lowest, 5, null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -472,7 +475,7 @@ public class CaptureView {
|
||||
long duration = (System.nanoTime() - nanostart) / 1000000; // in milliseconds
|
||||
System.out.println("TakePhotos duration: "+duration+" ms");
|
||||
|
||||
AutoCloseAlert.show("Photos Taken", "Photos Taken", "Photos Taken", 5);
|
||||
AutoCloseAlert.show("Photos Taken", "Photos Taken", "Photos Taken", 5, null);
|
||||
|
||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||
if (!audioPlayer.getCurrentFile().equals(audio_pengambilan_berhasil)) {
|
||||
@@ -527,7 +530,7 @@ public class CaptureView {
|
||||
audioPlayer.PlayFile(audio_upload_berhasil, ps);
|
||||
} else System.out.println("audioPlayer already playing upload berhasil");
|
||||
}
|
||||
AutoCloseAlert.show("Upload Success", "Upload Success", "Upload Success", 5);
|
||||
AutoCloseAlert.show("Upload Success", "Upload Success", "Upload Success", 5, null);
|
||||
Platform.runLater(()->{
|
||||
barcodeData.setText("");
|
||||
medicalRecordID.setText("");
|
||||
@@ -546,7 +549,7 @@ public class CaptureView {
|
||||
} else System.out.println("audioPlayer already playing upload gagal");
|
||||
|
||||
}
|
||||
AutoCloseAlert.show("Upload Failed", "Upload Failed", "Upload Failed", 5);
|
||||
AutoCloseAlert.show("Upload Failed", "Upload Failed", "Upload Failed", 5, null);
|
||||
Platform.runLater(()->{
|
||||
barcodeData.setText("");
|
||||
medicalRecordID.setText("");
|
||||
@@ -563,7 +566,7 @@ public class CaptureView {
|
||||
|
||||
|
||||
} else {
|
||||
AutoCloseAlert.show("Error", "No Face Detected", "No Face Detected", 5);
|
||||
AutoCloseAlert.show("Error", "No Face Detected", "No Face Detected", 5, null);
|
||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||
if (!audioPlayer.getCurrentFile().equals(audio_posisikan_muka)) {
|
||||
audioPlayer.StopCurrentPlayback();
|
||||
@@ -587,6 +590,8 @@ public class CaptureView {
|
||||
audio_upload_gagal = ExtractResource("/upload_gagal.wav");
|
||||
audio_countdown = ExtractResource("/countdown321.wav");
|
||||
audio_tahan_posisi = ExtractResource("/tahan_posisi.wav");
|
||||
audio_kesalahan_server = ExtractResource("/kesalahan_server.wav");
|
||||
audio_data_barcode_tidak_ditemukan = ExtractResource("/data_barcode_tidak_ditemukan.wav");
|
||||
|
||||
|
||||
//tambahan 19/03/2025
|
||||
@@ -600,7 +605,7 @@ public class CaptureView {
|
||||
AutoCloseAlert.close();
|
||||
}
|
||||
} else {
|
||||
AutoCloseAlert.show("Scan Barcode", "Silahkan Scan Barcode Anda", "Arahkan kertas barcode ke kamera", 0);
|
||||
AutoCloseAlert.show("Scan Barcode", "Silahkan Scan Barcode Anda", "Arahkan kertas barcode ke kamera", 0, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -896,7 +901,7 @@ public class CaptureView {
|
||||
Platform.runLater(()-> barcodeData.setText(finalbarCode));
|
||||
Task<PatientRecord> checkpatientID = new Task<>() {
|
||||
@Override
|
||||
protected PatientRecord call() {
|
||||
protected PatientRecord call() throws Exception {
|
||||
BarcodeResullt br = erhaAPI.Validate_Barcode(finalbarCode,true);
|
||||
if (br!=null){
|
||||
if (br.message.startsWith("Records found")){
|
||||
@@ -906,13 +911,29 @@ public class CaptureView {
|
||||
if (!pr.name.isEmpty()){
|
||||
super.succeeded();
|
||||
return pr;
|
||||
} else System.out.println("PatientRecord name is empty");
|
||||
} else System.out.println("PatientRecord medical_record_detail_id is empty");
|
||||
} else System.out.println("BarcodeResullt data is empty");
|
||||
} else System.out.println("BarcodeResullt message is not Records found");
|
||||
} else System.out.println("BarcodeResullt is null");
|
||||
super.failed();
|
||||
return null;
|
||||
} else {
|
||||
Logger.error("Barcode ",finalbarCode," PatientRecord name is empty");
|
||||
throw new Exception("Barcode "+finalbarCode+" PatientRecord name kosong");
|
||||
}
|
||||
} else {
|
||||
Logger.error("Barcode ",finalbarCode," PatientRecord medical_record_detail_id is empty");
|
||||
throw new Exception("Data dengan barcode "+finalbarCode+", PatientRecord medical_record_detail_id kosong");
|
||||
}
|
||||
} else {
|
||||
Logger.error("Record associated with barcode ",finalbarCode," is empty");
|
||||
//AutoCloseAlert.show("Data Tidak Ditemukan","Data dengan barcode "+finalbarCode+" ditemukan di server, tetapi kosong","Pastikan data barcode anda benar", 5);
|
||||
throw new Exception("Data dengan barcode "+finalbarCode+" ditemukan di server, tetapi kosong");
|
||||
}
|
||||
} else {
|
||||
Logger.error("Record associated with barcode ",finalbarCode," is not found");
|
||||
//AutoCloseAlert.show("Data Tidak Ditemukan","Data dengan barcode "+finalbarCode+" tidak ditemukan di server","Pastikan data barcode anda benar",5);
|
||||
throw new Exception("Data dengan barcode "+finalbarCode+" tidak ditemukan di server");
|
||||
}
|
||||
} else {
|
||||
Logger.error("BarcodeResullt with barcode ",finalbarCode," is null");
|
||||
//AutoCloseAlert.show("Data Tidak Ditemukan", "BarcodeResult dengan barcode "+finalbarCode+" menghasilkan null", "Pastikan data barcode anda benar", 5);
|
||||
throw new Exception("BarcodeResult dengan barcode "+finalbarCode+" menghasilkan null");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -937,15 +958,23 @@ public class CaptureView {
|
||||
});
|
||||
|
||||
checkpatientID.setOnFailed(event -> {
|
||||
audioPlayer.PlayFile(audio_data_barcode_tidak_ditemukan,ps);
|
||||
Task<?> failed = (Task<?>) event.getSource();
|
||||
Throwable t = failed.getException();
|
||||
final String message = t.getMessage();
|
||||
System.out.println("checkpatientID.setOnFailed message : "+message);
|
||||
AutoCloseAlert.show("Data Tidak Ditemukan", message, "Pastikan data barcode anda benar", 5, new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String s) {
|
||||
Platform.runLater(()->{
|
||||
medicalRecordID.setText("");
|
||||
PatientName.setText("");
|
||||
barcodeData.setText("");
|
||||
isTakingPhoto.set(false);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
System.out.println("checkpatientID failed");
|
||||
AutoCloseAlert.show("Error","checkpatientID failed","checkpatientID failed",5);
|
||||
});
|
||||
|
||||
new Thread(checkpatientID).start();
|
||||
@@ -1024,7 +1053,7 @@ public class CaptureView {
|
||||
} else {
|
||||
System.out.println("Prefix invalid, not taking photo");
|
||||
isTakingPhoto.set(false);
|
||||
AutoCloseAlert.show("QR Code Not Available", "", "Please scan QR before continue", 5);
|
||||
AutoCloseAlert.show("QR Code Not Available", "", "Please scan QR before continue", 5, null);
|
||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||
if (!audioPlayer.getCurrentFile().equals(audio_scan_barcode)) {
|
||||
audioPlayer.StopCurrentPlayback();
|
||||
|
||||
Reference in New Issue
Block a user