added env support for COM port (#24)

This commit is contained in:
Valentin Heiserer
2024-04-16 22:27:21 +02:00
committed by GitHub
parent 09c38c81dd
commit c17202a83b

View File

@@ -10,7 +10,7 @@ public class UsbCardReader extends CardReader {
private volatile boolean isRunning = true; private volatile boolean isRunning = true;
Dotenv dotenv = Dotenv.configure().directory("./").load(); Dotenv dotenv = Dotenv.configure().directory("./").load();
private String PORT_NAME = dotenv.get("COM_PORT"); private final String comPort = dotenv.get("COM_PORT");
/** /**
* Creates an Instance of the KartenLeser. * Creates an Instance of the KartenLeser.
@@ -33,14 +33,14 @@ public class UsbCardReader extends CardReader {
SerialPort selectedPort = null; SerialPort selectedPort = null;
for (SerialPort port : ports) { for (SerialPort port : ports) {
if (port.getSystemPortName().equals(this.PORT_NAME)) { if (port.getSystemPortName().equals(this.comPort)) {
selectedPort = port; selectedPort = port;
break; break;
} }
} }
if (selectedPort == null) { if (selectedPort == null) {
System.out.println(this.PORT_NAME + " not found"); System.out.println(this.comPort + " not found");
return; return;
} }