refactoring

This commit is contained in:
rusefi 2017-03-01 17:51:35 -05:00
parent 1babfebdcd
commit a636bff294
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) { public String unpack(String packet) {
return LinkDecoder.TEXT_PROTOCOL_DECODER.unpack(packet); return LinkDecoder.TEXT_PROTOCOL_DECODER.unpack(packet);
} }
@Override
public String unpackConfirmation(String message) {
return message;
}
}; };
void connect(ConnectionStateListener listener); void connect(ConnectionStateListener listener);
@ -41,6 +36,4 @@ public interface LinkConnector extends LinkDecoder {
void restart(); void restart();
boolean hasError(); boolean hasError();
String unpackConfirmation(String message);
} }

View File

@ -122,7 +122,8 @@ public class LinkManager {
} }
public static String unpackConfirmation(String message) { 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

@ -148,13 +148,6 @@ public class TcpConnector implements LinkConnector {
// } // }
} }
@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() { public static Collection<String> getAvailablePorts() {
return isTcpPortOpened() ? Collections.singletonList("" + DEFAULT_PORT) : Collections.<String>emptyList(); return isTcpPortOpened() ? Collections.singletonList("" + DEFAULT_PORT) : Collections.<String>emptyList();
} }