hiding things from Android
This commit is contained in:
parent
1b26cd17bb
commit
592c226655
|
@ -153,7 +153,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
|||
communicationLoggingListener = new CommunicationLoggingListener() {
|
||||
@Override
|
||||
public void onPortHolderMessage(Class clazz, String message) {
|
||||
MessagesCentral.getInstance().postMessage(clazz, message);
|
||||
linkManager.messageListener.postMessage(clazz, message);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public class CommandQueue {
|
|||
}
|
||||
|
||||
if (counter != 1)
|
||||
MessagesCentral.getInstance().postMessage(CommandQueue.class, "Took " + counter + " attempts");
|
||||
linkManager.messageListener.postMessage(CommandQueue.class, "Took " + counter + " attempts");
|
||||
}
|
||||
|
||||
public CommandQueue(LinkManager linkManager) {
|
||||
|
@ -109,7 +109,7 @@ public class CommandQueue {
|
|||
@SuppressWarnings("InfiniteLoopStatement")
|
||||
@Override
|
||||
public void run() {
|
||||
MessagesCentral.getInstance().postMessage(COMMAND_QUEUE_CLASS, "SerialIO started");
|
||||
linkManager.messageListener.postMessage(COMMAND_QUEUE_CLASS, "SerialIO started");
|
||||
while (true) {
|
||||
try {
|
||||
sendPendingCommand();
|
||||
|
@ -134,13 +134,12 @@ public class CommandQueue {
|
|||
* TODO: add example, todo: refactor method and add unit test
|
||||
*/
|
||||
public void handleConfirmationMessage(final String message) {
|
||||
MessagesCentral mc = MessagesCentral.getInstance();
|
||||
String confirmation = LinkManager.unpackConfirmation(message);
|
||||
if (confirmation == null)
|
||||
mc.postMessage(CommandQueue.class, "Broken confirmation length: " + message);
|
||||
linkManager.messageListener.postMessage(CommandQueue.class, "Broken confirmation length: " + message);
|
||||
pendingConfirmations.add(confirmation);
|
||||
if (LinkManager.LOG_LEVEL.isDebugEnabled())
|
||||
mc.postMessage(CommandQueue.class, "got valid conf! " + confirmation + ", still pending: " + pendingCommands.size());
|
||||
linkManager.messageListener.postMessage(CommandQueue.class, "got valid conf! " + confirmation + ", still pending: " + pendingCommands.size());
|
||||
|
||||
// FileLog.MAIN.logLine("templog got valid conf " + confirmation + " " + System.currentTimeMillis() + " " + new Date());
|
||||
|
||||
|
|
|
@ -48,6 +48,12 @@ public class LinkManager implements Closeable {
|
|||
private boolean isStarted;
|
||||
private boolean compositeLogicEnabled = true;
|
||||
private boolean needPullData = true;
|
||||
public MessagesListener messageListener = new MessagesListener() {
|
||||
@Override
|
||||
public void postMessage(Class<?> source, String message) {
|
||||
System.out.println(source + ": " + message);
|
||||
}
|
||||
};
|
||||
|
||||
public LinkManager() {
|
||||
engineState = new EngineState(new EngineState.EngineStateListenerImpl() {
|
||||
|
@ -206,7 +212,7 @@ public class LinkManager implements Closeable {
|
|||
Callable<IoStream> streamFactory = new Callable<IoStream>() {
|
||||
@Override
|
||||
public IoStream call() {
|
||||
MessagesCentral.getInstance().postMessage(getClass(), "Opening port: " + port);
|
||||
messageListener.postMessage(getClass(), "Opening port: " + port);
|
||||
Socket socket;
|
||||
try {
|
||||
int portPart = TcpConnector.getTcpPort(port);
|
||||
|
@ -228,7 +234,7 @@ public class LinkManager implements Closeable {
|
|||
Callable<IoStream> ioStreamCallable = new Callable<IoStream>() {
|
||||
@Override
|
||||
public IoStream call() {
|
||||
MessagesCentral.getInstance().postMessage(getClass(), "Opening port: " + port);
|
||||
messageListener.postMessage(getClass(), "Opening port: " + port);
|
||||
IoStream stream = ((Callable<IoStream>) () -> SerialIoStreamJSerialComm.openPort(port)).call();
|
||||
if (stream == null) {
|
||||
// error already reported
|
||||
|
@ -296,4 +302,8 @@ public class LinkManager implements Closeable {
|
|||
System.out.println("All ports: " + Arrays.toString(ports));
|
||||
return port;
|
||||
}
|
||||
|
||||
public interface MessagesListener {
|
||||
void postMessage(Class<?> source, String message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class StreamConnector implements LinkConnector {
|
|||
@Override
|
||||
public void restart() {
|
||||
linkManager.execute(() -> {
|
||||
MessagesCentral.getInstance().postMessage(StreamConnector.this.getClass(), "Restarting serial IO");
|
||||
linkManager.messageListener.postMessage(StreamConnector.this.getClass(), "Restarting serial IO");
|
||||
portHolder.close();
|
||||
portHolder.connectAndReadConfiguration();
|
||||
});
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.rusefi.ts_plugin;
|
|||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.efiAnalytics.plugin.ecu.ControllerAccess;
|
||||
import com.rusefi.auth.AutoTokenUtil;
|
||||
import com.rusefi.shared.FileUtil;
|
||||
import com.rusefi.tools.online.Online;
|
||||
import com.rusefi.tools.online.UploadResult;
|
||||
|
|
Loading…
Reference in New Issue