|
|
|
@ -14,6 +14,7 @@ import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.net.InetAddress;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
@ -29,6 +30,7 @@ public class IecClient implements ClientEventListener {
|
|
|
|
|
private RealTimeDataService realTimeDataService;
|
|
|
|
|
private WebSocketServer webSocketServer;
|
|
|
|
|
public int retry = 10;
|
|
|
|
|
public Date lastReportTime;
|
|
|
|
|
|
|
|
|
|
public IecClient() {
|
|
|
|
|
}
|
|
|
|
@ -84,6 +86,7 @@ public class IecClient implements ClientEventListener {
|
|
|
|
|
clientAssociation.setServerModel(serverModel);
|
|
|
|
|
log.info("61850订阅断线重连成功, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
|
|
|
|
|
retry = 10;
|
|
|
|
|
keep = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getValue(String paramindex, String fc) throws Exception {
|
|
|
|
@ -108,6 +111,7 @@ public class IecClient implements ClientEventListener {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.info("61850订阅成功, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
|
|
|
|
|
keep = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void disableReporting() {
|
|
|
|
@ -132,6 +136,7 @@ public class IecClient implements ClientEventListener {
|
|
|
|
|
} else {
|
|
|
|
|
log.info("61850停止订阅, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
|
|
|
|
|
}
|
|
|
|
|
keep = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<FileInformation> listFile(String path) throws Exception {
|
|
|
|
@ -150,6 +155,7 @@ public class IecClient implements ClientEventListener {
|
|
|
|
|
@Override
|
|
|
|
|
public void newReport(Report report) {
|
|
|
|
|
if (report != null) {
|
|
|
|
|
lastReportTime = new Date();
|
|
|
|
|
RealTimeDataService.processReport(report);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -157,6 +163,7 @@ public class IecClient implements ClientEventListener {
|
|
|
|
|
@Override
|
|
|
|
|
public void associationClosed(IOException e) {
|
|
|
|
|
if (keep) {
|
|
|
|
|
keep = false;
|
|
|
|
|
this.disableReporting();
|
|
|
|
|
this.disconnect();
|
|
|
|
|
while (retry > 0) {
|
|
|
|
|