refactoring
This commit is contained in:
parent
3f3ee0ef19
commit
abd5b755e9
|
@ -0,0 +1,11 @@
|
||||||
|
package com.rusefi.io;
|
||||||
|
|
||||||
|
public class AbstractConnectionStateListener implements ConnectionStateListener {
|
||||||
|
@Override
|
||||||
|
public void onConnectionEstablished() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionFailed() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,15 +5,7 @@ package com.rusefi.io;
|
||||||
* 3/1/2017
|
* 3/1/2017
|
||||||
*/
|
*/
|
||||||
public interface ConnectionStateListener {
|
public interface ConnectionStateListener {
|
||||||
ConnectionStateListener VOID = new ConnectionStateListener() {
|
ConnectionStateListener VOID = new AbstractConnectionStateListener();
|
||||||
@Override
|
|
||||||
public void onConnectionEstablished() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnectionFailed() {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is invoked once we have connection & configuration from controller
|
* This method is invoked once we have connection & configuration from controller
|
||||||
|
|
|
@ -48,11 +48,7 @@ public class MainFrame {
|
||||||
this.consoleUI = consoleUI;
|
this.consoleUI = consoleUI;
|
||||||
|
|
||||||
this.tabbedPane = tabbedPane;
|
this.tabbedPane = tabbedPane;
|
||||||
listener = new ConnectionStateListener() {
|
listener = new AbstractConnectionStateListener() {
|
||||||
@Override
|
|
||||||
public void onConnectionFailed() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionEstablished() {
|
public void onConnectionEstablished() {
|
||||||
FileLog.MAIN.logLine("onConnectionEstablished");
|
FileLog.MAIN.logLine("onConnectionEstablished");
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.devexperts.logging.Logging;
|
||||||
import com.opensr5.ConfigurationImage;
|
import com.opensr5.ConfigurationImage;
|
||||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||||
import com.rusefi.config.generated.Fields;
|
import com.rusefi.config.generated.Fields;
|
||||||
import com.rusefi.io.ConnectionStateListener;
|
import com.rusefi.io.AbstractConnectionStateListener;
|
||||||
import com.rusefi.io.IoStream;
|
import com.rusefi.io.IoStream;
|
||||||
import com.rusefi.io.LinkManager;
|
import com.rusefi.io.LinkManager;
|
||||||
import com.rusefi.io.commands.HelloCommand;
|
import com.rusefi.io.commands.HelloCommand;
|
||||||
|
@ -32,16 +32,11 @@ public class NetworkConnector {
|
||||||
.setNeedPullData(false);
|
.setNeedPullData(false);
|
||||||
|
|
||||||
CountDownLatch onConnected = new CountDownLatch(1);
|
CountDownLatch onConnected = new CountDownLatch(1);
|
||||||
controllerConnector.startAndConnect(controllerPort, new ConnectionStateListener() {
|
controllerConnector.startAndConnect(controllerPort, new AbstractConnectionStateListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionEstablished() {
|
public void onConnectionEstablished() {
|
||||||
onConnected.countDown();
|
onConnected.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnectionFailed() {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info("Connecting to controller...");
|
log.info("Connecting to controller...");
|
||||||
|
|
Loading…
Reference in New Issue