command line utility progress

only:hellen-honda-k
This commit is contained in:
rusefillc 2024-09-30 13:18:23 -04:00
parent b46999e667
commit 6141232256
1 changed files with 7 additions and 5 deletions

View File

@ -108,13 +108,14 @@ public class ConsoleTools {
throw new IllegalStateException("argument expected");
String command = CommandHelper.assembleCommand(args);
log.info("Sending command [" + command + "]");
sendCommand(command);
IoStream stream = sendNonBlockingCommandDoNotWaitForConfirmation(command);
stream.close(); // this would close connector non-daemon thread
// sleepAndPrintNonDaemons(4000);
}
}, "Sends command specified as second argument");
registerTool("reboot_ecu", args -> sendCommand(Integration.CMD_REBOOT), "Sends a command to reboot rusEFI controller.");
registerTool("reboot_ecu", args -> sendNonBlockingCommandDoNotWaitForConfirmation(Integration.CMD_REBOOT), "Sends a command to reboot rusEFI controller.");
registerTool(Integration.CMD_REBOOT_DFU, args -> {
sendCommand(Integration.CMD_REBOOT_DFU);
sendNonBlockingCommandDoNotWaitForConfirmation(Integration.CMD_REBOOT_DFU);
/**
* AndreiKA reports that auto-detect fails to interrupt communication threads while in native code
* See https://github.com/rusefi/rusefi/issues/3300
@ -198,13 +199,14 @@ public class ConsoleTools {
}
}
private static void sendCommand(String command) throws IOException {
private static IoStream sendNonBlockingCommandDoNotWaitForConfirmation(String command) throws IOException {
String autoDetectedPort = autoDetectPort();
if (autoDetectedPort == null)
return;
return null;
IoStream stream = UiLinkManagerHelper.open(autoDetectedPort);
byte[] commandBytes = BinaryProtocol.getTextCommandBytes(command);
stream.sendPacket(commandBytes);
return stream;
}
private static void sleepAndPrintNonDaemons(final int millis) {