mirror of https://github.com/rusefi/rusefi-1.git
REO progress
This commit is contained in:
parent
c5a468c292
commit
39ee879d15
|
@ -161,6 +161,10 @@ public class LinkManager {
|
|||
}
|
||||
}
|
||||
|
||||
public static void setConnector(LinkConnector connector) {
|
||||
LinkManager.connector = connector;
|
||||
}
|
||||
|
||||
public static boolean isLogViewerMode(String port) {
|
||||
Objects.requireNonNull(port, "port");
|
||||
return port.equals(LOG_VIEWER);
|
||||
|
|
|
@ -11,9 +11,11 @@ import java.io.*;
|
|||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
import static com.rusefi.config.generated.Fields.TS_PROTOCOL;
|
||||
|
||||
/**
|
||||
* This class makes rusEfi console a proxy for other tuning software, this way we can have two tools connected via same
|
||||
* serial port simultaniously
|
||||
* serial port simultaneously
|
||||
*
|
||||
* @author Andrey Belomutskiy
|
||||
* 11/24/15
|
||||
|
@ -23,9 +25,6 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
|
|||
private static final int PROXY_PORT = 2390;
|
||||
private static final String TS_OK = "\0";
|
||||
|
||||
private static final String TS_SIGNATURE = "MShift v0.01";
|
||||
private static final String TS_PROTOCOL = "001";
|
||||
|
||||
public static void start() {
|
||||
FileLog.MAIN.logLine("BinaryProtocolServer on " + PROXY_PORT);
|
||||
Runnable runnable = new Runnable() {
|
||||
|
@ -102,10 +101,12 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
|
|||
|
||||
TcpIoStream stream = new TcpIoStream(clientSocket.getInputStream(), clientSocket.getOutputStream());
|
||||
if (command == COMMAND_HELLO) {
|
||||
stream.sendPacket((TS_OK + TS_SIGNATURE).getBytes(), FileLog.LOGGER);
|
||||
stream.sendPacket((TS_OK + Fields.TS_SIGNATURE).getBytes(), FileLog.LOGGER);
|
||||
} else if (command == COMMAND_PROTOCOL) {
|
||||
// System.out.println("Ignoring crc F command");
|
||||
stream.sendPacket((TS_OK + TS_PROTOCOL).getBytes(), FileLog.LOGGER);
|
||||
} else if (command == Fields.TS_GET_FIRMWARE_VERSION) {
|
||||
stream.sendPacket((TS_OK + "rusEFI proxy").getBytes(), FileLog.LOGGER);
|
||||
} else if (command == COMMAND_CRC_CHECK_COMMAND) {
|
||||
short page = dis.readShort();
|
||||
short offset = dis.readShort();
|
||||
|
|
|
@ -5,6 +5,9 @@ import com.rusefi.FileLog;
|
|||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocolHolder;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.io.ConnectionStateListener;
|
||||
import com.rusefi.io.LinkConnector;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.io.tcp.BinaryProtocolServer;
|
||||
import com.rusefi.io.tcp.TcpIoStream;
|
||||
|
||||
|
@ -15,7 +18,28 @@ class BinaryProtocolServerSandbox {
|
|||
public static void main(String[] args) {
|
||||
TcpIoStream stream = new TcpIoStream(new ByteArrayInputStream(new byte[0]), new ByteArrayOutputStream());
|
||||
BinaryProtocol bp = BinaryProtocolHolder.getInstance().create(FileLog.LOGGER, stream);
|
||||
bp.setController(new ConfigurationImage(new byte[14008]));
|
||||
LinkManager.setConnector(new LinkConnector() {
|
||||
@Override
|
||||
public void connectAndReadConfiguration(ConnectionStateListener listener) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(String command, boolean fireEvent) throws InterruptedException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restart() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryProtocol getBinaryProtocol() {
|
||||
return bp;
|
||||
}
|
||||
});
|
||||
bp.setController(new ConfigurationImage(new byte[Fields.TOTAL_CONFIG_SIZE]));
|
||||
bp.currentOutputs = new byte[1 + Fields.TS_OUTPUT_SIZE];
|
||||
BinaryProtocolServer.start();
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class MainFrame {
|
|||
tabbedPane.settingsTab.showContent();
|
||||
tabbedPane.logsManager.showContent();
|
||||
tabbedPane.fuelTunePane.showContent();
|
||||
BinaryProtocolServer.start();
|
||||
BinaryProtocolServer.start(Fields.TS_SIGNATURE);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue