commit 27/03/2025
This commit is contained in:
BIN
banners/IU photoboth-01.jpg
Normal file
BIN
banners/IU photoboth-01.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 452 KiB |
BIN
banners/IU photoboth-02.jpg
Normal file
BIN
banners/IU photoboth-02.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 253 KiB |
@@ -1,4 +1,4 @@
|
|||||||
#Mon Mar 24 13:39:02 ICT 2025
|
#Thu Mar 27 11:07:02 ICT 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
|
||||||
@@ -22,7 +22,7 @@ FTPUser=user
|
|||||||
FlipCamera=true
|
FlipCamera=true
|
||||||
MirrorCamera=true
|
MirrorCamera=true
|
||||||
PhotoDirectory=C\:\\Users\\Erha\\Desktop\\ErhaCapture
|
PhotoDirectory=C\:\\Users\\Erha\\Desktop\\ErhaCapture
|
||||||
SharpnessThreshold=70.0
|
SharpnessThreshold=1000.0
|
||||||
cascadeMaxSize=500
|
cascadeMaxSize=500
|
||||||
cascadeMinNeighbors=3
|
cascadeMinNeighbors=3
|
||||||
cascadeMinSize=250
|
cascadeMinSize=250
|
||||||
|
|||||||
BIN
database.db
BIN
database.db
Binary file not shown.
@@ -12,4 +12,5 @@ public interface LiveCamEvent {
|
|||||||
void onLog(String log);
|
void onLog(String log);
|
||||||
void onBlink(int counter);
|
void onBlink(int counter);
|
||||||
void onStartCapturing();
|
void onStartCapturing();
|
||||||
|
void onIntervalUpdate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,19 +6,22 @@ import javafx.geometry.Pos;
|
|||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.Modality;
|
import javafx.stage.Modality;
|
||||||
import javafx.stage.Screen;
|
import javafx.stage.Screen;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.StageStyle;
|
import javafx.stage.StageStyle;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static Config.SomeCodes.ValidString;
|
import static Config.SomeCodes.*;
|
||||||
|
|
||||||
public class AutoCloseAlert {
|
public class AutoCloseAlert {
|
||||||
|
|
||||||
@@ -26,13 +29,23 @@ public class AutoCloseAlert {
|
|||||||
public static String shownTitle = "";
|
public static String shownTitle = "";
|
||||||
public static String shownContent = "";
|
public static String shownContent = "";
|
||||||
public static String shownHeader = "";
|
public static String shownHeader = "";
|
||||||
|
public static Image shownBanner = null;
|
||||||
|
public static Image banner_01;
|
||||||
|
public static Image banner_02;
|
||||||
|
|
||||||
private static void clear(){
|
public static void init(){
|
||||||
shownTitle = "";
|
String f_01 = ExtractResource("/IU photoboth-01.jpg");
|
||||||
shownContent = "";
|
System.out.println("Banner 01 extracted as file: "+f_01);
|
||||||
shownHeader = "";
|
String f_02 = ExtractResource("/IU photoboth-02.jpg");
|
||||||
|
System.out.println("Banner 02 extracted as file: "+f_02);
|
||||||
|
banner_01 = LoadImage(f_01);
|
||||||
|
if (banner_01!=null) System.out.println("Banner 01 loaded"); else System.out.println("Banner 01 not loaded");
|
||||||
|
banner_02 = LoadImage(f_02);
|
||||||
|
if (banner_02!=null) System.out.println("Banner 02 loaded"); else System.out.println("Banner 02 not loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the current alert if it is shown
|
* Close the current alert if it is shown
|
||||||
*/
|
*/
|
||||||
@@ -54,6 +67,7 @@ public class AutoCloseAlert {
|
|||||||
Stage alertStage = _showtext(title, "", content);
|
Stage alertStage = _showtext(title, "", content);
|
||||||
closeAlertStage(seconds, onClose, alertStage);
|
closeAlertStage(seconds, onClose, alertStage);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -74,6 +88,48 @@ public class AutoCloseAlert {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void showbanner(Image b1, int seconds, Consumer<String> onClose){
|
||||||
|
Platform.runLater(()->{
|
||||||
|
Stage alertStage = _showbanner(b1);
|
||||||
|
closeAlertStage(seconds, onClose, alertStage);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Stage _showbanner(Image image){
|
||||||
|
close();
|
||||||
|
|
||||||
|
Stage alertStage = new Stage();
|
||||||
|
alertStage.initModality(Modality.APPLICATION_MODAL);
|
||||||
|
alertStage.initStyle(StageStyle.UTILITY);
|
||||||
|
alertStage.setAlwaysOnTop(true);
|
||||||
|
alertStage.setResizable(false);
|
||||||
|
//System.out.println("_showbanner creating stage");
|
||||||
|
|
||||||
|
if (image!=null){
|
||||||
|
ImageView imageView = new ImageView(image);
|
||||||
|
imageView.setPreserveRatio(true);
|
||||||
|
imageView.setFitWidth(1280);
|
||||||
|
imageView.setSmooth(true);
|
||||||
|
StackPane stackPane = new StackPane(imageView);
|
||||||
|
alertStage.setScene(new Scene(stackPane, 1280, 720));
|
||||||
|
//System.out.println("_showbanner setscene");
|
||||||
|
} //else System.out.println("_showbanner not setscene because image is null");
|
||||||
|
|
||||||
|
alertStage.centerOnScreen();
|
||||||
|
alertStage.show();
|
||||||
|
//System.out.println("_showbanner show stage");
|
||||||
|
|
||||||
|
currentAlertStage = alertStage;
|
||||||
|
shownBanner = image;
|
||||||
|
shownTitle = "";
|
||||||
|
shownContent = "";
|
||||||
|
shownHeader = "";
|
||||||
|
|
||||||
|
return alertStage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an alert with a title, header, and content
|
* Create an alert with a title, header, and content
|
||||||
* @param title the title
|
* @param title the title
|
||||||
@@ -123,6 +179,7 @@ public class AutoCloseAlert {
|
|||||||
shownHeader = ValidString(header) ? header : "";
|
shownHeader = ValidString(header) ? header : "";
|
||||||
shownContent = ValidString(content) ? content : "";
|
shownContent = ValidString(content) ? content : "";
|
||||||
shownTitle = ValidString(title) ? title : "";
|
shownTitle = ValidString(title) ? title : "";
|
||||||
|
shownBanner = null;
|
||||||
|
|
||||||
return alertStage;
|
return alertStage;
|
||||||
}
|
}
|
||||||
@@ -147,4 +204,23 @@ public class AutoCloseAlert {
|
|||||||
delay.play();
|
delay.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Image LoadImage(String filename){
|
||||||
|
if (ValidFile(filename)){
|
||||||
|
try{
|
||||||
|
Image mm = new Image(Paths.get(filename).toUri().toString());
|
||||||
|
System.out.println("Load image from "+filename);
|
||||||
|
return mm;
|
||||||
|
} catch (Exception e){
|
||||||
|
System.out.println("Error loading image: " + filename+", Message: "+e.getMessage());
|
||||||
|
}
|
||||||
|
} else System.out.println("LoadImage: Invalid file: "+filename);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void clear(){
|
||||||
|
shownTitle = "";
|
||||||
|
shownContent = "";
|
||||||
|
shownHeader = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -859,7 +859,7 @@ public class Cameradetail {
|
|||||||
int fpsval = fps.getAndSet(0);
|
int fpsval = fps.getAndSet(0);
|
||||||
if (fpsval!=LiveFPS){
|
if (fpsval!=LiveFPS){
|
||||||
LiveFPS = fpsval;
|
LiveFPS = fpsval;
|
||||||
if (event!=null) event.onStartCapturing();
|
if (event!=null) event.onIntervalUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -450,7 +450,12 @@ public class CaptureView {
|
|||||||
long duration = (System.nanoTime() - nanostart) / 1000000; // in milliseconds
|
long duration = (System.nanoTime() - nanostart) / 1000000; // in milliseconds
|
||||||
System.out.println("TakePhotos duration: "+duration+" ms");
|
System.out.println("TakePhotos duration: "+duration+" ms");
|
||||||
|
|
||||||
AutoCloseAlert.show("Photos Taken", "Photos Taken", "Photos Taken", 5, null);
|
//AutoCloseAlert.show("Photos Taken", "Photos Taken", "Photos Taken", 5, null);
|
||||||
|
if (AutoCloseAlert.banner_02!=null) {
|
||||||
|
System.out.println("Showing banner 02 after photo taken");
|
||||||
|
AutoCloseAlert.showbanner(AutoCloseAlert.banner_02, 0, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
String[] files = prc.compressed();
|
String[] files = prc.compressed();
|
||||||
if (files.length>0){
|
if (files.length>0){
|
||||||
@@ -465,7 +470,6 @@ public class CaptureView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackFinished(String filename) {
|
public void onPlaybackFinished(String filename) {
|
||||||
Platform.runLater(AutoCloseAlert::close);
|
|
||||||
UploadFiles(prc, prefix);
|
UploadFiles(prc, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,17 +561,40 @@ public class CaptureView {
|
|||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_upload_berhasil)){
|
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_upload_berhasil)){
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
audioPlayer.PlayFile(audio_upload_berhasil, null);
|
audioPlayer.PlayFile(audio_upload_berhasil, new PlaybackStatus() {
|
||||||
|
@Override
|
||||||
|
public void onPlaybackStarted(String filename) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlaybackFinished(String filename) {
|
||||||
|
Platform.runLater(()->{
|
||||||
|
AutoCloseAlert.close();
|
||||||
|
barcodeData.setText("");
|
||||||
|
medicalRecordID.setText("");
|
||||||
|
PatientName.setText("");
|
||||||
|
isTakingPhoto.set(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlaybackFailure(String filename) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AutoCloseAlert.show("Upload Success", "Upload Success", "Upload Success", 5, s -> {
|
// AutoCloseAlert.show("Upload Success", "Upload Success", "Upload Success", 5, s -> {
|
||||||
isTakingPhoto.set(false);
|
// isTakingPhoto.set(false);
|
||||||
Platform.runLater(()->{
|
// Platform.runLater(()->{
|
||||||
barcodeData.setText("");
|
// barcodeData.setText("");
|
||||||
medicalRecordID.setText("");
|
// medicalRecordID.setText("");
|
||||||
PatientName.setText("");
|
// PatientName.setText("");
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -610,17 +637,21 @@ public class CaptureView {
|
|||||||
|
|
||||||
|
|
||||||
//tambahan 19/03/2025
|
//tambahan 19/03/2025
|
||||||
barcodeData.textProperty().addListener(observable -> {
|
barcodeData.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
String barcode = barcodeData.getText();
|
System.out.println("barcodeData changed from ["+oldValue+"] to ["+newValue+"]");
|
||||||
//System.out.println("barcodeData invalidated, value: "+barcode);
|
if (ValidBarCode(newValue)){
|
||||||
if (ValidBarCode(barcode)){
|
if (Objects.equals(AutoCloseAlert.banner_01, AutoCloseAlert.shownBanner)){
|
||||||
if (AutoCloseAlert.shownTitle.equals("Scan Barcode")){
|
System.out.println("Close banner 01");
|
||||||
AutoCloseAlert.close();
|
AutoCloseAlert.close();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AutoCloseAlert.show("Scan Barcode", "Silahkan Scan Barcode Anda", "Arahkan kertas barcode ke kamera", 0, null);
|
if (AutoCloseAlert.banner_01!=null){
|
||||||
|
System.out.println("Show banner 01");
|
||||||
|
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
barcodeData.setText("");
|
barcodeData.setText("");
|
||||||
|
|
||||||
audioPlayer = new AudioPlayer(1,48000);
|
audioPlayer = new AudioPlayer(1,48000);
|
||||||
@@ -1076,7 +1107,13 @@ public class CaptureView {
|
|||||||
} else {
|
} else {
|
||||||
System.out.println("Prefix invalid, not taking photo");
|
System.out.println("Prefix invalid, not taking photo");
|
||||||
isTakingPhoto.set(false);
|
isTakingPhoto.set(false);
|
||||||
AutoCloseAlert.show("QR Code Not Available", "", "Please scan QR before continue", 5, s -> AutoCloseAlert.show("Scan Barcode", "Silahkan Scan Barcode Anda", "Arahkan kertas barcode ke kamera", 0, null));
|
//AutoCloseAlert.show("QR Code Not Available", "", "Please scan QR before continue", 5, s -> AutoCloseAlert.show("Scan Barcode", "Silahkan Scan Barcode Anda", "Arahkan kertas barcode ke kamera", 0, null));
|
||||||
|
if (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
||||||
|
if (AutoCloseAlert.banner_01!=null){
|
||||||
|
System.out.println("Showing banner 01 because prefix invalid");
|
||||||
|
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_scan_barcode)) {
|
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_scan_barcode)) {
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
@@ -1093,6 +1130,17 @@ public class CaptureView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStartCapturing() {
|
public void onStartCapturing() {
|
||||||
|
if (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
||||||
|
if (AutoCloseAlert.banner_01!=null){
|
||||||
|
System.out.println("Showing banner 01 for first time");
|
||||||
|
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onIntervalUpdate() {
|
||||||
update_status(image);
|
update_status(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class MainApplication extends Application {
|
|||||||
Screen screen = Screen.getPrimary();
|
Screen screen = Screen.getPrimary();
|
||||||
Rectangle2D screenbound = screen.getVisualBounds();
|
Rectangle2D screenbound = screen.getVisualBounds();
|
||||||
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 27032025");
|
stage.setTitle("MultiCam Capture App for ERHA 27032025-001");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setResizable(true);
|
stage.setResizable(true);
|
||||||
stage.setMaximized(true);
|
stage.setMaximized(true);
|
||||||
@@ -50,6 +50,8 @@ public class MainApplication extends Application {
|
|||||||
|
|
||||||
stage.show();
|
stage.show();
|
||||||
|
|
||||||
|
AutoCloseAlert.init();
|
||||||
|
|
||||||
Logger.info("Application started");
|
Logger.info("Application started");
|
||||||
sd.setEvent(new SecureDongleEvent() {
|
sd.setEvent(new SecureDongleEvent() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user