|
|
|
@ -12,7 +12,6 @@ import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.net.InetAddress;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class IecClient implements ClientEventListener {
|
|
|
|
@ -20,7 +19,6 @@ public class IecClient implements ClientEventListener {
|
|
|
|
|
ClientSap clientSap = new ClientSap();
|
|
|
|
|
ClientAssociation clientAssociation = null;
|
|
|
|
|
ServerModel serverModel;
|
|
|
|
|
Urcb urcb = null;
|
|
|
|
|
|
|
|
|
|
public void connect(String host, int port, String apTitle, String xml) throws Exception {
|
|
|
|
|
InputStream in = IOUtils.toInputStream(xml, StandardCharsets.UTF_8);
|
|
|
|
@ -66,16 +64,18 @@ public class IecClient implements ClientEventListener {
|
|
|
|
|
|
|
|
|
|
public void enableReporting() throws Exception {
|
|
|
|
|
if (!CollectionUtils.isEmpty(serverModel.getUrcbs())) {
|
|
|
|
|
Optional<Urcb> optional = serverModel.getUrcbs().stream().findAny();
|
|
|
|
|
urcb = optional.get();
|
|
|
|
|
clientAssociation.enableReporting(urcb);
|
|
|
|
|
for (Urcb urcb : serverModel.getUrcbs()) {
|
|
|
|
|
clientAssociation.enableReporting(urcb);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void disableReporting() {
|
|
|
|
|
if (urcb != null) {
|
|
|
|
|
if (!CollectionUtils.isEmpty(serverModel.getUrcbs())) {
|
|
|
|
|
try {
|
|
|
|
|
clientAssociation.disableReporting(urcb);
|
|
|
|
|
for (Urcb urcb : serverModel.getUrcbs()) {
|
|
|
|
|
clientAssociation.disableReporting(urcb);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ignore) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|