mirror of https://github.com/rusefi/rusefi-1.git
refactoring: better dependency control
This commit is contained in:
parent
0e6c445a08
commit
e204e64316
|
@ -142,7 +142,7 @@ public class TestingUtils {
|
||||||
long waitStartTime = System.currentTimeMillis();
|
long waitStartTime = System.currentTimeMillis();
|
||||||
IoUtil.wait(engineChartLatch, timeoutMs);
|
IoUtil.wait(engineChartLatch, timeoutMs);
|
||||||
FileLog.MAIN.logLine("got next chart in " + (System.currentTimeMillis() - waitStartTime) + "ms for engine_type " + AutoTest.currentEngineType);
|
FileLog.MAIN.logLine("got next chart in " + (System.currentTimeMillis() - waitStartTime) + "ms for engine_type " + AutoTest.currentEngineType);
|
||||||
LinkManager.engineState.replaceStringValueAction(EngineReport.ENGINE_CHART, (EngineState.ValueCallback<String>) EngineState.ValueCallback.VOID);
|
commandQueue.getLinkManager().getEngineState().replaceStringValueAction(EngineReport.ENGINE_CHART, (EngineState.ValueCallback<String>) EngineState.ValueCallback.VOID);
|
||||||
if (result.get() == null)
|
if (result.get() == null)
|
||||||
throw new IllegalStateException("Chart timeout: " + timeoutMs);
|
throw new IllegalStateException("Chart timeout: " + timeoutMs);
|
||||||
return result.get();
|
return result.get();
|
||||||
|
|
|
@ -140,11 +140,7 @@ public class LinkManager {
|
||||||
// throw new IllegalStateException("Communication on wrong thread");
|
// throw new IllegalStateException("Communication on wrong thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
public EngineState getEngineState() {
|
private EngineState engineState = new EngineState(new EngineState.EngineStateListenerImpl() {
|
||||||
return engineState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EngineState engineState = new EngineState(new EngineState.EngineStateListenerImpl() {
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeLine(String fullLine) {
|
public void beforeLine(String fullLine) {
|
||||||
FileLog.MAIN.logLine(fullLine);
|
FileLog.MAIN.logLine(fullLine);
|
||||||
|
@ -152,6 +148,10 @@ public class LinkManager {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
public EngineState getEngineState() {
|
||||||
|
return engineState;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This flag controls if mock controls are needed
|
* This flag controls if mock controls are needed
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,7 +19,7 @@ import java.awt.*;
|
||||||
* Andrey Belomutskiy, (c) 2013-2020
|
* Andrey Belomutskiy, (c) 2013-2020
|
||||||
*/
|
*/
|
||||||
public class PortHolder {
|
public class PortHolder {
|
||||||
private static final DataListener dataListener = freshData -> LinkManager.engineState.processNewData(new String(freshData), LinkManager.ENCODER);
|
private final DataListener dataListener;
|
||||||
private final LinkManager linkManager;
|
private final LinkManager linkManager;
|
||||||
|
|
||||||
public ConnectionStateListener listener;
|
public ConnectionStateListener listener;
|
||||||
|
@ -30,6 +30,7 @@ public class PortHolder {
|
||||||
|
|
||||||
protected PortHolder(LinkManager linkManager) {
|
protected PortHolder(LinkManager linkManager) {
|
||||||
this.linkManager = linkManager;
|
this.linkManager = linkManager;
|
||||||
|
dataListener = freshData -> linkManager.getEngineState().processNewData(new String(freshData), LinkManager.ENCODER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String port;
|
public String port;
|
||||||
|
|
Loading…
Reference in New Issue