diff --git a/java_console/.idea/modules.xml b/java_console/.idea/modules.xml
index a4410981d5..221d5f0437 100644
--- a/java_console/.idea/modules.xml
+++ b/java_console/.idea/modules.xml
@@ -9,6 +9,7 @@
+
diff --git a/java_console/autotest/src/com/rusefi/AutoTest.java b/java_console/autotest/src/com/rusefi/AutoTest.java
index e8dc3cff7d..8c71ae3bcd 100644
--- a/java_console/autotest/src/com/rusefi/AutoTest.java
+++ b/java_console/autotest/src/com/rusefi/AutoTest.java
@@ -555,7 +555,7 @@ public class AutoTest {
boolean failed = false;
try {
- LinkManager linkManager = new LinkManager();
+ LinkManager linkManager = new LinkManager(FileLog.LOGGER);
IoUtil.connectToSimulator(linkManager, startSimulator);
new AutoTest(linkManager, linkManager.getCommandQueue()).mainTestBody();
} catch (Throwable e) {
diff --git a/java_console/autotest/src/com/rusefi/EnduranceTest.java b/java_console/autotest/src/com/rusefi/EnduranceTest.java
index a152327ed0..055ae8177e 100644
--- a/java_console/autotest/src/com/rusefi/EnduranceTest.java
+++ b/java_console/autotest/src/com/rusefi/EnduranceTest.java
@@ -12,7 +12,7 @@ public class EnduranceTest {
private static final int DEFAULT_COUNT = 2000;
public static void main(String[] args) {
- LinkManager linkManager = new LinkManager();
+ LinkManager linkManager = new LinkManager(FileLog.LOGGER);
CommandQueue commandQueue = linkManager.getCommandQueue();
long start = System.currentTimeMillis();
int count = parseCount(args);
diff --git a/java_console/autotest/src/com/rusefi/RealHwTest.java b/java_console/autotest/src/com/rusefi/RealHwTest.java
index 1ba2e46f89..243628cb52 100644
--- a/java_console/autotest/src/com/rusefi/RealHwTest.java
+++ b/java_console/autotest/src/com/rusefi/RealHwTest.java
@@ -83,7 +83,7 @@ public class RealHwTest {
}
private static void runRealHardwareTest(String port) throws Exception {
- LinkManager linkManager = new LinkManager();
+ LinkManager linkManager = new LinkManager(FileLog.LOGGER);
IoUtil.realHardwareConnect(linkManager, port);
new AutoTest(linkManager, linkManager.getCommandQueue()).mainTestBody();
}
diff --git a/java_console/build.xml b/java_console/build.xml
index 7b10a4cfae..99a4a1447a 100644
--- a/java_console/build.xml
+++ b/java_console/build.xml
@@ -49,6 +49,7 @@
+
diff --git a/java_console/io/io.iml b/java_console/io/io.iml
index e97aff6d6d..8610955f8d 100644
--- a/java_console/io/io.iml
+++ b/java_console/io/io.iml
@@ -12,5 +12,6 @@
+
\ No newline at end of file
diff --git a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java
index 979b2051b5..1b663d06d1 100644
--- a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java
+++ b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java
@@ -57,9 +57,6 @@ public class BinaryProtocol implements BinaryProtocolCommands {
* todo: finish this feature, assuming we even need it.
*/
public static boolean PLAIN_PROTOCOL = Boolean.getBoolean(USE_PLAIN_PROTOCOL_PROPERTY);
- static {
- FileLog.MAIN.logLine(USE_PLAIN_PROTOCOL_PROPERTY + ": " + PLAIN_PROTOCOL);
- }
private final LinkManager linkManager;
private final Logger logger;
@@ -103,15 +100,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
state.setCurrentOutputs(currentOutputs);
}
- private SensorCentral.SensorListener rpmListener = value -> {
- if (value <= COMPOSITE_OFF_RPM) {
- needCompositeLogger = true;
- lastLowRpmTime = System.currentTimeMillis();
- } else if (System.currentTimeMillis() - lastLowRpmTime > HIGH_RPM_DELAY * Timeouts.SECOND) {
- FileLog.MAIN.logLine("Time to turn off composite logging");
- needCompositeLogger = false;
- }
- };
+ private SensorCentral.SensorListener rpmListener;
private final Thread hook = new Thread(() -> closeComposites());
@@ -122,6 +111,15 @@ public class BinaryProtocol implements BinaryProtocolCommands {
incomingData = createDataBuffer(stream, logger);
Runtime.getRuntime().addShutdownHook(hook);
+ rpmListener = value -> {
+ if (value <= COMPOSITE_OFF_RPM) {
+ needCompositeLogger = true;
+ lastLowRpmTime = System.currentTimeMillis();
+ } else if (System.currentTimeMillis() - lastLowRpmTime > HIGH_RPM_DELAY * Timeouts.SECOND) {
+ logger.info("Time to turn off composite logging");
+ needCompositeLogger = false;
+ }
+ };
}
public static IncomingDataBuffer createDataBuffer(IoStream stream, Logger logger) {
@@ -149,7 +147,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
}
public void doSend(final String command, boolean fireEvent) throws InterruptedException {
- FileLog.MAIN.logLine("Sending [" + command + "]");
+ logger.info("Sending [" + command + "]");
if (fireEvent && LinkManager.LOG_LEVEL.isDebugEnabled()) {
CommunicationLoggingHolder.communicationLoggingListener.onPortHolderMessage(BinaryProtocol.class, "Sending [" + command + "]");
}
@@ -221,7 +219,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
}
sleep(Timeouts.TEXT_PULL_PERIOD);
}
- FileLog.MAIN.logLine("Stopping text pull");
+ logger.info("Stopping text pull");
}
};
Thread tr = new Thread(textPull);
diff --git a/java_console/io/src/com/rusefi/io/LinkManager.java b/java_console/io/src/com/rusefi/io/LinkManager.java
index 250b9ea0e0..40c89843df 100644
--- a/java_console/io/src/com/rusefi/io/LinkManager.java
+++ b/java_console/io/src/com/rusefi/io/LinkManager.java
@@ -1,6 +1,7 @@
package com.rusefi.io;
import com.fazecast.jSerialComm.SerialPort;
+import com.opensr5.Logger;
import com.rusefi.FileLog;
import com.rusefi.NamedThreadFactory;
import com.rusefi.binaryprotocol.BinaryProtocol;
@@ -31,9 +32,14 @@ public class LinkManager {
public static final String LOG_VIEWER = "log viewer";
private final CommandQueue commandQueue = new CommandQueue(this);
+ private final Logger logger;
private LinkConnector connector;
+ public LinkManager(Logger logger) {
+ this.logger = logger;
+ }
+
@NotNull
public CountDownLatch connect(String port) {
final CountDownLatch connected = new CountDownLatch(1);
diff --git a/java_console/logging-api/logging-api.iml b/java_console/logging-api/logging-api.iml
new file mode 100644
index 0000000000..f76df2b77e
--- /dev/null
+++ b/java_console/logging-api/logging-api.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/java_console/logging/src/com/opensr5/Logger.java b/java_console/logging-api/src/main/java/com/opensr5/Logger.java
similarity index 83%
rename from java_console/logging/src/com/opensr5/Logger.java
rename to java_console/logging-api/src/main/java/com/opensr5/Logger.java
index abb796bb54..1cd74d0aee 100644
--- a/java_console/logging/src/com/opensr5/Logger.java
+++ b/java_console/logging-api/src/main/java/com/opensr5/Logger.java
@@ -22,6 +22,11 @@ public interface Logger {
public void error(String msg) {
System.err.println(new Date() + " " + msg);
}
+
+ @Override
+ public boolean isTradeEnabled() {
+ return false;
+ }
};
void trace(String msg);
@@ -29,4 +34,6 @@ public interface Logger {
void info(String msg);
void error(String msg);
+
+ boolean isTradeEnabled();
}
diff --git a/java_console/logging/logging.iml b/java_console/logging/logging.iml
index 28440cbc44..df2deabda2 100644
--- a/java_console/logging/logging.iml
+++ b/java_console/logging/logging.iml
@@ -8,5 +8,6 @@
+
\ No newline at end of file
diff --git a/java_console/logging/src/com/rusefi/FileLog.java b/java_console/logging/src/com/rusefi/FileLog.java
index 3872fbbec0..a5709b8f86 100644
--- a/java_console/logging/src/com/rusefi/FileLog.java
+++ b/java_console/logging/src/com/rusefi/FileLog.java
@@ -30,6 +30,11 @@ public enum FileLog {
public void trace(String msg) {
}
+ @Override
+ public boolean isTradeEnabled() {
+ return false;
+ }
+
@Override
public void info(String msg) {
MAIN.logLine(msg);
diff --git a/java_console/ui/com/rusefi/io/test/TcpCommunicationIntegrationTest.java b/java_console/ui/com/rusefi/io/test/TcpCommunicationIntegrationTest.java
index 43e266532c..e88c57e73b 100644
--- a/java_console/ui/com/rusefi/io/test/TcpCommunicationIntegrationTest.java
+++ b/java_console/ui/com/rusefi/io/test/TcpCommunicationIntegrationTest.java
@@ -2,6 +2,7 @@ package com.rusefi.io.test;
import com.opensr5.ConfigurationImage;
import com.opensr5.ini.field.ScalarIniField;
+import com.rusefi.FileLog;
import com.rusefi.binaryprotocol.BinaryProtocolState;
import com.rusefi.config.Field;
import com.rusefi.config.generated.Fields;
@@ -30,7 +31,7 @@ public class TcpCommunicationIntegrationTest {
state.setController(ci);
state.setCurrentOutputs(new byte[1 + Fields.TS_OUTPUT_SIZE]);
- LinkManager linkManager = new LinkManager();
+ LinkManager linkManager = new LinkManager(FileLog.LOGGER);
linkManager.setConnector(LinkConnector.getDetachedConnector(state));
BinaryProtocolServer server = new BinaryProtocolServer();
server.start(linkManager, port);
@@ -39,7 +40,7 @@ public class TcpCommunicationIntegrationTest {
// todo: remove CONFIGURATION_RUSEFI_BINARY or nicer API to disable local file load
- LinkManager clientManager = new LinkManager();
+ LinkManager clientManager = new LinkManager(FileLog.LOGGER);
clientManager.startAndConnect(Integer.toString(port), new ConnectionStateListener() {
@Override
public void onConnectionEstablished() {
diff --git a/java_console/ui/src/main/java/com/rusefi/autodetect/ReconnectSandbox.java b/java_console/ui/src/main/java/com/rusefi/autodetect/ReconnectSandbox.java
index 0728090650..53508664d8 100644
--- a/java_console/ui/src/main/java/com/rusefi/autodetect/ReconnectSandbox.java
+++ b/java_console/ui/src/main/java/com/rusefi/autodetect/ReconnectSandbox.java
@@ -1,5 +1,6 @@
package com.rusefi.autodetect;
+import com.rusefi.FileLog;
import com.rusefi.IoUtil;
import com.rusefi.io.ConnectionStatusLogic;
import com.rusefi.io.LinkManager;
@@ -10,7 +11,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class ReconnectSandbox {
public static void main(String[] args) {
- LinkManager linkManager = new LinkManager();
+ LinkManager linkManager = new LinkManager(FileLog.LOGGER);
LightweightGUI.waitForDeviceAndStart(linkManager);
diff --git a/java_console/ui/src/main/java/com/rusefi/tools/ConsoleTools.java b/java_console/ui/src/main/java/com/rusefi/tools/ConsoleTools.java
index a80e8dc44b..66ac8132a2 100644
--- a/java_console/ui/src/main/java/com/rusefi/tools/ConsoleTools.java
+++ b/java_console/ui/src/main/java/com/rusefi/tools/ConsoleTools.java
@@ -195,7 +195,7 @@ public class ConsoleTools {
System.err.println("rusEFI not detected");
return;
}
- LinkManager linkManager = new LinkManager();
+ LinkManager linkManager = new LinkManager(FileLog.LOGGER);
linkManager.startAndConnect(autoDetectedPort, new ConnectionStateListener() {
@Override
public void onConnectionEstablished() {
diff --git a/java_console/ui/src/main/java/com/rusefi/ui/UIContext.java b/java_console/ui/src/main/java/com/rusefi/ui/UIContext.java
index fd0ea6aca2..07226b801a 100644
--- a/java_console/ui/src/main/java/com/rusefi/ui/UIContext.java
+++ b/java_console/ui/src/main/java/com/rusefi/ui/UIContext.java
@@ -1,12 +1,13 @@
package com.rusefi.ui;
+import com.rusefi.FileLog;
import com.rusefi.SensorSnifferCentral;
import com.rusefi.io.CommandQueue;
import com.rusefi.io.LinkManager;
import com.rusefi.sensor_logs.SensorLogger;
public class UIContext {
- private final LinkManager linkManager = new LinkManager();
+ private final LinkManager linkManager = new LinkManager(FileLog.LOGGER);
public SensorLogger sensorLogger = new SensorLogger(this);
public GaugesPanel.DetachedRepository DetachedRepositoryINSTANCE = new GaugesPanel.DetachedRepository(this);
diff --git a/java_console/io/src/com/rusefi/io/tcp/test/BinaryProtocolServerSandbox.java b/java_console/ui/src/test/java/com/rusefi/io/tcp/test/BinaryProtocolServerSandbox.java
similarity index 88%
rename from java_console/io/src/com/rusefi/io/tcp/test/BinaryProtocolServerSandbox.java
rename to java_console/ui/src/test/java/com/rusefi/io/tcp/test/BinaryProtocolServerSandbox.java
index 33d73066c4..ffa4573f0e 100644
--- a/java_console/io/src/com/rusefi/io/tcp/test/BinaryProtocolServerSandbox.java
+++ b/java_console/ui/src/test/java/com/rusefi/io/tcp/test/BinaryProtocolServerSandbox.java
@@ -1,6 +1,7 @@
package com.rusefi.io.tcp.test;
import com.opensr5.ConfigurationImage;
+import com.rusefi.FileLog;
import com.rusefi.binaryprotocol.BinaryProtocolState;
import com.rusefi.config.generated.Fields;
import com.rusefi.io.LinkConnector;
@@ -13,7 +14,7 @@ class BinaryProtocolServerSandbox {
state.setController(new ConfigurationImage(new byte[Fields.TOTAL_CONFIG_SIZE]));
state.setCurrentOutputs(new byte[1 + Fields.TS_OUTPUT_SIZE]);
- LinkManager linkManager = new LinkManager();
+ LinkManager linkManager = new LinkManager(FileLog.LOGGER);
linkManager.setConnector(LinkConnector.getDetachedConnector(state));
new BinaryProtocolServer().start(linkManager);
}
diff --git a/java_tools/configuration_definition/.idea/modules.xml b/java_tools/configuration_definition/.idea/modules.xml
index 67f239dbf8..0f83a600b6 100644
--- a/java_tools/configuration_definition/.idea/modules.xml
+++ b/java_tools/configuration_definition/.idea/modules.xml
@@ -7,6 +7,7 @@
+
diff --git a/java_tools/configuration_definition/build.xml b/java_tools/configuration_definition/build.xml
index 4c1078a740..427356b8ce 100644
--- a/java_tools/configuration_definition/build.xml
+++ b/java_tools/configuration_definition/build.xml
@@ -20,6 +20,7 @@
+
diff --git a/java_tools/ts_plugin/build.xml b/java_tools/ts_plugin/build.xml
index 13ed03ad5f..a9968f786a 100644
--- a/java_tools/ts_plugin/build.xml
+++ b/java_tools/ts_plugin/build.xml
@@ -20,6 +20,7 @@
+