REO progress
This commit is contained in:
parent
10db154a21
commit
e77e7bd7d2
|
@ -5,7 +5,9 @@ import com.rusefi.Listener;
|
|||
import com.rusefi.Timeouts;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||
import com.rusefi.binaryprotocol.IncomingDataBuffer;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.io.IoStream;
|
||||
import com.rusefi.proxy.NetworkConnector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -55,6 +57,9 @@ public class BinaryProtocolProxy {
|
|||
continue;
|
||||
}
|
||||
BinaryProtocolServer.Packet clientRequest = readClientRequest(clientStream.getDataBuffer(), firstByte);
|
||||
byte[] packet = clientRequest.getPacket();
|
||||
if (packet.length > 1 && packet[0] == Fields.TS_ONLINE_PROTOCOL && packet[1] == NetworkConnector.DISCONNECT)
|
||||
throw new IOException("User requested disconnect");
|
||||
|
||||
/**
|
||||
* Two reasons for synchronization:
|
||||
|
|
|
@ -33,6 +33,7 @@ import static com.rusefi.binaryprotocol.BinaryProtocol.sleep;
|
|||
* see NetworkConnectorStartup
|
||||
*/
|
||||
public class NetworkConnector implements Closeable {
|
||||
public static final byte DISCONNECT = 14;
|
||||
public static final byte UPDATE_CONNECTOR_SOFTWARE = 15;
|
||||
public static final byte UPDATE_FIRMWARE = 16;
|
||||
private final static Logging log = Logging.getLogging(NetworkConnector.class);
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.rusefi.proxy.client;
|
|||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.NamedThreadFactory;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.io.IoStream;
|
||||
import com.rusefi.io.commands.GetOutputsCommand;
|
||||
import com.rusefi.io.commands.HelloCommand;
|
||||
|
@ -10,6 +11,7 @@ import com.rusefi.io.serial.StreamStatistics;
|
|||
import com.rusefi.io.tcp.BinaryProtocolProxy;
|
||||
import com.rusefi.io.tcp.ServerSocketReference;
|
||||
import com.rusefi.io.tcp.TcpIoStream;
|
||||
import com.rusefi.proxy.NetworkConnector;
|
||||
import com.rusefi.server.ApplicationRequest;
|
||||
import com.rusefi.server.rusEFISSLContext;
|
||||
import com.rusefi.tools.online.HttpUtil;
|
||||
|
@ -133,6 +135,13 @@ public class LocalApplicationProxy implements Closeable {
|
|||
@Override
|
||||
public void close() {
|
||||
serverHolder.close();
|
||||
byte[] request = new byte[2];
|
||||
request[0] = Fields.TS_ONLINE_PROTOCOL;
|
||||
request[1] = NetworkConnector.DISCONNECT;
|
||||
try {
|
||||
authenticatorToProxyStream.sendPacket(request);
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
authenticatorToProxyStream.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,8 @@ public class RemoteTab {
|
|||
if (currentState == null) {
|
||||
requestListDownload();
|
||||
} else {
|
||||
setConnectedStatus(currentState.getApplicationRequest().getVehicleOwner(), null);
|
||||
setConnectedStatus(currentState.getApplicationRequest().getVehicleOwner(), null,
|
||||
currentState.getApplicationRequest().getSessionDetails().getControllerInfo());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,7 +210,7 @@ public class RemoteTab {
|
|||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setConnectedStatus(publicSession.getVehicleOwner(), authenticatorToProxyStream);
|
||||
setConnectedStatus(publicSession.getVehicleOwner(), authenticatorToProxyStream, publicSession.getControllerInfo());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -219,13 +220,14 @@ public class RemoteTab {
|
|||
}, "Authenticator").start();
|
||||
}
|
||||
|
||||
private void setConnectedStatus(UserDetails userDetails, StreamStatistics authenticatorToProxyStream) {
|
||||
private void setConnectedStatus(UserDetails userDetails, StreamStatistics authenticatorToProxyStream, ControllerInfo controllerInfo) {
|
||||
if (authenticatorToProxyStream != null) {
|
||||
streamStatusControl = new StreamStatusControl(authenticatorToProxyStream);
|
||||
}
|
||||
|
||||
setStatus("Connected to " + userDetails.getUserName(),
|
||||
new JLabel("You can now connect your TunerStudio to IP address localhost and port " + getLocalPort()),
|
||||
new URLLabel(SignatureHelper.getUrl(controllerInfo.getSignature())),
|
||||
disconnect, streamStatusControl == null ? null : streamStatusControl.getContent());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue