helping Android
This commit is contained in:
parent
158e5d1876
commit
75fc3a270d
|
@ -34,7 +34,12 @@ public class AndroidSerial implements IoStream {
|
|||
|
||||
public AndroidSerial(UsbSerialPort usbSerialPort, Logger logger) {
|
||||
this.usbSerialPort = usbSerialPort;
|
||||
dataBuffer = IncomingDataBuffer.createDataBuffer(this, logger);
|
||||
dataBuffer = IncomingDataBuffer.createDataBuffer("", this, logger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLoggingPrefix() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +50,7 @@ public class AndroidSerial implements IoStream {
|
|||
@Override
|
||||
public void setInputListener(DataListener listener) {
|
||||
ByteReader reader = buffer -> usbSerialPort.read(buffer, 5000);
|
||||
ByteReader.runReaderLoop(listener, reader, Logger.CONSOLE);
|
||||
ByteReader.runReaderLoop("", listener, reader, Logger.CONSOLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.concurrent.Executor;
|
|||
import java.util.concurrent.Executors;
|
||||
|
||||
public interface ByteReader {
|
||||
static void runReaderLoop(DataListener listener, ByteReader reader, Logger logger) {
|
||||
static void runReaderLoop(String loggingPrefix, DataListener listener, ByteReader reader, Logger logger) {
|
||||
/**
|
||||
* Threading of the whole input/output does not look healthy at all!
|
||||
*
|
||||
|
@ -24,7 +24,7 @@ public interface ByteReader {
|
|||
|
||||
threadExecutor.execute(() -> {
|
||||
Thread.currentThread().setName("TCP connector loop");
|
||||
logger.info("Running TCP connection loop");
|
||||
logger.info(loggingPrefix + "Running TCP connection loop");
|
||||
|
||||
byte inputBuffer[] = new byte[256];
|
||||
while (true) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public class TcpIoStream implements IoStream {
|
|||
@Override
|
||||
public void setInputListener(final DataListener listener) {
|
||||
|
||||
ByteReader.runReaderLoop(listener, input::read, logger);
|
||||
ByteReader.runReaderLoop(loggingPrefix, listener, input::read, logger);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue