MRE + USB cable + Android + WiFi I get about 8Hz Runtime Data Rate :(

This commit is contained in:
rusefillc 2022-05-25 00:14:30 -04:00
parent 1800e4d897
commit 664465268d
2 changed files with 26 additions and 0 deletions

View File

@ -57,6 +57,7 @@ import com.rusefi.io.IoStream;
import com.rusefi.io.LinkManager;
import com.rusefi.io.commands.ErrorInfoCommand;
import com.rusefi.io.serial.StreamConnector;
import com.rusefi.io.tcp.BinaryProtocolProxy;
import com.rusefi.proxy.NetworkConnector;
import com.rusefi.proxy.NetworkConnectorContext;
import com.rusefi.ui.StatusConsumer;
@ -261,7 +262,26 @@ public class rusEFI extends Activity {
connectDashboard();
}
/**
* MRE + USB cable + Android + WiFi I get about 8Hz Runtime Data Rate :(
*/
public void onLocalBroadcast(View view) {
AndroidSerial serial = AndroidSerial.getAndroidSerial(this, mStatusView, usbManager);
if (serial == null) {
// error already reported to mStatusView
return;
}
try {
BinaryProtocolProxy.createProxy(serial, LOCAL_PORT, new BinaryProtocolProxy.ClientApplicationActivityListener() {
@Override
public void onActivity() {
}
});
visibleLogAppend("Running TCP/IP proxy on " + LOCAL_PORT);
} catch (IOException e) {
e.printStackTrace();
}
}
/**

View File

@ -21,6 +21,9 @@ import static com.devexperts.logging.Logging.getLogging;
import static com.rusefi.config.generated.Fields.TS_PROTOCOL;
import static com.rusefi.shared.FileUtil.close;
/**
* Takes any IoStream and exposes it as local TCP/IP server socket
*/
public class BinaryProtocolProxy {
private static final Logging log = getLogging(BinaryProtocolProxy.class);
/**
@ -30,6 +33,9 @@ public class BinaryProtocolProxy {
*/
public static final int USER_IO_TIMEOUT = 10 * Timeouts.MINUTE;
/**
* @return starts a thread and returns a reference to ServerSocketReference
*/
public static ServerSocketReference createProxy(IoStream targetEcuSocket, int serverProxyPort, ClientApplicationActivityListener clientApplicationActivityListener) throws IOException {
CompatibleFunction<Socket, Runnable> clientSocketRunnableFactory = clientSocket -> () -> {
TcpIoStream clientStream = null;