refactoring

This commit is contained in:
rusefi 2017-03-01 17:51:35 -05:00
parent f67dbce2cc
commit 122cb21e98
3 changed files with 4 additions and 17 deletions

View File

@ -27,11 +27,6 @@ public interface LinkConnector extends LinkDecoder {
public String unpack(String packet) {
return LinkDecoder.TEXT_PROTOCOL_DECODER.unpack(packet);
}
@Override
public String unpackConfirmation(String message) {
return message;
}
};
void connect(ConnectionStateListener listener);
@ -41,6 +36,4 @@ public interface LinkConnector extends LinkDecoder {
void restart();
boolean hasError();
String unpackConfirmation(String message);
}

View File

@ -122,7 +122,8 @@ public class LinkManager {
}
public static String unpackConfirmation(String message) {
return connector.unpackConfirmation(message);
if (message.startsWith(CommandQueue.CONFIRMATION_PREFIX))
return message.substring(CommandQueue.CONFIRMATION_PREFIX.length());
return null;
}
}

View File

@ -147,14 +147,7 @@ public class TcpConnector implements LinkConnector {
// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
// }
}
@Override
public String unpackConfirmation(String message) {
if (message.startsWith(CommandQueue.CONFIRMATION_PREFIX))
return message.substring(CommandQueue.CONFIRMATION_PREFIX.length());
return null;
}
public static Collection<String> getAvailablePorts() {
return isTcpPortOpened() ? Collections.singletonList("" + DEFAULT_PORT) : Collections.<String>emptyList();
}