commit 22/05/2025

This commit is contained in:
rdkartono
2025-05-22 11:25:54 +07:00
parent ee0a82aa32
commit 1fcd905b07
5 changed files with 129 additions and 67 deletions

View File

@@ -1,4 +1,4 @@
#Tue May 13 14:43:52 WIB 2025 #Thu May 22 11:19:22 WIB 2025
AudioPhase1=C\:\\Users\\Erha\\IdeaProjects\\ErhaCam\\audio\\phase1.mp3 AudioPhase1=C\:\\Users\\Erha\\IdeaProjects\\ErhaCam\\audio\\phase1.mp3
AudioPhase2=C\:\\Users\\Erha\\IdeaProjects\\ErhaCam\\audio\\phase2.mp3 AudioPhase2=C\:\\Users\\Erha\\IdeaProjects\\ErhaCam\\audio\\phase2.mp3
AudioPhase3=C\:\\Users\\Erha\\IdeaProjects\\ErhaCam\\audio\\phase3.mp3 AudioPhase3=C\:\\Users\\Erha\\IdeaProjects\\ErhaCam\\audio\\phase3.mp3
@@ -21,7 +21,7 @@ FTPPort=21
FTPUser=user FTPUser=user
FlipCamera=true FlipCamera=true
MirrorCamera=true MirrorCamera=true
PhotoDirectory=C\:\\Users\\rdkar\\OneDrive\\Desktop\\Erha Capture PhotoDirectory=C\:\\Users\\Erha\\Desktop\\ErhaCapture
SharpnessThreshold=1000.0 SharpnessThreshold=1000.0
cascadeMaxSize=500 cascadeMaxSize=500
cascadeMinNeighbors=3 cascadeMinNeighbors=3

Binary file not shown.

View File

