From 0afb4f56a114fc7c2614d6367cc4920e74c4a730 Mon Sep 17 00:00:00 2001 From: Matthias Kruse Date: Thu, 25 Feb 2021 09:17:16 +0100 Subject: [PATCH 1/4] fixes #18 --- .../iec61850bean/ClientAssociation.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/beanit/iec61850bean/ClientAssociation.java b/src/main/java/com/beanit/iec61850bean/ClientAssociation.java index ce82a87..070fe36 100644 --- a/src/main/java/com/beanit/iec61850bean/ClientAssociation.java +++ b/src/main/java/com/beanit/iec61850bean/ClientAssociation.java @@ -2099,15 +2099,17 @@ public final class ClientAssociation { closed = true; acseAssociation.close(); lastIOException = e; - Thread t1 = - new Thread( - new Runnable() { - @Override - public void run() { - reportListener.associationClosed(lastIOException); - } - }); - t1.start(); + if (reportListener != null) { + Thread t1 = + new Thread( + new Runnable() { + @Override + public void run() { + reportListener.associationClosed(lastIOException); + } + }); + t1.start(); + } MMSpdu mmsPdu = new MMSpdu(); mmsPdu.setConfirmedRequestPDU(new ConfirmedRequestPDU()); From ef06aea37416d5cac6c98ece7b859d9ac94ab23f Mon Sep 17 00:00:00 2001 From: Matthias Kruse Date: Thu, 25 Feb 2021 10:22:34 +0100 Subject: [PATCH 2/4] fixed #10 --- .../iec61850bean/ClientAssociation.java | 13 +++++- .../com/beanit/iec61850bean/ClientSap.java | 40 +++++++++++++++---- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/beanit/iec61850bean/ClientAssociation.java b/src/main/java/com/beanit/iec61850bean/ClientAssociation.java index 070fe36..29e02ee 100644 --- a/src/main/java/com/beanit/iec61850bean/ClientAssociation.java +++ b/src/main/java/com/beanit/iec61850bean/ClientAssociation.java @@ -99,12 +99,12 @@ import java.util.concurrent.TimeoutException; public final class ClientAssociation { private static final Integer16 version = new Integer16(new byte[] {(byte) 0x01, (byte) 0x01}); - private static final ParameterSupportOptions proposedParameterCbbBitString = - new ParameterSupportOptions(new byte[] {0x03, 0x05, (byte) 0xf1, 0x00}); private final ClientReceiver clientReceiver; private final BlockingQueue incomingResponses = new LinkedBlockingQueue<>(); private final ReverseByteArrayOutputStream reverseOStream = new ReverseByteArrayOutputStream(500, true); + private static ParameterSupportOptions proposedParameterCbbBitString = + new ParameterSupportOptions(new byte[] {0x03, 0x05, (byte) 0xf1, 0x00}); ServerModel serverModel; private AcseAssociation acseAssociation = null; private int responseTimeout; @@ -582,6 +582,15 @@ public final class ClientAssociation { public void setServerModel(ServerModel model) { this.serverModel = model; } + + /** + * Set the ProposedParameterCbbBitString parameter, default is byte[] {0x03, 0x05, (byte) 0xf1, 0x00}. + * + * @param proposedParameterCbbBitString the new Proposed Parameter Cbb-Bit-String + */ + public static void setProposedParameterCbbBitString(ParameterSupportOptions proposedParameterCbbBitString) { + ClientAssociation.proposedParameterCbbBitString = proposedParameterCbbBitString; + } /** * Triggers all GetDirectory and GetDefinition ACSI services needed to get the complete server diff --git a/src/main/java/com/beanit/iec61850bean/ClientSap.java b/src/main/java/com/beanit/iec61850bean/ClientSap.java index 0ca8c45..a30ab68 100644 --- a/src/main/java/com/beanit/iec61850bean/ClientSap.java +++ b/src/main/java/com/beanit/iec61850bean/ClientSap.java @@ -13,11 +13,13 @@ */ package com.beanit.iec61850bean; -import com.beanit.josistack.ClientAcseSap; import java.io.IOException; import java.net.InetAddress; + import javax.net.SocketFactory; +import com.beanit.josistack.ClientAcseSap; + /** * The ClientSap class represents the IEC 61850 service access point for client * applications. A client application that wants to connect to a server should first create an @@ -33,11 +35,11 @@ public final class ClientSap { private static final byte[] DEFAULT_TSEL_LOCAL = new byte[] {0, 0}; private static final byte[] DEFAULT_TSEL_REMOTE = new byte[] {0, 1}; - private static final int DEFAUTL_TPDU_SIZE_PARAMETER = 10; // size = 1024 - private final int proposedMaxServOutstandingCalling = 5; - private final int proposedMaxServOutstandingCalled = 5; - private final int proposedDataStructureNestingLevel = 10; + private static final int DEFAULT_TPDU_SIZE_PARAMETER = 10; // size = 1024 private final ClientAcseSap acseSap; + private int proposedMaxServOutstandingCalling = 5; + private int proposedMaxServOutstandingCalled = 5; + private int proposedDataStructureNestingLevel = 10; private int proposedMaxMmsPduSize = 65000; private byte[] servicesSupportedCalling = new byte[] {(byte) 0xee, 0x1c, 0, 0, 0x04, 0x08, 0, 0, 0x79, (byte) 0xef, 0x18}; @@ -49,7 +51,7 @@ public final class ClientSap { acseSap = new ClientAcseSap(); acseSap.tSap.tSelLocal = DEFAULT_TSEL_LOCAL; acseSap.tSap.tSelRemote = DEFAULT_TSEL_REMOTE; - acseSap.tSap.setMaxTPDUSizeParam(DEFAUTL_TPDU_SIZE_PARAMETER); + acseSap.tSap.setMaxTPDUSizeParam(DEFAULT_TPDU_SIZE_PARAMETER); } /** @@ -62,7 +64,7 @@ public final class ClientSap { acseSap = new ClientAcseSap(socketFactory); acseSap.tSap.tSelLocal = DEFAULT_TSEL_LOCAL; acseSap.tSap.tSelRemote = DEFAULT_TSEL_REMOTE; - acseSap.tSap.setMaxTPDUSizeParam(DEFAUTL_TPDU_SIZE_PARAMETER); + acseSap.tSap.setMaxTPDUSizeParam(DEFAULT_TPDU_SIZE_PARAMETER); } /** @@ -90,7 +92,31 @@ public final class ClientSap { throw new IllegalArgumentException("maximum size is out of bound"); } } + + public int getProposedMaxServOutstandingCalling() { + return proposedMaxServOutstandingCalling; + } + + public void setProposedMaxServOutstandingCalling(int proposedMaxServOutstandingCalling) { + this.proposedMaxServOutstandingCalling = proposedMaxServOutstandingCalling; + } + public int getProposedMaxServOutstandingCalled() { + return proposedMaxServOutstandingCalled; + } + + public void setProposedMaxServOutstandingCalled(int proposedMaxServOutstandingCalled) { + this.proposedMaxServOutstandingCalled = proposedMaxServOutstandingCalled; + } + + public int getProposedDataStructureNestingLevel() { + return proposedDataStructureNestingLevel; + } + + public void setProposedDataStructureNestingLevel(int proposedDataStructureNestingLevel) { + this.proposedDataStructureNestingLevel = proposedDataStructureNestingLevel; + } + /** * Gets the ServicesSupportedCalling parameter. * From e0770f03e699f9782386a5230730b80885907cc4 Mon Sep 17 00:00:00 2001 From: Matthias Kruse Date: Thu, 25 Feb 2021 10:24:53 +0100 Subject: [PATCH 3/4] reverted change of other commit --- .../iec61850bean/ClientAssociation.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/beanit/iec61850bean/ClientAssociation.java b/src/main/java/com/beanit/iec61850bean/ClientAssociation.java index 29e02ee..a8436ab 100644 --- a/src/main/java/com/beanit/iec61850bean/ClientAssociation.java +++ b/src/main/java/com/beanit/iec61850bean/ClientAssociation.java @@ -2108,17 +2108,15 @@ public final class ClientAssociation { closed = true; acseAssociation.close(); lastIOException = e; - if (reportListener != null) { - Thread t1 = - new Thread( - new Runnable() { - @Override - public void run() { - reportListener.associationClosed(lastIOException); - } - }); - t1.start(); - } + Thread t1 = + new Thread( + new Runnable() { + @Override + public void run() { + reportListener.associationClosed(lastIOException); + } + }); + t1.start(); MMSpdu mmsPdu = new MMSpdu(); mmsPdu.setConfirmedRequestPDU(new ConfirmedRequestPDU()); From 77c7b009b407e055792c76e800fd40e15f322454 Mon Sep 17 00:00:00 2001 From: Stefan Feuerhahn Date: Fri, 26 Feb 2021 11:03:12 +0100 Subject: [PATCH 4/4] removed unnecessary setters, removed exposing proposedParameterCbbBitString --- .../iec61850bean/ClientAssociation.java | 13 ++-------- .../com/beanit/iec61850bean/ClientSap.java | 26 +++++-------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/beanit/iec61850bean/ClientAssociation.java b/src/main/java/com/beanit/iec61850bean/ClientAssociation.java index a8436ab..ce82a87 100644 --- a/src/main/java/com/beanit/iec61850bean/ClientAssociation.java +++ b/src/main/java/com/beanit/iec61850bean/ClientAssociation.java @@ -99,12 +99,12 @@ import java.util.concurrent.TimeoutException; public final class ClientAssociation { private static final Integer16 version = new Integer16(new byte[] {(byte) 0x01, (byte) 0x01}); + private static final ParameterSupportOptions proposedParameterCbbBitString = + new ParameterSupportOptions(new byte[] {0x03, 0x05, (byte) 0xf1, 0x00}); private final ClientReceiver clientReceiver; private final BlockingQueue incomingResponses = new LinkedBlockingQueue<>(); private final ReverseByteArrayOutputStream reverseOStream = new ReverseByteArrayOutputStream(500, true); - private static ParameterSupportOptions proposedParameterCbbBitString = - new ParameterSupportOptions(new byte[] {0x03, 0x05, (byte) 0xf1, 0x00}); ServerModel serverModel; private AcseAssociation acseAssociation = null; private int responseTimeout; @@ -582,15 +582,6 @@ public final class ClientAssociation { public void setServerModel(ServerModel model) { this.serverModel = model; } - - /** - * Set the ProposedParameterCbbBitString parameter, default is byte[] {0x03, 0x05, (byte) 0xf1, 0x00}. - * - * @param proposedParameterCbbBitString the new Proposed Parameter Cbb-Bit-String - */ - public static void setProposedParameterCbbBitString(ParameterSupportOptions proposedParameterCbbBitString) { - ClientAssociation.proposedParameterCbbBitString = proposedParameterCbbBitString; - } /** * Triggers all GetDirectory and GetDefinition ACSI services needed to get the complete server diff --git a/src/main/java/com/beanit/iec61850bean/ClientSap.java b/src/main/java/com/beanit/iec61850bean/ClientSap.java index a30ab68..c67f771 100644 --- a/src/main/java/com/beanit/iec61850bean/ClientSap.java +++ b/src/main/java/com/beanit/iec61850bean/ClientSap.java @@ -13,13 +13,11 @@ */ package com.beanit.iec61850bean; +import com.beanit.josistack.ClientAcseSap; import java.io.IOException; import java.net.InetAddress; - import javax.net.SocketFactory; -import com.beanit.josistack.ClientAcseSap; - /** * The ClientSap class represents the IEC 61850 service access point for client * applications. A client application that wants to connect to a server should first create an @@ -92,31 +90,19 @@ public final class ClientSap { throw new IllegalArgumentException("maximum size is out of bound"); } } - - public int getProposedMaxServOutstandingCalling() { - return proposedMaxServOutstandingCalling; - } - + public void setProposedMaxServOutstandingCalling(int proposedMaxServOutstandingCalling) { - this.proposedMaxServOutstandingCalling = proposedMaxServOutstandingCalling; + this.proposedMaxServOutstandingCalling = proposedMaxServOutstandingCalling; } - public int getProposedMaxServOutstandingCalled() { - return proposedMaxServOutstandingCalled; - } - public void setProposedMaxServOutstandingCalled(int proposedMaxServOutstandingCalled) { - this.proposedMaxServOutstandingCalled = proposedMaxServOutstandingCalled; + this.proposedMaxServOutstandingCalled = proposedMaxServOutstandingCalled; } - public int getProposedDataStructureNestingLevel() { - return proposedDataStructureNestingLevel; - } - public void setProposedDataStructureNestingLevel(int proposedDataStructureNestingLevel) { - this.proposedDataStructureNestingLevel = proposedDataStructureNestingLevel; + this.proposedDataStructureNestingLevel = proposedDataStructureNestingLevel; } - + /** * Gets the ServicesSupportedCalling parameter. *