only:API change

This commit is contained in:
rusefi 2024-08-18 19:08:37 -04:00
parent b06bb69564
commit 6046c552a2
5 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,6 @@ import com.rusefi.Timeouts;
import com.rusefi.binaryprotocol.BinaryProtocol;
import com.rusefi.binaryprotocol.IncomingDataBuffer;
import com.rusefi.binaryprotocol.IoHelper;
import com.rusefi.config.generated.Fields;
import com.rusefi.config.generated.Integration;
import com.rusefi.io.IoStream;
import com.rusefi.proxy.NetworkConnector;
@ -53,10 +52,10 @@ public class BinaryProtocolProxy {
}
public interface ClientApplicationActivityListener {
ClientApplicationActivityListener VOID = () -> {
ClientApplicationActivityListener VOID = (BinaryProtocolServer.Packet clientRequest) -> {
};
void onActivity();
void onActivity(BinaryProtocolServer.Packet clientRequest);
}
public static void runProxy(IoStream targetEcu, IoStream clientStream, ClientApplicationActivityListener listener, int timeoutMs) throws IOException {
@ -75,7 +74,7 @@ public class BinaryProtocolProxy {
byte[] packet = clientRequest.getPacket();
if (packet.length > 1 && packet[0] == Integration.TS_ONLINE_PROTOCOL && packet[1] == NetworkConnector.DISCONNECT)
throw new IOException("User requested disconnect");
listener.onActivity();
listener.onActivity(clientRequest);
/**
* Two reasons for synchronization:

View File

@ -2,7 +2,6 @@ package com.rusefi.proxy.client;
import com.devexperts.logging.Logging;
import com.rusefi.NamedThreadFactory;
import com.rusefi.config.generated.Fields;
import com.rusefi.config.generated.Integration;
import com.rusefi.io.IoStream;
import com.rusefi.io.commands.GetOutputsCommand;
@ -10,6 +9,7 @@ import com.rusefi.io.commands.HelloCommand;
import com.rusefi.io.serial.AbstractIoStream;
import com.rusefi.io.serial.StreamStatistics;
import com.rusefi.io.tcp.BinaryProtocolProxy;
import com.rusefi.io.tcp.BinaryProtocolServer;
import com.rusefi.io.tcp.ServerSocketReference;
import com.rusefi.io.tcp.TcpIoStream;
import com.rusefi.proxy.NetworkConnector;
@ -104,7 +104,7 @@ public class LocalApplicationProxy implements Closeable {
LocalApplicationProxy.sendHello(authenticatorToProxyStream, applicationRequest);
AtomicLong lastActivity = new AtomicLong(System.currentTimeMillis());
BinaryProtocolProxy.ClientApplicationActivityListener clientApplicationActivityListener = () -> lastActivity.set(System.currentTimeMillis());
BinaryProtocolProxy.ClientApplicationActivityListener clientApplicationActivityListener = (BinaryProtocolServer.Packet clientRequest) -> lastActivity.set(System.currentTimeMillis());
/**
* We need to entertain proxy server and remote controller while user has already connected to proxy but has not yet started TunerStudio

View File

@ -133,7 +133,7 @@ public class ConsoleTools {
ServerSocketReference serverHolder = BinaryProtocolProxy.createProxy(ecuStream, 29001, new BinaryProtocolProxy.ClientApplicationActivityListener() {
@Override
public void onActivity() {
public void onActivity(BinaryProtocolServer.Packet clientRequest) {
}
}, StatusConsumer.ANONYMOUS);

View File

@ -6,6 +6,7 @@ import com.rusefi.autodetect.SerialAutoChecker;
import com.rusefi.io.can.elm.Elm327Connector;
import com.rusefi.io.serial.SerialIoStream;
import com.rusefi.io.tcp.BinaryProtocolProxy;
import com.rusefi.io.tcp.BinaryProtocolServer;
import com.rusefi.io.tcp.TcpConnector;
import com.rusefi.ui.StatusConsumer;
@ -28,7 +29,7 @@ public class Elm327ConnectorStartup {
BinaryProtocolProxy.createProxy(elm327Connector.getTsStream(), TcpConnector.DEFAULT_PORT, new BinaryProtocolProxy.ClientApplicationActivityListener() {
@Override
public void onActivity() {
public void onActivity(BinaryProtocolServer.Packet clientRequest) {
System.out.println("onActivity");
Elm327Connector.whyDoWeNeedToSleepBetweenCommands();
}

View File

@ -95,7 +95,7 @@ public class TcpCommunicationIntegrationTest {
// connect proxy to virtual controller
IoStream targetEcuSocket = TestHelper.connectToLocalhost(controllerPort);
final AtomicInteger relayCommandCounter = new AtomicInteger();
BinaryProtocolProxy.createProxy(targetEcuSocket, proxyPort, () -> relayCommandCounter.incrementAndGet(),
BinaryProtocolProxy.createProxy(targetEcuSocket, proxyPort, (BinaryProtocolServer.Packet clientRequest) -> relayCommandCounter.incrementAndGet(),
StatusConsumer.ANONYMOUS);
CountDownLatch connectionEstablishedCountDownLatch = new CountDownLatch(1);