only:encapsulation good!

This commit is contained in:
Andrey 2024-09-12 14:36:42 -04:00
parent 1661643c49
commit 6a63adf267
3 changed files with 7 additions and 3 deletions

View File

@ -111,7 +111,7 @@ public class BinaryProtocol {
return stream; return stream;
} }
public boolean isClosed; private boolean isClosed;
public final CommunicationLoggingListener communicationLoggingListener; public final CommunicationLoggingListener communicationLoggingListener;
@ -125,6 +125,10 @@ public class BinaryProtocol {
binaryProtocolLogger = new BinaryProtocolLogger(linkManager); binaryProtocolLogger = new BinaryProtocolLogger(linkManager);
} }
public boolean isClosed() {
return isClosed;
}
public static void sleep(long millis) { public static void sleep(long millis) {
try { try {
Thread.sleep(millis); Thread.sleep(millis);

View File

@ -92,7 +92,7 @@ public class BinaryProtocolLogger {
} }
public void getComposite(BinaryProtocol binaryProtocol) { public void getComposite(BinaryProtocol binaryProtocol) {
if (binaryProtocol.isClosed) if (binaryProtocol.isClosed())
return; return;
// get command would enable composite logging in controller but we need to turn it off from our end // get command would enable composite logging in controller but we need to turn it off from our end

View File

@ -144,7 +144,7 @@ public class MainFrame {
consoleUI.uiContext.DetachedRepositoryINSTANCE.saveConfig(); consoleUI.uiContext.DetachedRepositoryINSTANCE.saveConfig();
getConfig().save(); getConfig().save();
BinaryProtocol bp = consoleUI.uiContext.getLinkManager().getCurrentStreamState(); BinaryProtocol bp = consoleUI.uiContext.getLinkManager().getCurrentStreamState();
if (bp != null && !bp.isClosed) if (bp != null && !bp.isClosed())
bp.close(); // it could be that serial driver wants to be closed explicitly bp.close(); // it could be that serial driver wants to be closed explicitly
IoUtils.exit("windowClosedHandler", 0); IoUtils.exit("windowClosedHandler", 0);
} }