@@ -42,6 +42,7 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.function.Consumer;
import static org.bytedeco.opencv.global.opencv_core.CV_64F; import static org.bytedeco.opencv.global.opencv_core.CV_64F;
@@ -147,6 +148,19 @@ public class SomeCodes {
} }
} }
public static void WaitAsync(long millis, String threadname, Consumer<Void> success){
Thread thread = new Thread(()->{
try {
Thread.sleep(millis);
} catch (Exception ignored){ }
if (success != null) success.accept(null);
});
thread.setName(threadname);
thread.setDaemon(true);
thread.start();
}
/** /**
* Make thumbfile from source jpg file * Make thumbfile from source jpg file
* @param sourcejpg source jpg file * @param sourcejpg source jpg file

View File

@@ -318,6 +318,7 @@ public class CaptureView {
PlayFileWithoutEvent(audio_pengambilan_gagal); PlayFileWithoutEvent(audio_pengambilan_gagal);
} else { } else {
PlayFileWithoutEvent(audio_hubungi_staf_kami); PlayFileWithoutEvent(audio_hubungi_staf_kami);
clear();
} }
return; return;
@@ -839,6 +840,7 @@ public class CaptureView {
runningTask = timeoutExecutor.schedule(()->{ runningTask = timeoutExecutor.schedule(()->{
// timeout // timeout
clear(); clear();
System.out.println("180 seconds timeout");
}, timeout, TimeUnit.SECONDS); }, timeout, TimeUnit.SECONDS);
// Revisi 19/05/2025 // Revisi 19/05/2025
@@ -847,12 +849,90 @@ public class CaptureView {
// terakhir, PlayFile audio_hubungi_staf_kami // terakhir, PlayFile audio_hubungi_staf_kami
audioTimeline = new Timeline(); audioTimeline = new Timeline();
int file_duration = 8; // audio_posisikan_muka durasi 7 detik final int file_duration = 8; // audio_posisikan_muka durasi 7 detik
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(0), k1 -> PlayFileWithoutEvent(audio_posisikan_muka))); audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(0), k1 ->{
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(5+file_duration), k2 -> PlayFileWithoutEvent(audio_posisikan_muka)));
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(10+file_duration), k3 -> PlayFileWithoutEvent(audio_posisikan_muka))); PlayFileWithEvent(audio_posisikan_muka, new PlaybackStatus() {
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(15+file_duration), k4 ->{ @Override
PlayFileWithoutEvent(audio_hubungi_staf_kami); public void onPlaybackStarted(String filename) {
anti_bawel.set(true);
System.out.println("Peringatan pertama audio_posisikan_muka");
}
@Override
public void onPlaybackFinished(String filename) {
anti_bawel.set(false);
}
@Override
public void onPlaybackFailure(String filename) {
anti_bawel.set(false);
}
});
}));
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(file_duration+5), k2 -> {
PlayFileWithEvent(audio_posisikan_muka, new PlaybackStatus() {
@Override
public void onPlaybackStarted(String filename) {
anti_bawel.set(true);
System.out.println("Peringatan kedua audio_posisikan_muka");
}
@Override
public void onPlaybackFinished(String filename) {
anti_bawel.set(false);
}
@Override
public void onPlaybackFailure(String filename) {
anti_bawel.set(false);
}
});
}));
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(3*file_duration+5), k3 -> {
PlayFileWithEvent(audio_posisikan_muka, new PlaybackStatus() {
@Override
public void onPlaybackStarted(String filename) {
anti_bawel.set(true);
System.out.println("Peringatan ketiga audio_posisikan_muka");
}
@Override
public void onPlaybackFinished(String filename) {
anti_bawel.set(false);
}
@Override
public void onPlaybackFailure(String filename) {
anti_bawel.set(false);
}
});
}));
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(5*file_duration+5), k4 ->{
PlayFileWithEvent(audio_hubungi_staf_kami, new PlaybackStatus() {
@Override
public void onPlaybackStarted(String filename) {
anti_bawel.set(true);
System.out.println("Peringatan keempat audio_hubungi_staf_kami");
}
@Override
public void onPlaybackFinished(String filename) {
anti_bawel.set(false);
}
@Override
public void onPlaybackFailure(String filename) {
anti_bawel.set(false);
}
});
clear(); clear();
})); }));
@@ -899,35 +979,9 @@ public class CaptureView {
TextAreaSetText(medicalRecordID,""+medrecid); TextAreaSetText(medicalRecordID,""+medrecid);
TextAreaSetText(PatientName, pr.name); TextAreaSetText(PatientName, pr.name);
// harusnya ganti ke Timeline, tapi belum tested if (anti_bawel.get()) return; // sudah ada LiveCamEvent lain yang bunyiin, jadi tidak usah bunyiin lagi
//if (audioTimeline!=null) audioTimeline.play(); if (audioTimeline!=null) audioTimeline.play();
if (anti_bawel.get()) return;
PlayFileWithEvent(audio_posisikan_muka, new PlaybackStatus() {
@Override
public void onPlaybackStarted(String filename) {
anti_bawel.set(true);
}
@Override
public void onPlaybackFinished(String filename) {
Thread antibawel = new Thread(()->{
try {
Thread.sleep(15*1000);
} catch (InterruptedException ignored) {
}
anti_bawel.set(false);
});
antibawel.setName("anti bawel");
antibawel.setDaemon(true);
antibawel.start();
}
@Override
public void onPlaybackFailure(String filename) {
anti_bawel.set(false);
}
});
} }
}); });
@@ -963,39 +1017,33 @@ public class CaptureView {
} }
//update_status(image); //update_status(image);
if (hasface && audioTimeline!=null) audioTimeline.stop(); if (hasface){
// ada face terdeteksi
if (Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
// WelcomeUI masih muncul
if (anti_bawel.get()) return; // sudah ada LiveCamEvent lain yang bunyiin, jadi tidak usah bunyiin lagi
PlayFileWithEvent(audio_scan_barcode, new PlaybackStatus() {
@Override
public void onPlaybackStarted(String filename) {
// instruksi scan barcode ketika welcomeUI masih muncul dan ada muka terdeteksi }
if (hasface && Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
if (anti_bawel.get()) return;
PlayFileWithEvent(audio_scan_barcode, new PlaybackStatus() {
@Override
public void onPlaybackStarted(String filename) {
} @Override
public void onPlaybackFinished(String filename) {
@Override WaitAsync(15*1000, "anti bawel", x-> anti_bawel.set(false));
public void onPlaybackFinished(String filename) { }
Thread antibawel = new Thread(()->{
try {
Thread.sleep(15*1000);
} catch (InterruptedException ignored) {
}
anti_bawel.set(false);
});
antibawel.setName("anti bawel");
antibawel.setDaemon(true);
antibawel.start();
}
@Override
public void onPlaybackFailure(String filename) {
}
});
@Override
public void onPlaybackFailure(String filename) {
}
});
} else if (audioTimeline!=null){
// WelcomeUI sudah tidak muncul, tapi audioTimeLine masih ada
audioTimeline.stop();
}
} }
} }

View File

@@ -28,13 +28,13 @@ public class MainApplication extends Application {
public void start(Stage stage) throws IOException { public void start(Stage stage) throws IOException {
Runtime.getRuntime().addShutdownHook(new Thread(() -> { Runtime.getRuntime().addShutdownHook(new Thread(() -> {
if (photoCleaner!=null) photoCleaner.Stop();
System.out.println("ShutdownHook Checking running threads..."); System.out.println("ShutdownHook Checking running threads...");
Map<Thread, StackTraceElement[]> allThreads = Thread.getAllStackTraces(); Map<Thread, StackTraceElement[]> allThreads = Thread.getAllStackTraces();
for(Thread thread : allThreads.keySet()){ for(Thread thread : allThreads.keySet()){
//System.out.println("Thread: " + thread.getName()+", State: " + thread.getState()+", Daemon: " + thread.isDaemon()); System.out.println("Thread: " + thread.getName()+", State: " + thread.getState()+", Daemon: " + thread.isDaemon());
thread.interrupt(); thread.interrupt();
} }
if (photoCleaner!=null) photoCleaner.Stop();
})); }));
@@ -50,7 +50,7 @@ public class MainApplication extends Application {
Screen screen = Screen.getPrimary(); Screen screen = Screen.getPrimary();
Rectangle2D screenbound = screen.getBounds(); Rectangle2D screenbound = screen.getBounds();
Scene scene = new Scene(fxmlLoader.load(), screenbound.getWidth(), screenbound.getHeight()); Scene scene = new Scene(fxmlLoader.load(), screenbound.getWidth(), screenbound.getHeight());
stage.setTitle("MultiCam Capture App for ERHA 20052025-001"); stage.setTitle("MultiCam Capture App for ERHA 22052025-004");
stage.setScene(scene); stage.setScene(scene);
stage.setResizable(true); stage.setResizable(true);
stage.setMaximized(true); stage.setMaximized(true);