commit 19/05/2025
This commit is contained in:
@@ -226,10 +226,10 @@ public class SomeCodes {
|
|||||||
for(int i=0; i<path.length; i++){
|
for(int i=0; i<path.length; i++){
|
||||||
try{
|
try{
|
||||||
result[i] = Files.deleteIfExists(Path.of(path[i]));
|
result[i] = Files.deleteIfExists(Path.of(path[i]));
|
||||||
if (result[i]) System.out.println("Delete: "+path[i]);
|
if (result[i]) Logger.info("Delete: "+path[i]);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
result[i] = false;
|
result[i] = false;
|
||||||
System.out.println("Error deleting file: "+path[i]+", Msg : "+e.getMessage());
|
Logger.error("Error deleting file: "+path[i]+", Msg : "+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Arrays.stream(result).allMatch(x->x);
|
return Arrays.stream(result).allMatch(x->x);
|
||||||
@@ -243,10 +243,10 @@ public class SomeCodes {
|
|||||||
for(int i=0; i<path.length; i++){
|
for(int i=0; i<path.length; i++){
|
||||||
try{
|
try{
|
||||||
result[i] = Files.deleteIfExists(path[i]);
|
result[i] = Files.deleteIfExists(path[i]);
|
||||||
if (result[i]) System.out.println("Delete: "+path[i]);
|
if (result[i]) Logger.info("Delete: "+path[i]);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
result[i] = false;
|
result[i] = false;
|
||||||
System.out.println("Error deleting file: "+path[i]+", Msg : "+e.getMessage());
|
Logger.error("Error deleting file: "+path[i]+", Msg : "+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Arrays.stream(result).allMatch(x->x);
|
return Arrays.stream(result).allMatch(x->x);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ public class PhotoCleaner {
|
|||||||
public PhotoCleaner(int days){
|
public PhotoCleaner(int days){
|
||||||
this.days = days;
|
this.days = days;
|
||||||
this.started = new boolean[]{false};
|
this.started = new boolean[]{false};
|
||||||
System.out.println("PhotoCleaner created, days: "+days);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +30,6 @@ public class PhotoCleaner {
|
|||||||
public void Start(){
|
public void Start(){
|
||||||
Thread thread = new Thread(() -> {
|
Thread thread = new Thread(() -> {
|
||||||
started[0] = true;
|
started[0] = true;
|
||||||
System.out.println("PhotoCleaner started");
|
|
||||||
while (started[0]) {
|
while (started[0]) {
|
||||||
try {
|
try {
|
||||||
System.out.println("Rechecking Database for older photos...");
|
System.out.println("Rechecking Database for older photos...");
|
||||||
@@ -42,7 +40,6 @@ public class PhotoCleaner {
|
|||||||
Thread sqldelete = new Thread(()->{
|
Thread sqldelete = new Thread(()->{
|
||||||
Sqlite sql = new Sqlite();
|
Sqlite sql = new Sqlite();
|
||||||
PhotoReviewClass[] prcs = sql.GetAll();
|
PhotoReviewClass[] prcs = sql.GetAll();
|
||||||
System.out.println("Database contains "+prcs.length+" PhotoReviewClass");
|
|
||||||
for (PhotoReviewClass prc : prcs) {
|
for (PhotoReviewClass prc : prcs) {
|
||||||
if (!started[0]) break;
|
if (!started[0]) break;
|
||||||
if (prc != null && prc.getDateTime() != null) {
|
if (prc != null && prc.getDateTime() != null) {
|
||||||
@@ -55,7 +52,7 @@ public class PhotoCleaner {
|
|||||||
SomeCodes.Delete(prc.compressedcrop());
|
SomeCodes.Delete(prc.compressedcrop());
|
||||||
SomeCodes.Delete(prc.thumbnails());
|
SomeCodes.Delete(prc.thumbnails());
|
||||||
sql.Delete(prc);
|
sql.Delete(prc);
|
||||||
System.out.println("Deleted PhotoReviewClass: " + prc.getDateTime() + " " + prc.getPrefix());
|
Logger.info("Deleted PhotoReviewClass: " + prc.getDateTime() + " " + prc.getPrefix());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,10 +100,8 @@ public class PhotoCleaner {
|
|||||||
this.now = LocalDateTime.now();
|
this.now = LocalDateTime.now();
|
||||||
}
|
}
|
||||||
public void run(){
|
public void run(){
|
||||||
System.out.println("DiskDeleter started, path: "+path);
|
|
||||||
Path[] ppp = SomeCodes.GetFilesInDirectory(path);
|
Path[] ppp = SomeCodes.GetFilesInDirectory(path);
|
||||||
if (ppp != null){
|
if (ppp != null){
|
||||||
System.out.println("DiskDeleter found "+ppp.length+" files in path: "+path);
|
|
||||||
for(Path p : ppp){
|
for(Path p : ppp){
|
||||||
if (!started[0]) break;
|
if (!started[0]) break;
|
||||||
LocalDateTime ldt = SomeCodes.GetCreationTime(p);
|
LocalDateTime ldt = SomeCodes.GetCreationTime(p);
|
||||||
|
|||||||
@@ -94,14 +94,11 @@ public class ErhaAPI {
|
|||||||
return gson.fromJson(body, BarcodeResullt.class);
|
return gson.fromJson(body, BarcodeResullt.class);
|
||||||
} else {
|
} else {
|
||||||
Logger.error("Validate_Barcode failed, status code : " , response.statusCode());
|
Logger.error("Validate_Barcode failed, status code : " , response.statusCode());
|
||||||
System.out.println("Validate Barcode status code : " + response.statusCode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Validate_Barcode IO Exception, Msg : " + e.getMessage());
|
|
||||||
Logger.error("Validate_Barcode IO Exception, Msg : " , e.getMessage());
|
Logger.error("Validate_Barcode IO Exception, Msg : " , e.getMessage());
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
System.out.println("Validate_Barcode Interrupted Exception, Msg : " + e.getMessage());
|
|
||||||
Logger.error("Validate_Barcode Interrupted Exception, Msg : " , e.getMessage());
|
Logger.error("Validate_Barcode Interrupted Exception, Msg : " , e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,13 +170,11 @@ public class ErhaAPI {
|
|||||||
return gson.fromJson(response.body(), UploadResult.class);
|
return gson.fromJson(response.body(), UploadResult.class);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Upload_File status code : " + response.statusCode());
|
|
||||||
Logger.error("Upload_File file ",filename," failed, status code : " , response.statusCode());
|
Logger.error("Upload_File file ",filename," failed, status code : " , response.statusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
System.out.println("Upload_File Exception, Msg : " + e.getMessage());
|
|
||||||
Logger.error("Upload_File file ",filename," failed, Exception, Msg : " , e.getMessage());
|
Logger.error("Upload_File file ",filename," failed, Exception, Msg : " , e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ public class SecureDongle {
|
|||||||
|
|
||||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||||
HardwareID = lp1[0];
|
HardwareID = lp1[0];
|
||||||
//System.out.println("SecureDongle found with HardwareID="+HardwareID);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (event!=null) event.onDongleError("Find", result);
|
if (event!=null) event.onDongleError("Find", result);
|
||||||
@@ -135,10 +134,9 @@ public class SecureDongle {
|
|||||||
System.arraycopy(data, 0, buffer, 0, length);
|
System.arraycopy(data, 0, buffer, 0, length);
|
||||||
short result = SD.SecureDongle(LibSecureDongle.SD_WRITE, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
short result = SD.SecureDongle(LibSecureDongle.SD_WRITE, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||||
//System.out.println("SecureDongle HardwareID="+HardwareID+" write success ");
|
|
||||||
return true;
|
return true;
|
||||||
} else if (event!=null) event.onDongleError("Write", result);
|
} else if (event!=null) event.onDongleError("Write", result);
|
||||||
} //else System.out.println("SecureDongle not opened");
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -160,12 +158,11 @@ public class SecureDongle {
|
|||||||
p2[0] = Length;
|
p2[0] = Length;
|
||||||
short result = SD.SecureDongle(LibSecureDongle.SD_READ, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
short result = SD.SecureDongle(LibSecureDongle.SD_READ, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||||
//System.out.println("SecureDongle HardwareID="+HardwareID+" read success ");
|
|
||||||
byte[] data = new byte[Length];
|
byte[] data = new byte[Length];
|
||||||
System.arraycopy(buffer, 0, data, 0, Length);
|
System.arraycopy(buffer, 0, data, 0, Length);
|
||||||
return data;
|
return data;
|
||||||
} else if (event!=null) event.onDongleError("Read", result);
|
} else if (event!=null) event.onDongleError("Read", result);
|
||||||
} //else System.out.println("SecureDongle not opened");
|
}
|
||||||
|
|
||||||
return new byte[0];
|
return new byte[0];
|
||||||
}
|
}
|
||||||
@@ -181,14 +178,13 @@ public class SecureDongle {
|
|||||||
handle[0] = Handle;
|
handle[0] = Handle;
|
||||||
short result = SD.SecureDongle(LibSecureDongle.SD_RANDOM, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
short result = SD.SecureDongle(LibSecureDongle.SD_RANDOM, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||||
//System.out.println("SecureDongle HardwareID="+HardwareID+" generate random success ");
|
|
||||||
random[0] = p1[0];
|
random[0] = p1[0];
|
||||||
random[1] = p2[0];
|
random[1] = p2[0];
|
||||||
random[2] = p3[0];
|
random[2] = p3[0];
|
||||||
random[3] = p4[0];
|
random[3] = p4[0];
|
||||||
return random;
|
return random;
|
||||||
} else if (event!=null) event.onDongleError("GenerateRandomNumber", result);
|
} else if (event!=null) event.onDongleError("GenerateRandomNumber", result);
|
||||||
} //else System.out.println("SecureDongle not opened");
|
}
|
||||||
|
|
||||||
return random;
|
return random;
|
||||||
}
|
}
|
||||||
@@ -205,11 +201,10 @@ public class SecureDongle {
|
|||||||
lp1[0] = UserID;
|
lp1[0] = UserID;
|
||||||
short result = SD.SecureDongle(LibSecureDongle.SD_WRITE_USERID, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
short result = SD.SecureDongle(LibSecureDongle.SD_WRITE_USERID, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||||
//System.out.println("SecureDongle HardwareID="+HardwareID+" set UserID success ");
|
|
||||||
this.UserID = UserID;
|
this.UserID = UserID;
|
||||||
return true;
|
return true;
|
||||||
} else if (event!=null) event.onDongleError("WriteUserID", result);
|
} else if (event!=null) event.onDongleError("WriteUserID", result);
|
||||||
} //else System.out.println("SecureDongle not opened");
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -224,10 +219,9 @@ public class SecureDongle {
|
|||||||
short result = SD.SecureDongle(LibSecureDongle.SD_READ_USERID, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
short result = SD.SecureDongle(LibSecureDongle.SD_READ_USERID, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||||
this.UserID = lp1[0];
|
this.UserID = lp1[0];
|
||||||
//System.out.println("SecureDongle HardwareID="+HardwareID+" read UserID success, value = "+UserID);
|
|
||||||
return UserID;
|
return UserID;
|
||||||
} else if (event!=null) event.onDongleError("ReadUserID", result);
|
} else if (event!=null) event.onDongleError("ReadUserID", result);
|
||||||
} //else System.out.println("SecureDongle not opened");
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import javafx.scene.paint.Color;
|
|||||||
import javafx.scene.shape.Circle;
|
import javafx.scene.shape.Circle;
|
||||||
import javafx.stage.*;
|
import javafx.stage.*;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
|
import org.tinylog.Logger;
|
||||||
|
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -341,12 +343,11 @@ public class AutoCloseAlert {
|
|||||||
if (ValidFile(filename)){
|
if (ValidFile(filename)){
|
||||||
try{
|
try{
|
||||||
Image mm = new Image(Paths.get(filename).toUri().toString());
|
Image mm = new Image(Paths.get(filename).toUri().toString());
|
||||||
System.out.println("Load image from "+filename);
|
|
||||||
return mm;
|
return mm;
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
System.out.println("Error loading image: " + filename+", Message: "+e.getMessage());
|
Logger.error("Error loading image: " + filename+", Message: "+e.getMessage());
|
||||||
}
|
}
|
||||||
} else System.out.println("LoadImage: Invalid file: "+filename);
|
} else Logger.error("LoadImage: Invalid file: " + filename);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -919,7 +919,6 @@ public class Cameradetail {
|
|||||||
|
|
||||||
if (theface.getFace()!=null){
|
if (theface.getFace()!=null){
|
||||||
LiveMatROI = new Rect(theface.getFace().x(), theface.getFace().y(), theface.getFace().width(), theface.getFace().height());
|
LiveMatROI = new Rect(theface.getFace().x(), theface.getFace().y(), theface.getFace().width(), theface.getFace().height());
|
||||||
//System.out.println("Frontal Face Detected from camera "+cameratitle+" "+RectToString(LiveMatROI));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theface.getEyesCount()>=2){
|
if (theface.getEyesCount()>=2){
|
||||||
@@ -930,7 +929,6 @@ public class Cameradetail {
|
|||||||
if (event!=null) event.onEyeDetector(true);
|
if (event!=null) event.onEyeDetector(true);
|
||||||
LabelVisible(eye_indicator,true);
|
LabelVisible(eye_indicator,true);
|
||||||
|
|
||||||
//System.out.println("Valid Eye Detected from camera "+cameratitle);
|
|
||||||
// Valid eye condition
|
// Valid eye condition
|
||||||
|
|
||||||
if (eye_state.get()!=1){
|
if (eye_state.get()!=1){
|
||||||
@@ -939,7 +937,6 @@ public class Cameradetail {
|
|||||||
System.out.println("First Eye Detected from camera "+cameratitle.getText());
|
System.out.println("First Eye Detected from camera "+cameratitle.getText());
|
||||||
eye_state.set(1);
|
eye_state.set(1);
|
||||||
} else {
|
} else {
|
||||||
//System.out.println("Transition from close to open eyes");
|
|
||||||
eye_state.set(1);
|
eye_state.set(1);
|
||||||
|
|
||||||
blink_counter.incrementAndGet();
|
blink_counter.incrementAndGet();
|
||||||
@@ -975,7 +972,6 @@ public class Cameradetail {
|
|||||||
|
|
||||||
|
|
||||||
if (eye_state.get()!=0){
|
if (eye_state.get()!=0){
|
||||||
//System.out.println("Transition from open to close eyes");
|
|
||||||
eye_state.set(0);
|
eye_state.set(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import BASS.AudioPlayer;
|
|||||||
import BASS.PlaybackStatus;
|
import BASS.PlaybackStatus;
|
||||||
import Camera.*;
|
import Camera.*;
|
||||||
import Config.CameraConfigEnum;
|
import Config.CameraConfigEnum;
|
||||||
import Config.SomeCodes;
|
|
||||||
import Database.PhotoReviewClass;
|
import Database.PhotoReviewClass;
|
||||||
import Database.Sqlite;
|
import Database.Sqlite;
|
||||||
import ErhaAPI.ErhaAPI;
|
import ErhaAPI.ErhaAPI;
|
||||||
@@ -13,6 +12,8 @@ import ErhaAPI.PhotoResult;
|
|||||||
import ErhaAPI.PatientRecord;
|
import ErhaAPI.PatientRecord;
|
||||||
import ErhaAPI.UploadResult;
|
import ErhaAPI.UploadResult;
|
||||||
|
|
||||||
|
import javafx.animation.KeyFrame;
|
||||||
|
import javafx.animation.Timeline;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
@@ -30,6 +31,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import javafx.scene.control.Alert.AlertType;
|
import javafx.scene.control.Alert.AlertType;
|
||||||
|
import javafx.util.Duration;
|
||||||
import org.bytedeco.javacv.OpenCVFrameGrabber;
|
import org.bytedeco.javacv.OpenCVFrameGrabber;
|
||||||
import org.bytedeco.javacv.VideoInputFrameGrabber;
|
import org.bytedeco.javacv.VideoInputFrameGrabber;
|
||||||
import org.bytedeco.opencv.opencv_core.Rect;
|
import org.bytedeco.opencv.opencv_core.Rect;
|
||||||
@@ -206,12 +208,10 @@ public class CaptureView {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
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 (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
||||||
if (AutoCloseAlert.banner_01!=null){
|
if (AutoCloseAlert.banner_01!=null){
|
||||||
System.out.println("Showing banner 01 because prefix invalid");
|
|
||||||
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -225,7 +225,6 @@ public class CaptureView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Photo Directory invalid, not taking photo");
|
|
||||||
isTakingPhoto.set(false);
|
isTakingPhoto.set(false);
|
||||||
AutoCloseAlert.show("Invalid Photo Directory","Photo Directory not set", "Please set photo directory at Setting", 5, s -> AutoCloseAlert.show("Setting", "Setting", "Please set photo directory", 0, null));
|
AutoCloseAlert.show("Invalid Photo Directory","Photo Directory not set", "Please set photo directory at Setting", 5, s -> AutoCloseAlert.show("Setting", "Setting", "Please set photo directory", 0, null));
|
||||||
}
|
}
|
||||||
@@ -307,8 +306,6 @@ public class CaptureView {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
String timestamp = SomeCodes.GetDateTimeString();
|
|
||||||
System.out.println("Creating timestamp: "+timestamp);
|
|
||||||
|
|
||||||
// check for blurred image
|
// check for blurred image
|
||||||
double score1=-1, score2=-1, score3=-1, score4=-1, score5=-1;
|
double score1=-1, score2=-1, score3=-1, score4=-1, score5=-1;
|
||||||
@@ -530,7 +527,6 @@ public class CaptureView {
|
|||||||
public void onPlaybackFinished(String filename) {
|
public void onPlaybackFinished(String filename) {
|
||||||
AutoCloseAlert.showpictures(prc.compressed(),3, (s)->{
|
AutoCloseAlert.showpictures(prc.compressed(),3, (s)->{
|
||||||
if (AutoCloseAlert.banner_02!=null) {
|
if (AutoCloseAlert.banner_02!=null) {
|
||||||
System.out.println("Showing banner 02 after photo taken");
|
|
||||||
AutoCloseAlert.showbanner(AutoCloseAlert.banner_02, 0, null);
|
AutoCloseAlert.showbanner(AutoCloseAlert.banner_02, 0, null);
|
||||||
|
|
||||||
UploadFiles(prc, prefix);
|
UploadFiles(prc, prefix);
|
||||||
@@ -573,7 +569,7 @@ public class CaptureView {
|
|||||||
int totalfiles = files.length;
|
int totalfiles = files.length;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (String ff : files) {
|
for (String ff : files) {
|
||||||
UploadResult ur = erhaAPI.Upload_File(prefix, ff,true);
|
UploadResult ur = erhaAPI.Upload_File(prefix, ff,false);
|
||||||
if (ur != null) {
|
if (ur != null) {
|
||||||
if (ur.message.startsWith("Record has been created")) {
|
if (ur.message.startsWith("Record has been created")) {
|
||||||
counter++;
|
counter++;
|
||||||
@@ -591,19 +587,12 @@ public class CaptureView {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
uploadtask.messageProperty().addListener((obs, oldval, newval)-> {
|
uploadtask.messageProperty().addListener((obs, oldval, newval)-> Logger.info(newval));
|
||||||
System.out.println("UploadTask message: "+newval);
|
|
||||||
Logger.info(newval);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
uploadtask.setOnSucceeded(e-> {
|
uploadtask.setOnSucceeded(e-> clear());
|
||||||
System.out.println("UploadTask succeeded");
|
|
||||||
clear();
|
|
||||||
});
|
|
||||||
|
|
||||||
uploadtask.setOnFailed(e-> {
|
uploadtask.setOnFailed(e-> {
|
||||||
System.out.println("UploadTask failed");
|
|
||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_upload_gagal)){
|
if (!Objects.equals(audioPlayer.getCurrentFile(), audio_upload_gagal)){
|
||||||
audioPlayer.StopCurrentPlayback();
|
audioPlayer.StopCurrentPlayback();
|
||||||
@@ -637,15 +626,12 @@ public class CaptureView {
|
|||||||
|
|
||||||
//tambahan 19/03/2025
|
//tambahan 19/03/2025
|
||||||
barcodeData.textProperty().addListener((observable, oldValue, newValue) -> {
|
barcodeData.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
System.out.println("barcodeData changed from ["+oldValue+"] to ["+newValue+"]");
|
|
||||||
if (ValidBarCode(newValue)){
|
if (ValidBarCode(newValue)){
|
||||||
if (Objects.equals(AutoCloseAlert.banner_01, AutoCloseAlert.shownBanner)){
|
if (Objects.equals(AutoCloseAlert.banner_01, AutoCloseAlert.shownBanner)){
|
||||||
System.out.println("Close banner 01");
|
|
||||||
AutoCloseAlert.close();
|
AutoCloseAlert.close();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (AutoCloseAlert.banner_01!=null){
|
if (AutoCloseAlert.banner_01!=null){
|
||||||
System.out.println("Show banner 01");
|
|
||||||
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0, null);
|
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -680,7 +666,6 @@ public class CaptureView {
|
|||||||
Platform.runLater(()->{
|
Platform.runLater(()->{
|
||||||
if (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
if (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
||||||
if (AutoCloseAlert.banner_01!=null){
|
if (AutoCloseAlert.banner_01!=null){
|
||||||
System.out.println("Showing banner 01 for first time");
|
|
||||||
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -886,6 +871,9 @@ public class CaptureView {
|
|||||||
boolean use_qr_detector = true;
|
boolean use_qr_detector = true;
|
||||||
|
|
||||||
LiveCamEvent lce = new LiveCamEvent() {
|
LiveCamEvent lce = new LiveCamEvent() {
|
||||||
|
|
||||||
|
Timeline audioTimeline;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDetectedQRCode(String barCode) {
|
public void onDetectedQRCode(String barCode) {
|
||||||
barCode = RemoveSpaces(barCode);
|
barCode = RemoveSpaces(barCode);
|
||||||
@@ -894,10 +882,39 @@ public class CaptureView {
|
|||||||
if (!barCode.equals(prefix)){
|
if (!barCode.equals(prefix)){
|
||||||
final String finalbarCode = barCode;
|
final String finalbarCode = barCode;
|
||||||
TextAreaSetText(barcodeData, finalbarCode);
|
TextAreaSetText(barcodeData, finalbarCode);
|
||||||
|
|
||||||
|
// revisi 19/05/2025
|
||||||
|
if (runningTask!=null) runningTask.cancel(false);
|
||||||
|
runningTask = timeoutExecutor.schedule(()->{
|
||||||
|
// timeout
|
||||||
|
clear();
|
||||||
|
}, timeout, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
// Revisi 19/05/2025
|
||||||
|
// pakai Timeline untuk pengulangan PlayFile audio_posisikan_muka dengan interval 5 detik
|
||||||
|
// diulang 3x
|
||||||
|
// terakhir, PlayFile audio_hubungi_staf_kami
|
||||||
|
|
||||||
|
audioTimeline = new Timeline();
|
||||||
|
int file_duration = 7; // audio_posisikan_muka durasi 7 detik
|
||||||
|
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(0), k1 ->{
|
||||||
|
|
||||||
|
}));
|
||||||
|
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(5+file_duration), k2 ->{
|
||||||
|
|
||||||
|
}));
|
||||||
|
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(10+file_duration), k3 ->{
|
||||||
|
|
||||||
|
}));
|
||||||
|
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(15+file_duration), k4 ->{
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
Task<PatientRecord> checkpatientID = new Task<>() {
|
Task<PatientRecord> checkpatientID = new Task<>() {
|
||||||
@Override
|
@Override
|
||||||
protected PatientRecord call() throws Exception {
|
protected PatientRecord call() throws Exception {
|
||||||
BarcodeResullt br = erhaAPI.Validate_Barcode(finalbarCode,true);
|
BarcodeResullt br = erhaAPI.Validate_Barcode(finalbarCode,false);
|
||||||
if (br!=null){
|
if (br!=null){
|
||||||
if (br.message.startsWith("Records found")){
|
if (br.message.startsWith("Records found")){
|
||||||
if (br.data!=null && br.data.length>0){
|
if (br.data!=null && br.data.length>0){
|
||||||
@@ -936,12 +953,8 @@ public class CaptureView {
|
|||||||
TextAreaSetText(medicalRecordID,""+medrecid);
|
TextAreaSetText(medicalRecordID,""+medrecid);
|
||||||
TextAreaSetText(PatientName, pr.name);
|
TextAreaSetText(PatientName, pr.name);
|
||||||
|
|
||||||
|
if (audioTimeline!=null) audioTimeline.play();
|
||||||
|
|
||||||
runningTask = timeoutExecutor.schedule(()->{
|
|
||||||
// timeout
|
|
||||||
System.out.println("runningTask timeout after "+timeout+" seconds");
|
|
||||||
clear();
|
|
||||||
}, timeout, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
if (!Objects.equals(audioPlayer.getCurrentFile(),audio_posisikan_muka)) {
|
if (!Objects.equals(audioPlayer.getCurrentFile(),audio_posisikan_muka)) {
|
||||||
@@ -992,7 +1005,6 @@ public class CaptureView {
|
|||||||
Task<?> failed = (Task<?>) event.getSource();
|
Task<?> failed = (Task<?>) event.getSource();
|
||||||
Throwable t = failed.getException();
|
Throwable t = failed.getException();
|
||||||
final String message = t.getMessage();
|
final String message = t.getMessage();
|
||||||
System.out.println("checkpatientID.setOnFailed message : "+message);
|
|
||||||
|
|
||||||
|
|
||||||
AutoCloseAlert.show("Data Tidak Ditemukan", "Pastikan data barcode anda benar", message , 5, s -> clear());
|
AutoCloseAlert.show("Data Tidak Ditemukan", "Pastikan data barcode anda benar", message , 5, s -> clear());
|
||||||
@@ -1019,6 +1031,8 @@ public class CaptureView {
|
|||||||
}
|
}
|
||||||
//update_status(image);
|
//update_status(image);
|
||||||
|
|
||||||
|
if (hasface && audioTimeline!=null) audioTimeline.stop();
|
||||||
|
|
||||||
// instruksi scan barcode ketika welcomeUI masih muncul dan ada muka terdeteksi
|
// instruksi scan barcode ketika welcomeUI masih muncul dan ada muka terdeteksi
|
||||||
if (hasface && Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
if (hasface && Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
||||||
if (audioPlayer!=null && audioPlayer.isInited()){
|
if (audioPlayer!=null && audioPlayer.isInited()){
|
||||||
@@ -1092,7 +1106,6 @@ public class CaptureView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDoubleBlink(int counter) {
|
public void onDoubleBlink(int counter) {
|
||||||
System.out.println("Double Blink detected at camera "+title+" delay= "+counter);
|
|
||||||
if (audioPlayer!=null && audioPlayer.isPlaying()) return; // let audio finish playback
|
if (audioPlayer!=null && audioPlayer.isPlaying()) return; // let audio finish playback
|
||||||
if (isTakingPhoto.get()) return; // other camera is taking picture
|
if (isTakingPhoto.get()) return; // other camera is taking picture
|
||||||
// revisi 08/04/2025
|
// revisi 08/04/2025
|
||||||
@@ -1145,7 +1158,6 @@ public class CaptureView {
|
|||||||
cam.getChildren().add(child);
|
cam.getChildren().add(child);
|
||||||
|
|
||||||
cam.widthProperty().addListener(observable ->{
|
cam.widthProperty().addListener(observable ->{
|
||||||
//System.out.println("Width property, cam "+camid+" width="+cam.getWidth()+" height="+cam.getHeight());
|
|
||||||
if (cam.getWidth()!=0) {
|
if (cam.getWidth()!=0) {
|
||||||
if (cam.getHeight()!=0){
|
if (cam.getHeight()!=0){
|
||||||
AnchorPane.setTopAnchor(child, 0.0);
|
AnchorPane.setTopAnchor(child, 0.0);
|
||||||
@@ -1156,7 +1168,6 @@ public class CaptureView {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
cam.heightProperty().addListener(observable -> {
|
cam.heightProperty().addListener(observable -> {
|
||||||
//System.out.println("Height property, cam "+camid+" width="+cam.getWidth()+" height="+cam.getHeight());
|
|
||||||
if (cam.getWidth()!=0) {
|
if (cam.getWidth()!=0) {
|
||||||
if (cam.getHeight()!=0){
|
if (cam.getHeight()!=0){
|
||||||
AnchorPane.setTopAnchor(child, 0.0);
|
AnchorPane.setTopAnchor(child, 0.0);
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ public class Detectors {
|
|||||||
for(Rect eye : eyes.get()){
|
for(Rect eye : eyes.get()){
|
||||||
if (SomeCodes.IsInsideRect(eye, face)) {
|
if (SomeCodes.IsInsideRect(eye, face)) {
|
||||||
dr.AddEye(eye);
|
dr.AddEye(eye);
|
||||||
System.out.println("face width : " + face.width() + " eye width : " + eye.width());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +144,6 @@ public class Detectors {
|
|||||||
//Logger.info("FaceMinSize created with value : " + FaceminSize.width());
|
//Logger.info("FaceMinSize created with value : " + FaceminSize.width());
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Face Min Size : " + FaceminSize.width());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setFaceMaxSize(int value){
|
public static void setFaceMaxSize(int value){
|
||||||
@@ -159,7 +157,6 @@ public class Detectors {
|
|||||||
//Logger.info("FaceMaxSize created with value : " + FacemaxSize.width());
|
//Logger.info("FaceMaxSize created with value : " + FacemaxSize.width());
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Face Max Size : " + FacemaxSize.width());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,17 +45,8 @@ public class PhotoRow {
|
|||||||
imgview.setStyle(borderstyle);
|
imgview.setStyle(borderstyle);
|
||||||
imgview.setOnMouseClicked(e->{
|
imgview.setOnMouseClicked(e->{
|
||||||
if (e.getClickCount()>=2){
|
if (e.getClickCount()>=2){
|
||||||
//System.out.println("Photo path: "+photopath);
|
|
||||||
File ff = new File(photopath);
|
File ff = new File(photopath);
|
||||||
// System.out.println("Config exists : "+(config!=null));
|
|
||||||
// System.out.println("Photo directory: "+config.getPhotoDirectory());
|
|
||||||
// System.out.println("Full quality directory: "+config.getFullQualityDirectory());
|
|
||||||
// System.out.println("Full Quality Crop directory: "+config.getFullQualityCropDirectory());
|
|
||||||
// System.out.println("Reduced quality directory: "+config.getCompressedDirectory());
|
|
||||||
// System.out.println("Reduced quality crop directory: "+config.getCompressedCropDirectory());
|
|
||||||
//String hires = Path.of(config.getPhotoDirectory(), ff.getName()).toString();
|
|
||||||
String hires = Path.of(config.getFullQualityDirectory(), ff.getName()).toString();
|
String hires = Path.of(config.getFullQualityDirectory(), ff.getName()).toString();
|
||||||
//System.out.println("Hires: "+hires);
|
|
||||||
File hiresfile = new File(hires);
|
File hiresfile = new File(hires);
|
||||||
if (hiresfile.isFile()){
|
if (hiresfile.isFile()){
|
||||||
System.out.println("Opening file: "+hires);
|
System.out.println("Opening file: "+hires);
|
||||||
|
|||||||
@@ -144,13 +144,11 @@ public class SettingView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MirrorCamera.selectedProperty().addListener(((observable, oldValue, newValue) -> {
|
MirrorCamera.selectedProperty().addListener(((observable, oldValue, newValue) -> {
|
||||||
System.out.println("Mirror option changed to : "+newValue);
|
|
||||||
config.setMirrorCamera(newValue);
|
config.setMirrorCamera(newValue);
|
||||||
config.Save();
|
config.Save();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
FlipCamera.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
FlipCamera.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
System.out.println("Flip option changed to : "+newValue);
|
|
||||||
config.setFlipCamera(newValue);
|
config.setFlipCamera(newValue);
|
||||||
config.Save();
|
config.Save();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user