├── src ├── test │ └── java │ │ ├── .gitignore │ │ └── org │ │ └── openmuc │ │ └── openiec61850 │ │ └── integrationtests │ │ └── SclTests.java ├── docs │ └── asciidoc │ │ ├── images │ │ └── banner.png │ │ ├── common-settings.txt │ │ └── pdf-theme.yml └── main │ ├── java │ └── org │ │ └── openmuc │ │ ├── openiec61850 │ │ ├── internal │ │ │ ├── cli │ │ │ │ ├── ActionListener.java │ │ │ │ ├── Action.java │ │ │ │ ├── ActionException.java │ │ │ │ ├── CliParseException.java │ │ │ │ ├── FatalActionException.java │ │ │ │ ├── FlagCliParameter.java │ │ │ │ ├── ValueCliParameter.java │ │ │ │ ├── CliParameter.java │ │ │ │ ├── StringCliParameter.java │ │ │ │ ├── LongCliParameter.java │ │ │ │ ├── IntCliParameter.java │ │ │ │ ├── CliParameterBuilder.java │ │ │ │ └── StringListCliParameter.java │ │ │ └── scl │ │ │ │ ├── Value.java │ │ │ │ ├── Bda.java │ │ │ │ ├── LnSubDef.java │ │ │ │ ├── AbstractType.java │ │ │ │ ├── DaType.java │ │ │ │ ├── Do.java │ │ │ │ ├── Sdo.java │ │ │ │ ├── LnType.java │ │ │ │ ├── AbstractElement.java │ │ │ │ ├── EnumVal.java │ │ │ │ ├── DoType.java │ │ │ │ ├── EnumType.java │ │ │ │ ├── Da.java │ │ │ │ ├── TypeDefinitions.java │ │ │ │ └── AbstractDataAttribute.java │ │ ├── GetFileListener.java │ │ ├── SclParseException.java │ │ ├── FileInformation.java │ │ ├── clientgui │ │ │ ├── util │ │ │ │ └── Counter.java │ │ │ ├── DataTreeNode.java │ │ │ ├── databind │ │ │ │ ├── BooleanDataBind.java │ │ │ │ ├── Int8DataBind.java │ │ │ │ ├── Int64DataBind.java │ │ │ │ ├── Int16DataBind.java │ │ │ │ ├── Int32DataBind.java │ │ │ │ ├── TapCommandDataBind.java │ │ │ │ ├── DoubleBitPosDataBind.java │ │ │ │ ├── Int8UDataBind.java │ │ │ │ ├── Float32DataBind.java │ │ │ │ ├── Int16UDataBind.java │ │ │ │ ├── Int32UDataBind.java │ │ │ │ ├── Float64DataBind.java │ │ │ │ ├── EntryTimeDataBind.java │ │ │ │ ├── OctetStringDataBind.java │ │ │ │ ├── CheckDataBind.java │ │ │ │ ├── UnicodeStringDataBind.java │ │ │ │ ├── VisibleStringDataBind.java │ │ │ │ ├── TriggerConditionDataBind.java │ │ │ │ ├── TimeStampDataBind.java │ │ │ │ └── ReasonForInclusionDataBind.java │ │ │ ├── DataObjectTreeCellRenderer.java │ │ │ ├── BasicDataBind.java │ │ │ └── DataSetTreeNode.java │ │ ├── ServiceSupport.java │ │ ├── BdaType.java │ │ ├── AcseListener.java │ │ ├── LogicalDevice.java │ │ ├── ServerEventListener.java │ │ ├── ClientEventListener.java │ │ ├── Fc.java │ │ ├── Brcb.java │ │ ├── BdaCheck.java │ │ ├── ReportEntryData.java │ │ ├── BdaInt16.java │ │ ├── BdaInt64.java │ │ ├── BdaInt16U.java │ │ ├── BdaInt8U.java │ │ ├── BdaBoolean.java │ │ ├── BdaInt32.java │ │ ├── BdaInt8.java │ │ ├── BdaInt128.java │ │ ├── BdaInt32U.java │ │ ├── BdaTapCommand.java │ │ └── BdaDoubleBitPos.java │ │ ├── josistack │ │ ├── AcseAssociationListener.java │ │ ├── DecodingException.java │ │ └── ByteBufferInputStream.java │ │ └── jositransport │ │ └── TConnectionListener.java │ └── java-gen │ └── org │ └── openmuc │ ├── openiec61850 │ └── internal │ │ └── mms │ │ └── asn1 │ │ ├── FileDeleteRequest.java │ │ ├── InitiateErrorPDU.java │ │ ├── UtcTime.java │ │ ├── TimeOfDay.java │ │ ├── MMSString.java │ │ ├── FloatingPoint.java │ │ ├── Identifier.java │ │ ├── FileCloseResponse.java │ │ ├── ConcludeRequestPDU.java │ │ ├── FileDeleteResponse.java │ │ ├── BasicIdentifier.java │ │ ├── GetNamedVariableListAttributesRequest.java │ │ ├── DefineNamedVariableListResponse.java │ │ ├── FileReadRequest.java │ │ ├── Integer8.java │ │ ├── FileCloseRequest.java │ │ ├── Integer16.java │ │ ├── Integer32.java │ │ ├── Unsigned8.java │ │ ├── Unsigned16.java │ │ ├── Unsigned32.java │ │ ├── DataAccessError.java │ │ ├── ServiceSupportOptions.java │ │ └── ParameterSupportOptions.java │ └── josistack │ └── internal │ ├── acse │ └── asn1 │ │ ├── OidValues.java │ │ ├── ImplementationData.java │ │ ├── AETitleForm2.java │ │ ├── APTitleForm2.java │ │ ├── MechanismName.java │ │ ├── ApplicationContextName.java │ │ ├── ACSERequirements.java │ │ ├── AssociateResult.java │ │ ├── AEQualifierForm2.java │ │ ├── ReleaseRequestReason.java │ │ ├── ReleaseResponseReason.java │ │ ├── AEInvocationIdentifier.java │ │ ├── APInvocationIdentifier.java │ │ ├── AETitle.java │ │ └── APTitle.java │ └── presentation │ └── asn1 │ ├── CalledPresentationSelector.java │ ├── CallingPresentationSelector.java │ ├── PresentationContextDefinitionList.java │ ├── RespondingPresentationSelector.java │ ├── SimplyEncodedData.java │ ├── PresentationSelector.java │ ├── PresentationContextDefinitionResultList.java │ ├── AbstractSyntaxName.java │ ├── TransferSyntaxName.java │ ├── Result.java │ ├── ProtocolVersion.java │ ├── UserSessionRequirements.java │ ├── PresentationRequirements.java │ └── PresentationContextIdentifier.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── asn1 ├── mms │ └── compile.sh ├── iso-acse-layer │ └── compile.sh └── iso-presentation-layer │ └── compile.sh ├── run-scripts ├── gui-client │ ├── openiec61850-gui-client.bat │ └── openiec61850-gui-client ├── console-client │ ├── openiec61850-console-client.bat │ └── openiec61850-console-client └── console-server │ ├── openiec61850-console-server.bat │ ├── logback.xml │ └── openiec61850-console-server ├── .gitignore ├── license └── NOTICE ├── gradlew.bat └── configuration.gradle /src/test/java/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mz-automation/openiec61850/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/docs/asciidoc/images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mz-automation/openiec61850/HEAD/src/docs/asciidoc/images/banner.png -------------------------------------------------------------------------------- /asn1/mms/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -r ../../src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/* 4 | 5 | jasn1-compiler -o "../../src/main/java-gen" -p "org.openmuc.openiec61850.internal.mms" -f mms.asn 6 | -------------------------------------------------------------------------------- /run-scripts/gui-client/openiec61850-gui-client.bat: -------------------------------------------------------------------------------- 1 | ::BATCH file to windows 2 | 3 | set BATDIR=%~dp0 4 | set LIBDIR=%BATDIR%..\..\build\libs-all 5 | 6 | java -Djava.ext.dirs=%LIBDIR% org.openmuc.openiec61850.clientgui.ClientGui %* 7 | -------------------------------------------------------------------------------- /asn1/iso-acse-layer/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm ../../src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/* 4 | 5 | jasn1-compiler -o "../../src/main/java-gen/" -p "org.openmuc.josistack.internal.acse" -f iso-acse-layer.asn 6 | -------------------------------------------------------------------------------- /run-scripts/console-client/openiec61850-console-client.bat: -------------------------------------------------------------------------------- 1 | ::BATCH file for windows 2 | 3 | set BATDIR=%~dp0 4 | set LIBDIR=%BATDIR%..\..\build\libs-all 5 | 6 | java -Djava.ext.dirs=%LIBDIR% org.openmuc.openiec61850.app.ConsoleClient %* 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip 6 | -------------------------------------------------------------------------------- /asn1/iso-presentation-layer/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm ../../src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/*.java 4 | 5 | jasn1-compiler -o ../../src/main/java-gen/ -p org.openmuc.josistack.internal.presentation -f iso-presentation-layer.asn 6 | -------------------------------------------------------------------------------- /run-scripts/console-server/openiec61850-console-server.bat: -------------------------------------------------------------------------------- 1 | ::BATCH file to windows 2 | 3 | set BATDIR=%~dp0 4 | set LIBDIR=%BATDIR%..\..\build\libs-all 5 | 6 | java -Dlogback.configurationFile=logback.xml -Djava.ext.dirs=%LIBDIR% org.openmuc.openiec61850.app.ConsoleServer %* 7 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/ActionListener.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | public interface ActionListener { 4 | 5 | public void actionCalled(String actionKey) throws ActionException, FatalActionException; 6 | 7 | public void quit(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | \#* 2 | .\#* 3 | *~ 4 | target/ 5 | bin/ 6 | build/ 7 | tmp/ 8 | *.class 9 | .gradle/ 10 | .svn/ 11 | .settings/ 12 | .project 13 | .classpath 14 | .metadata/ 15 | .externalToolBuilders/ 16 | gradle.properties 17 | doc/userguide/*.html 18 | doc/userguide/*.pdf 19 | *.hprof 20 | gradle-app.setting 21 | .factorypath 22 | .apt_generated/ 23 | #created by openiec61850 clientgui: 24 | lastconnection.properties 25 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileDeleteRequest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | public class FileDeleteRequest extends FileName { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | public FileDeleteRequest() { 12 | } 13 | 14 | public FileDeleteRequest(byte[] code) { 15 | super(code); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateErrorPDU.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | public class InitiateErrorPDU extends ServiceError { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | public InitiateErrorPDU() { 12 | } 13 | 14 | public InitiateErrorPDU(byte[] code) { 15 | super(code); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/Action.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | public class Action { 4 | 5 | private final String key; 6 | private final String description; 7 | 8 | public Action(String key, String description) { 9 | this.key = key; 10 | this.description = description; 11 | } 12 | 13 | public String getKey() { 14 | return key; 15 | } 16 | 17 | public String getDescription() { 18 | return description; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /run-scripts/console-client/openiec61850-console-client: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JARS_LOCATION="../../build/libs-all" 4 | MAIN_CLASS="org.openmuc.openiec61850.app.ConsoleClient" 5 | SYSPROPS="" 6 | PARAMS="" 7 | 8 | SCRIPT_HOME=`dirname $0` 9 | 10 | CLASSPATH=$(JARS=("$SCRIPT_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}") 11 | 12 | for i in $@; do 13 | if [[ $i == -D* ]]; then 14 | SYSPROPS="$SYSPROPS $i"; 15 | else 16 | PARAMS="$PARAMS $i"; 17 | fi 18 | done 19 | 20 | java $SYSPROPS -cp $CLASSPATH $MAIN_CLASS $PARAMS 21 | -------------------------------------------------------------------------------- /run-scripts/console-server/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UtcTime.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.*; 8 | 9 | public class UtcTime extends BerOctetString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public UtcTime() { 14 | } 15 | 16 | public UtcTime(byte[] value) { 17 | super(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TimeOfDay.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.*; 8 | 9 | public class TimeOfDay extends BerOctetString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public TimeOfDay() { 14 | } 15 | 16 | public TimeOfDay(byte[] value) { 17 | super(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/OidValues.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerObjectIdentifier; 8 | 9 | public final class OidValues { 10 | public static final BerObjectIdentifier aCSEId = new BerObjectIdentifier(new int[] { 2, 2, 3, 1, 1 }); 11 | public static final BerObjectIdentifier acseAsId = new BerObjectIdentifier(new int[] { 2, 2, 1, 0, 1 }); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/MMSString.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.string.*; 8 | 9 | public class MMSString extends BerVisibleString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public MMSString() { 14 | } 15 | 16 | public MMSString(byte[] value) { 17 | super(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FloatingPoint.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.*; 8 | 9 | public class FloatingPoint extends BerOctetString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public FloatingPoint() { 14 | } 15 | 16 | public FloatingPoint(byte[] value) { 17 | super(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Identifier.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.string.*; 8 | 9 | public class Identifier extends BerVisibleString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public Identifier() { 14 | } 15 | 16 | public Identifier(byte[] value) { 17 | super(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileCloseResponse.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.*; 8 | 9 | public class FileCloseResponse extends BerNull { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public FileCloseResponse() { 14 | } 15 | 16 | public FileCloseResponse(byte[] code) { 17 | super(code); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/CalledPresentationSelector.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | public class CalledPresentationSelector extends PresentationSelector { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | public CalledPresentationSelector() { 12 | } 13 | 14 | public CalledPresentationSelector(byte[] value) { 15 | super(value); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConcludeRequestPDU.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.*; 8 | 9 | public class ConcludeRequestPDU extends BerNull { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public ConcludeRequestPDU() { 14 | } 15 | 16 | public ConcludeRequestPDU(byte[] code) { 17 | super(code); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileDeleteResponse.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.*; 8 | 9 | public class FileDeleteResponse extends BerNull { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public FileDeleteResponse() { 14 | } 15 | 16 | public FileDeleteResponse(byte[] code) { 17 | super(code); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/CallingPresentationSelector.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | public class CallingPresentationSelector extends PresentationSelector { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | public CallingPresentationSelector() { 12 | } 13 | 14 | public CallingPresentationSelector(byte[] value) { 15 | super(value); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/BasicIdentifier.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.string.*; 8 | 9 | public class BasicIdentifier extends BerVisibleString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public BasicIdentifier() { 14 | } 15 | 16 | public BasicIdentifier(byte[] value) { 17 | super(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/PresentationContextDefinitionList.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | public class PresentationContextDefinitionList extends ContextList { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | public PresentationContextDefinitionList() { 12 | } 13 | 14 | public PresentationContextDefinitionList(byte[] code) { 15 | super(code); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/RespondingPresentationSelector.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | public class RespondingPresentationSelector extends PresentationSelector { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | public RespondingPresentationSelector() { 12 | } 13 | 14 | public RespondingPresentationSelector(byte[] value) { 15 | super(value); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/ImplementationData.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.string.BerGraphicString; 8 | 9 | public class ImplementationData extends BerGraphicString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public ImplementationData() { 14 | } 15 | 16 | public ImplementationData(byte[] value) { 17 | super(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/SimplyEncodedData.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerOctetString; 8 | 9 | public class SimplyEncodedData extends BerOctetString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public SimplyEncodedData() { 14 | } 15 | 16 | public SimplyEncodedData(byte[] value) { 17 | super(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/PresentationSelector.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerOctetString; 8 | 9 | public class PresentationSelector extends BerOctetString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public PresentationSelector() { 14 | } 15 | 16 | public PresentationSelector(byte[] value) { 17 | super(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNamedVariableListAttributesRequest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | public class GetNamedVariableListAttributesRequest extends ObjectName { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | public GetNamedVariableListAttributesRequest() { 12 | } 13 | 14 | public GetNamedVariableListAttributesRequest(byte[] code) { 15 | super(code); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/PresentationContextDefinitionResultList.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | public class PresentationContextDefinitionResultList extends ResultList { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | public PresentationContextDefinitionResultList() { 12 | } 13 | 14 | public PresentationContextDefinitionResultList(byte[] code) { 15 | super(code); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/ActionException.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | public final class ActionException extends Exception { 4 | 5 | private static final long serialVersionUID = 4806947065917148946L; 6 | 7 | public ActionException() { 8 | super(); 9 | } 10 | 11 | public ActionException(String s) { 12 | super(s); 13 | } 14 | 15 | public ActionException(Throwable cause) { 16 | super(cause); 17 | } 18 | 19 | public ActionException(String s, Throwable cause) { 20 | super(s, cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DefineNamedVariableListResponse.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.*; 8 | 9 | public class DefineNamedVariableListResponse extends BerNull { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public DefineNamedVariableListResponse() { 14 | } 15 | 16 | public DefineNamedVariableListResponse(byte[] code) { 17 | super(code); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/GetFileListener.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850; 2 | 3 | /** 4 | * Callback handler for GetFile service 5 | */ 6 | public interface GetFileListener { 7 | /** 8 | * Is called when a new block of file data is received 9 | * 10 | * @param fileData 11 | * block of file data received 12 | * @param moreFollows 13 | * true if more data blocks will follow, false otherwise 14 | * 15 | * @return true to continue the GetFile service, false to cancel 16 | */ 17 | boolean dataReceived(byte[] fileData, boolean moreFollows); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/CliParseException.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | public final class CliParseException extends Exception { 4 | 5 | private static final long serialVersionUID = -5162894897245715377L; 6 | 7 | public CliParseException() { 8 | super(); 9 | } 10 | 11 | public CliParseException(String s) { 12 | super(s); 13 | } 14 | 15 | public CliParseException(Throwable cause) { 16 | super(cause); 17 | } 18 | 19 | public CliParseException(String s, Throwable cause) { 20 | super(s, cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/FatalActionException.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | public final class FatalActionException extends Exception { 4 | 5 | private static final long serialVersionUID = -8134353678567694515L; 6 | 7 | public FatalActionException() { 8 | super(); 9 | } 10 | 11 | public FatalActionException(String s) { 12 | super(s); 13 | } 14 | 15 | public FatalActionException(Throwable cause) { 16 | super(cause); 17 | } 18 | 19 | public FatalActionException(String s, Throwable cause) { 20 | super(s, cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/AETitleForm2.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerObjectIdentifier; 8 | 9 | public class AETitleForm2 extends BerObjectIdentifier { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public AETitleForm2() { 14 | } 15 | 16 | public AETitleForm2(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public AETitleForm2(int[] value) { 21 | super(value); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/APTitleForm2.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerObjectIdentifier; 8 | 9 | public class APTitleForm2 extends BerObjectIdentifier { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public APTitleForm2() { 14 | } 15 | 16 | public APTitleForm2(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public APTitleForm2(int[] value) { 21 | super(value); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/MechanismName.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerObjectIdentifier; 8 | 9 | public class MechanismName extends BerObjectIdentifier { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public MechanismName() { 14 | } 15 | 16 | public MechanismName(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public MechanismName(int[] value) { 21 | super(value); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/docs/asciidoc/common-settings.txt: -------------------------------------------------------------------------------- 1 | ifndef::imagesdir[:imagesdir: images] 2 | ifdef::backend-pdf[] 3 | Fraunhofer Institute for Solar Energy Systems ISE 4 | openmuc.org 5 | //:doctype: book 6 | // Settings: 7 | :compat-mode: 8 | :experimental: 9 | :icons: font 10 | :listing-caption: Listing 11 | :sectnums: 12 | :toc: 13 | :toclevels: 3 14 | :title-logo-image: image:banner.png[pdfwidth=90%,align=center] 15 | :frame: none 16 | 17 | :width100: 750 18 | :width80: 600 19 | :width60: 450 20 | :width40: 300 21 | :width20: 150 22 | 23 | endif::[] 24 | 25 | ifndef::backend-pdf[] 26 | 27 | :width100: "100%" 28 | :width80: "80%" 29 | :width60: "60%" 30 | :width40: "40%" 31 | :width20: "20%" 32 | 33 | endif::[] 34 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/AbstractSyntaxName.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerObjectIdentifier; 8 | 9 | public class AbstractSyntaxName extends BerObjectIdentifier { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public AbstractSyntaxName() { 14 | } 15 | 16 | public AbstractSyntaxName(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public AbstractSyntaxName(int[] value) { 21 | super(value); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/TransferSyntaxName.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerObjectIdentifier; 8 | 9 | public class TransferSyntaxName extends BerObjectIdentifier { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public TransferSyntaxName() { 14 | } 15 | 16 | public TransferSyntaxName(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public TransferSyntaxName(int[] value) { 21 | super(value); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/openmuc/openiec61850/integrationtests/SclTests.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.integrationtests; 2 | 3 | import org.junit.Test; 4 | import org.openmuc.openiec61850.SclParseException; 5 | import org.openmuc.openiec61850.ServerSap; 6 | 7 | public class SclTests { 8 | 9 | private final static String SCL_FILE_PATH_1 = "src/test/resources/testModel.icd"; 10 | private final static String SCL_FILE_PATH_2 = "src/test/resources/testModel2.icd"; 11 | 12 | @Test 13 | public void testClientServerCom() throws SclParseException { 14 | 15 | ServerSap.getSapsFromSclFile(SCL_FILE_PATH_1); 16 | ServerSap.getSapsFromSclFile(SCL_FILE_PATH_2); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/ApplicationContextName.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerObjectIdentifier; 8 | 9 | public class ApplicationContextName extends BerObjectIdentifier { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public ApplicationContextName() { 14 | } 15 | 16 | public ApplicationContextName(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public ApplicationContextName(int[] value) { 21 | super(value); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /license/NOTICE: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileReadRequest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import java.math.BigInteger; 8 | 9 | public class FileReadRequest extends Integer32 { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public FileReadRequest() { 14 | } 15 | 16 | public FileReadRequest(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public FileReadRequest(BigInteger value) { 21 | super(value); 22 | } 23 | 24 | public FileReadRequest(long value) { 25 | super(value); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer8.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import java.math.BigInteger; 8 | import org.openmuc.jasn1.ber.types.*; 9 | 10 | public class Integer8 extends BerInteger { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public Integer8() { 15 | } 16 | 17 | public Integer8(byte[] code) { 18 | super(code); 19 | } 20 | 21 | public Integer8(BigInteger value) { 22 | super(value); 23 | } 24 | 25 | public Integer8(long value) { 26 | super(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileCloseRequest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import java.math.BigInteger; 8 | 9 | public class FileCloseRequest extends Integer32 { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public FileCloseRequest() { 14 | } 15 | 16 | public FileCloseRequest(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public FileCloseRequest(BigInteger value) { 21 | super(value); 22 | } 23 | 24 | public FileCloseRequest(long value) { 25 | super(value); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/Result.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | import java.math.BigInteger; 8 | 9 | import org.openmuc.jasn1.ber.types.BerInteger; 10 | 11 | public class Result extends BerInteger { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public Result() { 16 | } 17 | 18 | public Result(byte[] code) { 19 | super(code); 20 | } 21 | 22 | public Result(BigInteger value) { 23 | super(value); 24 | } 25 | 26 | public Result(long value) { 27 | super(value); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer16.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import java.math.BigInteger; 8 | import org.openmuc.jasn1.ber.types.*; 9 | 10 | public class Integer16 extends BerInteger { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public Integer16() { 15 | } 16 | 17 | public Integer16(byte[] code) { 18 | super(code); 19 | } 20 | 21 | public Integer16(BigInteger value) { 22 | super(value); 23 | } 24 | 25 | public Integer16(long value) { 26 | super(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer32.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import java.math.BigInteger; 8 | import org.openmuc.jasn1.ber.types.*; 9 | 10 | public class Integer32 extends BerInteger { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public Integer32() { 15 | } 16 | 17 | public Integer32(byte[] code) { 18 | super(code); 19 | } 20 | 21 | public Integer32(BigInteger value) { 22 | super(value); 23 | } 24 | 25 | public Integer32(long value) { 26 | super(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned8.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import java.math.BigInteger; 8 | import org.openmuc.jasn1.ber.types.*; 9 | 10 | public class Unsigned8 extends BerInteger { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public Unsigned8() { 15 | } 16 | 17 | public Unsigned8(byte[] code) { 18 | super(code); 19 | } 20 | 21 | public Unsigned8(BigInteger value) { 22 | super(value); 23 | } 24 | 25 | public Unsigned8(long value) { 26 | super(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned16.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import java.math.BigInteger; 8 | import org.openmuc.jasn1.ber.types.*; 9 | 10 | public class Unsigned16 extends BerInteger { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public Unsigned16() { 15 | } 16 | 17 | public Unsigned16(byte[] code) { 18 | super(code); 19 | } 20 | 21 | public Unsigned16(BigInteger value) { 22 | super(value); 23 | } 24 | 25 | public Unsigned16(long value) { 26 | super(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned32.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import java.math.BigInteger; 8 | import org.openmuc.jasn1.ber.types.*; 9 | 10 | public class Unsigned32 extends BerInteger { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public Unsigned32() { 15 | } 16 | 17 | public Unsigned32(byte[] code) { 18 | super(code); 19 | } 20 | 21 | public Unsigned32(BigInteger value) { 22 | super(value); 23 | } 24 | 25 | public Unsigned32(long value) { 26 | super(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/ACSERequirements.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerBitString; 8 | 9 | public class ACSERequirements extends BerBitString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public ACSERequirements() { 14 | } 15 | 16 | public ACSERequirements(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public ACSERequirements(byte[] value, int numBits) { 21 | super(value, numBits); 22 | } 23 | 24 | public ACSERequirements(boolean[] value) { 25 | super(value); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/AssociateResult.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import java.math.BigInteger; 8 | 9 | import org.openmuc.jasn1.ber.types.BerInteger; 10 | 11 | public class AssociateResult extends BerInteger { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public AssociateResult() { 16 | } 17 | 18 | public AssociateResult(byte[] code) { 19 | super(code); 20 | } 21 | 22 | public AssociateResult(BigInteger value) { 23 | super(value); 24 | } 25 | 26 | public AssociateResult(long value) { 27 | super(value); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DataAccessError.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import java.math.BigInteger; 8 | import org.openmuc.jasn1.ber.types.*; 9 | 10 | public class DataAccessError extends BerInteger { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public DataAccessError() { 15 | } 16 | 17 | public DataAccessError(byte[] code) { 18 | super(code); 19 | } 20 | 21 | public DataAccessError(BigInteger value) { 22 | super(value); 23 | } 24 | 25 | public DataAccessError(long value) { 26 | super(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/AEQualifierForm2.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import java.math.BigInteger; 8 | 9 | import org.openmuc.jasn1.ber.types.BerInteger; 10 | 11 | public class AEQualifierForm2 extends BerInteger { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public AEQualifierForm2() { 16 | } 17 | 18 | public AEQualifierForm2(byte[] code) { 19 | super(code); 20 | } 21 | 22 | public AEQualifierForm2(BigInteger value) { 23 | super(value); 24 | } 25 | 26 | public AEQualifierForm2(long value) { 27 | super(value); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/ProtocolVersion.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerBitString; 8 | 9 | public class ProtocolVersion extends BerBitString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public ProtocolVersion() { 14 | } 15 | 16 | public ProtocolVersion(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public ProtocolVersion(byte[] value, int numBits) { 21 | super(value, numBits); 22 | } 23 | 24 | public ProtocolVersion(boolean[] value) { 25 | super(value); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ServiceSupportOptions.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.*; 8 | 9 | public class ServiceSupportOptions extends BerBitString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public ServiceSupportOptions() { 14 | } 15 | 16 | public ServiceSupportOptions(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public ServiceSupportOptions(byte[] value, int numBits) { 21 | super(value, numBits); 22 | } 23 | 24 | public ServiceSupportOptions(boolean[] value) { 25 | super(value); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/ReleaseRequestReason.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import java.math.BigInteger; 8 | 9 | import org.openmuc.jasn1.ber.types.BerInteger; 10 | 11 | public class ReleaseRequestReason extends BerInteger { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public ReleaseRequestReason() { 16 | } 17 | 18 | public ReleaseRequestReason(byte[] code) { 19 | super(code); 20 | } 21 | 22 | public ReleaseRequestReason(BigInteger value) { 23 | super(value); 24 | } 25 | 26 | public ReleaseRequestReason(long value) { 27 | super(value); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/ReleaseResponseReason.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import java.math.BigInteger; 8 | 9 | import org.openmuc.jasn1.ber.types.BerInteger; 10 | 11 | public class ReleaseResponseReason extends BerInteger { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public ReleaseResponseReason() { 16 | } 17 | 18 | public ReleaseResponseReason(byte[] code) { 19 | super(code); 20 | } 21 | 22 | public ReleaseResponseReason(BigInteger value) { 23 | super(value); 24 | } 25 | 26 | public ReleaseResponseReason(long value) { 27 | super(value); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ParameterSupportOptions.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.openiec61850.internal.mms.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.*; 8 | 9 | public class ParameterSupportOptions extends BerBitString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public ParameterSupportOptions() { 14 | } 15 | 16 | public ParameterSupportOptions(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public ParameterSupportOptions(byte[] value, int numBits) { 21 | super(value, numBits); 22 | } 23 | 24 | public ParameterSupportOptions(boolean[] value) { 25 | super(value); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/AEInvocationIdentifier.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import java.math.BigInteger; 8 | 9 | import org.openmuc.jasn1.ber.types.BerInteger; 10 | 11 | public class AEInvocationIdentifier extends BerInteger { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public AEInvocationIdentifier() { 16 | } 17 | 18 | public AEInvocationIdentifier(byte[] code) { 19 | super(code); 20 | } 21 | 22 | public AEInvocationIdentifier(BigInteger value) { 23 | super(value); 24 | } 25 | 26 | public AEInvocationIdentifier(long value) { 27 | super(value); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/APInvocationIdentifier.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import java.math.BigInteger; 8 | 9 | import org.openmuc.jasn1.ber.types.BerInteger; 10 | 11 | public class APInvocationIdentifier extends BerInteger { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public APInvocationIdentifier() { 16 | } 17 | 18 | public APInvocationIdentifier(byte[] code) { 19 | super(code); 20 | } 21 | 22 | public APInvocationIdentifier(BigInteger value) { 23 | super(value); 24 | } 25 | 26 | public APInvocationIdentifier(long value) { 27 | super(value); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/UserSessionRequirements.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerBitString; 8 | 9 | public class UserSessionRequirements extends BerBitString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public UserSessionRequirements() { 14 | } 15 | 16 | public UserSessionRequirements(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public UserSessionRequirements(byte[] value, int numBits) { 21 | super(value, numBits); 22 | } 23 | 24 | public UserSessionRequirements(boolean[] value) { 25 | super(value); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/PresentationRequirements.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | import org.openmuc.jasn1.ber.types.BerBitString; 8 | 9 | public class PresentationRequirements extends BerBitString { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public PresentationRequirements() { 14 | } 15 | 16 | public PresentationRequirements(byte[] code) { 17 | super(code); 18 | } 19 | 20 | public PresentationRequirements(byte[] value, int numBits) { 21 | super(value, numBits); 22 | } 23 | 24 | public PresentationRequirements(boolean[] value) { 25 | super(value); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/presentation/asn1/PresentationContextIdentifier.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.presentation.asn1; 6 | 7 | import java.math.BigInteger; 8 | 9 | import org.openmuc.jasn1.ber.types.BerInteger; 10 | 11 | public class PresentationContextIdentifier extends BerInteger { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public PresentationContextIdentifier() { 16 | } 17 | 18 | public PresentationContextIdentifier(byte[] code) { 19 | super(code); 20 | } 21 | 22 | public PresentationContextIdentifier(BigInteger value) { 23 | super(value); 24 | } 25 | 26 | public PresentationContextIdentifier(long value) { 27 | super(value); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/Value.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | public final class Value { 20 | 21 | public int sGroup; 22 | public String value; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/FlagCliParameter.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | public class FlagCliParameter extends CliParameter { 4 | 5 | FlagCliParameter(CliParameterBuilder builder) { 6 | super(builder); 7 | } 8 | 9 | @Override 10 | int appendSynopsis(StringBuilder sb) { 11 | int length = 0; 12 | if (optional) { 13 | sb.append("["); 14 | length++; 15 | } 16 | sb.append(name); 17 | length += name.length(); 18 | if (optional) { 19 | sb.append("]"); 20 | length++; 21 | } 22 | return length; 23 | } 24 | 25 | @Override 26 | void appendDescription(StringBuilder sb) { 27 | sb.append("\t").append(name).append("\n\t ").append(description); 28 | } 29 | 30 | @Override 31 | int parse(String[] args, int i) throws CliParseException { 32 | selected = true; 33 | return 1; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /run-scripts/gui-client/openiec61850-gui-client: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JARS_LOCATION="../../build/libs-all" 4 | MAIN_CLASS="org.openmuc.openiec61850.clientgui.ClientGui" 5 | SYSPROPS="" 6 | PARAMS="" 7 | 8 | # from gradle start script: 9 | # Attempt to set SCRIPT_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | SCRIPT_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | 28 | CLASSPATH=$(JARS=("$SCRIPT_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}") 29 | 30 | for i in $@; do 31 | if [[ $i == -D* ]]; then 32 | SYSPROPS="$SYSPROPS $i"; 33 | else 34 | PARAMS="$PARAMS $i"; 35 | fi 36 | done 37 | 38 | java $SYSPROPS -cp $CLASSPATH $MAIN_CLASS $PARAMS 39 | 40 | -------------------------------------------------------------------------------- /run-scripts/console-server/openiec61850-console-server: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JARS_LOCATION="../../build/libs-all" 4 | MAIN_CLASS="org.openmuc.openiec61850.app.ConsoleServer" 5 | SYSPROPS="-Dlogback.configurationFile=logback.xml" 6 | 7 | # from gradle start script: 8 | # Attempt to set SCRIPT_HOME 9 | # Resolve links: $0 may be a link 10 | PRG="$0" 11 | # Need this for relative symlinks. 12 | while [ -h "$PRG" ] ; do 13 | ls=`ls -ld "$PRG"` 14 | link=`expr "$ls" : '.*-> \(.*\)$'` 15 | if expr "$link" : '/.*' > /dev/null; then 16 | PRG="$link" 17 | else 18 | PRG=`dirname "$PRG"`"/$link" 19 | fi 20 | done 21 | SAVED="`pwd`" 22 | cd "`dirname \"$PRG\"`/" >/dev/null 23 | SCRIPT_HOME="`pwd -P`" 24 | cd "$SAVED" >/dev/null 25 | 26 | 27 | CLASSPATH=$(JARS=("$SCRIPT_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}") 28 | 29 | for i in $@; do 30 | if [[ $i == -D* ]]; then 31 | SYSPROPS="$SYSPROPS $i"; 32 | else 33 | PARAMS="$PARAMS $i"; 34 | fi 35 | done 36 | 37 | java $SYSPROPS -cp $CLASSPATH $MAIN_CLASS $PARAMS 38 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/ValueCliParameter.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | abstract class ValueCliParameter extends CliParameter { 4 | 5 | String parameterName; 6 | 7 | ValueCliParameter(CliParameterBuilder builder, String parameterName) { 8 | super(builder); 9 | this.parameterName = parameterName; 10 | } 11 | 12 | @Override 13 | int appendSynopsis(StringBuilder sb) { 14 | int length = 0; 15 | if (optional) { 16 | sb.append("["); 17 | length++; 18 | } 19 | sb.append(name).append(" <").append(parameterName).append(">"); 20 | length += (name.length() + 3 + parameterName.length()); 21 | if (optional) { 22 | sb.append("]"); 23 | length++; 24 | } 25 | return length; 26 | } 27 | 28 | @Override 29 | void appendDescription(StringBuilder sb) { 30 | sb.append("\t").append(name).append(" <").append(parameterName).append(">\n\t ").append(description); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/Bda.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import org.openmuc.openiec61850.SclParseException; 20 | import org.w3c.dom.Node; 21 | 22 | public final class Bda extends AbstractDataAttribute { 23 | 24 | public Bda(Node xmlNode) throws SclParseException { 25 | super(xmlNode); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/josistack/AcseAssociationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.josistack; 18 | 19 | import java.io.IOException; 20 | import java.nio.ByteBuffer; 21 | 22 | public interface AcseAssociationListener { 23 | 24 | public void connectionIndication(AcseAssociation acseAssociation, ByteBuffer data); 25 | 26 | public void serverStoppedListeningIndication(IOException e); 27 | } 28 | -------------------------------------------------------------------------------- /src/docs/asciidoc/pdf-theme.yml: -------------------------------------------------------------------------------- 1 | title_page: 2 | align: right 3 | 4 | page: 5 | layout: portrait 6 | # margin: [0.75in, 1in, 0.75in, 1in] 7 | size: A4 8 | 9 | base: 10 | font_family: Times-Roman 11 | font_color: #333333 12 | font_size: 11 13 | line_height_length: 17 14 | line_height: $base_line_height_length / $base_font_size 15 | 16 | vertical_rhythm: $base_line_height_length 17 | 18 | heading: 19 | font_color: #0000 20 | font_size: 14 21 | font_style: bold 22 | line_height: 1.2 23 | margin_bottom: $vertical_rhythm 24 | 25 | link: 26 | font_color: #939393 27 | 28 | outline_list: 29 | indent: $base_font_size * 1.5 30 | 31 | header: 32 | height: 0.75in 33 | line_height: 1 34 | recto_content: 35 | center: '{document-title}' 36 | verso_content: 37 | center: '{document-title}' 38 | 39 | footer: 40 | height: 0.75in 41 | line_height: 1 42 | recto_content: 43 | right: '*{page-number}*' 44 | verso_content: 45 | left: '*{page-number}*' 46 | 47 | caption: 48 | align: left 49 | font_color: #000000 50 | font_size: 9 51 | 52 | code: 53 | border_color: #cccccc 54 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/SclParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | public final class SclParseException extends Exception { 20 | 21 | private static final long serialVersionUID = 8499804369026418082L; 22 | 23 | public SclParseException(String string) { 24 | super(string); 25 | } 26 | 27 | public SclParseException(Exception e) { 28 | super(e); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/FileInformation.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850; 2 | 3 | import java.util.Calendar; 4 | 5 | /** 6 | * @brief Contains file information received by the GetFileDirectory service 7 | */ 8 | public class FileInformation { 9 | 10 | private String filename; 11 | 12 | private long fileSize; 13 | 14 | private Calendar lastModified; 15 | 16 | public String getFilename() { 17 | return filename; 18 | } 19 | 20 | public long getFileSize() { 21 | return fileSize; 22 | } 23 | 24 | /** 25 | * Get the time stamp of last modification. As it is an optional attribute the return value can be null 26 | * 27 | * @return the time stamp of last modification, or null if the time stamp is not present 28 | */ 29 | public Calendar getLastModified() { 30 | return lastModified; 31 | } 32 | 33 | public FileInformation(String filename, long fileSize, Calendar lastModified) { 34 | super(); 35 | this.filename = filename; 36 | this.fileSize = fileSize; 37 | this.lastModified = lastModified; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/util/Counter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.util; 18 | 19 | public class Counter { 20 | private int value; 21 | 22 | public Counter(int value) { 23 | this.value = value; 24 | } 25 | 26 | public Counter() { 27 | this(0); 28 | } 29 | 30 | public void increment() { 31 | value++; 32 | } 33 | 34 | public int getValue() { 35 | return value; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/CliParameter.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | public abstract class CliParameter { 4 | 5 | final String name; 6 | final String description; 7 | final boolean optional; 8 | boolean selected; 9 | 10 | CliParameter(CliParameterBuilder builder) { 11 | name = builder.name; 12 | description = builder.description; 13 | optional = builder.optional; 14 | } 15 | 16 | /** 17 | * @return the name 18 | */ 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | /** 24 | * @return the description 25 | */ 26 | public String getDescription() { 27 | return description; 28 | } 29 | 30 | /** 31 | * @return the optional 32 | */ 33 | public boolean isOptional() { 34 | return optional; 35 | } 36 | 37 | public boolean isSelected() { 38 | return selected; 39 | } 40 | 41 | abstract int parse(String[] args, int i) throws CliParseException; 42 | 43 | abstract int appendSynopsis(StringBuilder sb); 44 | 45 | abstract void appendDescription(StringBuilder sb); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/LnSubDef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import org.openmuc.openiec61850.LogicalNode; 20 | import org.w3c.dom.Node; 21 | 22 | public class LnSubDef { 23 | 24 | public Node defXmlNode; 25 | public LogicalNode logicalNode; 26 | 27 | public LnSubDef(Node dataSetDefXmlNode, LogicalNode logicalNode) { 28 | defXmlNode = dataSetDefXmlNode; 29 | this.logicalNode = logicalNode; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/ServiceSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | public final class ServiceSupport { 20 | 21 | public boolean dynAssociation = false; 22 | public boolean getDirectory = false; 23 | public boolean getDataObjectDefinition = false; 24 | public boolean getDataSetValue = false; 25 | public boolean dataSetDirectory = false; 26 | public boolean readWrite = false; 27 | public boolean getCBValues = false; 28 | public boolean goose = false; 29 | public int gooseMax = 0; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/josistack/DecodingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.josistack; 18 | 19 | public final class DecodingException extends Exception { 20 | 21 | private static final long serialVersionUID = -4102153710148894434L; 22 | 23 | public DecodingException() { 24 | super(); 25 | } 26 | 27 | public DecodingException(String s) { 28 | super(s); 29 | } 30 | 31 | public DecodingException(Throwable cause) { 32 | super(cause); 33 | } 34 | 35 | public DecodingException(String s, Throwable cause) { 36 | super(s, cause); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/StringCliParameter.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | public class StringCliParameter extends ValueCliParameter { 4 | 5 | String value; 6 | private String defaultValue = null; 7 | 8 | StringCliParameter(CliParameterBuilder builder, String parameterName, String defaultValue) { 9 | super(builder, parameterName); 10 | this.defaultValue = defaultValue; 11 | value = defaultValue; 12 | } 13 | 14 | StringCliParameter(CliParameterBuilder builder, String parameterName) { 15 | super(builder, parameterName); 16 | } 17 | 18 | public String getValue() { 19 | return value; 20 | } 21 | 22 | @Override 23 | int parse(String[] args, int i) throws CliParseException { 24 | selected = true; 25 | 26 | if (args.length < (i + 2)) { 27 | throw new CliParseException("Parameter " + name + " has no value."); 28 | } 29 | value = args[i + 1]; 30 | 31 | return 2; 32 | } 33 | 34 | @Override 35 | public void appendDescription(StringBuilder sb) { 36 | super.appendDescription(sb); 37 | if (defaultValue != null) { 38 | sb.append(" Default is \"").append(defaultValue).append("\"."); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/jositransport/TConnectionListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.jositransport; 18 | 19 | import java.io.IOException; 20 | 21 | public interface TConnectionListener { 22 | 23 | public void connectionIndication(TConnection tConnection); 24 | 25 | /** 26 | * This function is only called when an IOException in ServerSocket.accept() occurred which was not forced using 27 | * ServerTSAP.stopListening() 28 | * 29 | * @param e 30 | * The IOException caught form ServerSocket.accept() 31 | */ 32 | public void serverStoppedListeningIndication(IOException e); 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/AbstractType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import org.openmuc.openiec61850.SclParseException; 20 | import org.w3c.dom.Node; 21 | 22 | public abstract class AbstractType { 23 | 24 | public String id = null; 25 | 26 | // attributes not needed: desc 27 | 28 | public AbstractType(Node xmlNode) throws SclParseException { 29 | Node idNode = xmlNode.getAttributes().getNamedItem("id"); 30 | if (idNode == null) { 31 | throw new SclParseException("Required attribute \"id\" not found!"); 32 | } 33 | id = idNode.getNodeValue(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | /** 20 | * This Enumeration includes all possible Types for IEC 61850 leave nodes ( {@link BasicDataAttribute}). This includes 21 | * BasicTypes and CommonACSITypes as defined in part 7-2. 22 | * 23 | */ 24 | public enum BdaType { 25 | 26 | BOOLEAN, 27 | INT8, 28 | INT16, 29 | INT32, 30 | INT64, 31 | INT128, 32 | INT8U, 33 | INT16U, 34 | INT32U, 35 | FLOAT32, 36 | FLOAT64, 37 | OCTET_STRING, 38 | VISIBLE_STRING, 39 | UNICODE_STRING, 40 | TIMESTAMP, 41 | ENTRY_TIME, 42 | CHECK, 43 | QUALITY, 44 | DOUBLE_BIT_POS, 45 | TAP_COMMAND, 46 | TRIGGER_CONDITIONS, 47 | OPTFLDS, 48 | REASON_FOR_INCLUSION; 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/LongCliParameter.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | public class LongCliParameter extends ValueCliParameter { 4 | 5 | Long value; 6 | private Long defaultValue = null; 7 | 8 | LongCliParameter(CliParameterBuilder builder, String parameterName, long defaultValue) { 9 | super(builder, parameterName); 10 | this.defaultValue = defaultValue; 11 | value = defaultValue; 12 | } 13 | 14 | LongCliParameter(CliParameterBuilder builder, String parameterName) { 15 | super(builder, parameterName); 16 | } 17 | 18 | public long getValue() { 19 | return value; 20 | } 21 | 22 | @Override 23 | int parse(String[] args, int i) throws CliParseException { 24 | selected = true; 25 | 26 | if (args.length < (i + 2)) { 27 | throw new CliParseException("Parameter " + name + " has no value."); 28 | } 29 | 30 | try { 31 | value = Long.decode(args[i + 1]); 32 | } catch (Exception e) { 33 | throw new CliParseException("Parameter value " + args[i + 1] + " cannot be converted to long."); 34 | } 35 | return 2; 36 | } 37 | 38 | @Override 39 | void appendDescription(StringBuilder sb) { 40 | super.appendDescription(sb); 41 | if (defaultValue != null) { 42 | sb.append(" Default is ").append(defaultValue).append("."); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/IntCliParameter.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | public class IntCliParameter extends ValueCliParameter { 4 | 5 | Integer value; 6 | private Integer defaultValue = null; 7 | 8 | IntCliParameter(CliParameterBuilder builder, String parameterName, int defaultValue) { 9 | super(builder, parameterName); 10 | this.defaultValue = defaultValue; 11 | value = defaultValue; 12 | } 13 | 14 | IntCliParameter(CliParameterBuilder builder, String parameterName) { 15 | super(builder, parameterName); 16 | } 17 | 18 | public int getValue() { 19 | return value; 20 | } 21 | 22 | @Override 23 | int parse(String[] args, int i) throws CliParseException { 24 | selected = true; 25 | 26 | if (args.length < (i + 2)) { 27 | throw new CliParseException("Parameter " + name + " has no value."); 28 | } 29 | 30 | try { 31 | value = Integer.decode(args[i + 1]); 32 | } catch (Exception e) { 33 | throw new CliParseException("Parameter value " + args[i + 1] + " cannot be converted to int."); 34 | } 35 | return 2; 36 | } 37 | 38 | @Override 39 | void appendDescription(StringBuilder sb) { 40 | super.appendDescription(sb); 41 | if (defaultValue != null) { 42 | sb.append(" Default is ").append(defaultValue).append("."); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/DataTreeNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui; 18 | 19 | import java.io.IOException; 20 | 21 | import javax.swing.tree.TreeNode; 22 | 23 | import org.openmuc.openiec61850.ClientAssociation; 24 | import org.openmuc.openiec61850.ServiceError; 25 | 26 | public interface DataTreeNode { 27 | 28 | public abstract BasicDataBind getData(); 29 | 30 | public abstract void reset(ClientAssociation association) throws ServiceError, IOException; 31 | 32 | public abstract void writeValues(ClientAssociation association) throws ServiceError, IOException; 33 | 34 | public abstract int getChildCount(); 35 | 36 | public abstract TreeNode getChildAt(int index); 37 | 38 | public abstract boolean writable(); 39 | 40 | public abstract boolean readable(); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/AcseListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import java.io.IOException; 20 | import java.nio.ByteBuffer; 21 | 22 | import org.openmuc.josistack.AcseAssociation; 23 | import org.openmuc.josistack.AcseAssociationListener; 24 | 25 | final class AcseListener implements AcseAssociationListener { 26 | 27 | ServerSap serverSap; 28 | 29 | AcseListener(ServerSap serverSap) { 30 | this.serverSap = serverSap; 31 | } 32 | 33 | @Override 34 | public void connectionIndication(AcseAssociation acseAssociation, ByteBuffer psdu) { 35 | serverSap.connectionIndication(acseAssociation, psdu); 36 | } 37 | 38 | @Override 39 | public void serverStoppedListeningIndication(IOException e) { 40 | serverSap.serverStoppedListeningIndication(e); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/DaType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import org.openmuc.openiec61850.SclParseException; 23 | import org.w3c.dom.Node; 24 | import org.w3c.dom.NodeList; 25 | 26 | public final class DaType extends AbstractType { 27 | 28 | // attributes not needed: iedType 29 | 30 | public List bdas = new ArrayList<>(); 31 | 32 | public DaType(Node xmlNode) throws SclParseException { 33 | 34 | super(xmlNode); 35 | 36 | NodeList elements = xmlNode.getChildNodes(); 37 | 38 | for (int i = 0; i < elements.getLength(); i++) { 39 | Node node = elements.item(i); 40 | if (node.getNodeName().equals("BDA")) { 41 | bdas.add(new Bda(node)); 42 | } 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/Do.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import org.openmuc.openiec61850.SclParseException; 20 | import org.w3c.dom.NamedNodeMap; 21 | import org.w3c.dom.Node; 22 | 23 | public final class Do extends AbstractElement { 24 | 25 | private String type; 26 | 27 | public Do(String name, String desc, String type) { 28 | super(name, desc); 29 | } 30 | 31 | public Do(Node xmlNode) throws SclParseException { 32 | super(xmlNode); 33 | 34 | NamedNodeMap attributes = xmlNode.getAttributes(); 35 | 36 | Node node = attributes.getNamedItem("type"); 37 | 38 | if (node == null) { 39 | throw new SclParseException("Required attribute \"type\" not found!"); 40 | } 41 | 42 | type = node.getNodeValue(); 43 | } 44 | 45 | public String getType() { 46 | return type; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/Sdo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import org.openmuc.openiec61850.SclParseException; 20 | import org.w3c.dom.NamedNodeMap; 21 | import org.w3c.dom.Node; 22 | 23 | public final class Sdo extends AbstractElement { 24 | 25 | private String type = null; 26 | 27 | public Sdo(String name, String desc, DoType type) { 28 | super(name, desc); 29 | } 30 | 31 | public Sdo(Node xmlNode) throws SclParseException { 32 | super(xmlNode); 33 | 34 | NamedNodeMap attributes = xmlNode.getAttributes(); 35 | 36 | Node node = attributes.getNamedItem("type"); 37 | 38 | if (node == null) { 39 | throw new SclParseException("Required attribute \"type\" not found!"); 40 | } 41 | 42 | type = node.getNodeValue(); 43 | } 44 | 45 | public String getType() { 46 | return type; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/LogicalDevice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import java.util.ArrayList; 20 | import java.util.LinkedHashMap; 21 | import java.util.List; 22 | 23 | public final class LogicalDevice extends ModelNode { 24 | 25 | public LogicalDevice(ObjectReference objectReference, List logicalNodes) { 26 | children = new LinkedHashMap<>((int) ((logicalNodes.size() / 0.75) + 1)); 27 | this.objectReference = objectReference; 28 | for (LogicalNode logicalNode : logicalNodes) { 29 | children.put(logicalNode.getReference().getName(), logicalNode); 30 | logicalNode.setParent(this); 31 | } 32 | } 33 | 34 | @Override 35 | public LogicalDevice copy() { 36 | List childCopies = new ArrayList<>(children.size()); 37 | for (ModelNode childNode : children.values()) { 38 | childCopies.add((LogicalNode) childNode.copy()); 39 | } 40 | return new LogicalDevice(objectReference, childCopies); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/BooleanDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import javax.swing.JCheckBox; 20 | import javax.swing.JComponent; 21 | 22 | import org.openmuc.openiec61850.BdaBoolean; 23 | import org.openmuc.openiec61850.BdaType; 24 | import org.openmuc.openiec61850.clientgui.BasicDataBind; 25 | 26 | public class BooleanDataBind extends BasicDataBind { 27 | 28 | private JCheckBox checkbox; 29 | 30 | public BooleanDataBind(BdaBoolean data) { 31 | super(data, BdaType.BOOLEAN); 32 | } 33 | 34 | @Override 35 | protected JComponent init() { 36 | checkbox = new JCheckBox(); 37 | checkbox.setBorder(null); 38 | checkbox.setSelected(data.getValue()); 39 | return checkbox; 40 | } 41 | 42 | @Override 43 | protected void resetImpl() { 44 | checkbox.setSelected(data.getValue()); 45 | } 46 | 47 | @Override 48 | protected void writeImpl() { 49 | data.setValue(checkbox.isSelected()); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/LnType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import org.openmuc.openiec61850.SclParseException; 23 | import org.w3c.dom.Node; 24 | import org.w3c.dom.NodeList; 25 | 26 | public final class LnType extends AbstractType { 27 | 28 | // attributes not needed: lnClass, iedType 29 | 30 | public List dos = new ArrayList<>(); 31 | 32 | public LnType(Node xmlNode) throws SclParseException { 33 | 34 | super(xmlNode); 35 | 36 | if (xmlNode.getAttributes().getNamedItem("lnClass") == null) { 37 | throw new SclParseException("Required attribute \"lnClass\" not found in LNType!"); 38 | } 39 | 40 | NodeList elements = xmlNode.getChildNodes(); 41 | 42 | for (int i = 0; i < elements.getLength(); i++) { 43 | Node node = elements.item(i); 44 | if (node.getNodeName().equals("DO")) { 45 | dos.add(new Do(node)); 46 | } 47 | } 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/Int8DataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import org.openmuc.openiec61850.BdaInt8; 20 | import org.openmuc.openiec61850.BdaType; 21 | 22 | public class Int8DataBind extends TextFieldDataBind { 23 | 24 | private static final Int8Filter FILTER = new Int8Filter(); 25 | 26 | public Int8DataBind(BdaInt8 data) { 27 | super(data, BdaType.INT8, FILTER); 28 | } 29 | 30 | @Override 31 | protected void resetImpl() { 32 | inputField.setText(new Byte(data.getValue()).toString()); 33 | } 34 | 35 | @Override 36 | protected void writeImpl() { 37 | data.setValue(Byte.parseByte(inputField.getText())); 38 | } 39 | 40 | private static class Int8Filter extends AbstractFilter { 41 | @Override 42 | protected boolean test(String text) { 43 | try { 44 | Byte.parseByte(text); 45 | return true; 46 | } catch (NumberFormatException e) { 47 | return false; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/ServerEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import java.util.List; 20 | 21 | public interface ServerEventListener { 22 | 23 | /** 24 | * The write callback function is called if one of more basic data attributes are written using either the 25 | * setDataValue, setDataSetValues or control services. If the complete write process was successful write returns 26 | * either an empty list or null. If an error occurs writing one or more attributes then a list shall be returned 27 | * that is of equal size as the list of basic data attributes. The returned list's element shall be null if writing 28 | * the corresponding BDA was successful and a service error otherwise. 29 | * 30 | * @param bdas 31 | * the list of basic data attributes that are to be set. 32 | * @return a list of service errors indicating errors writing the corresponding basic data attributes. 33 | */ 34 | public List write(List bdas); 35 | 36 | void serverStoppedListening(ServerSap serverSAP); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/Int64DataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import org.openmuc.openiec61850.BdaInt64; 20 | import org.openmuc.openiec61850.BdaType; 21 | 22 | public class Int64DataBind extends TextFieldDataBind { 23 | 24 | private static final Int64Filter FILTER = new Int64Filter(); 25 | 26 | public Int64DataBind(BdaInt64 data) { 27 | super(data, BdaType.INT64, FILTER); 28 | } 29 | 30 | @Override 31 | protected void resetImpl() { 32 | inputField.setText(new Long(data.getValue()).toString()); 33 | } 34 | 35 | @Override 36 | protected void writeImpl() { 37 | data.setValue(Long.parseLong(inputField.getText())); 38 | } 39 | 40 | private static class Int64Filter extends AbstractFilter { 41 | @Override 42 | protected boolean test(String text) { 43 | try { 44 | Long.parseLong(text); 45 | return true; 46 | } catch (NumberFormatException e) { 47 | return false; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/Int16DataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import org.openmuc.openiec61850.BdaInt16; 20 | import org.openmuc.openiec61850.BdaType; 21 | 22 | public class Int16DataBind extends TextFieldDataBind { 23 | 24 | private static final Int16Filter FILTER = new Int16Filter(); 25 | 26 | public Int16DataBind(BdaInt16 data) { 27 | super(data, BdaType.INT16, FILTER); 28 | } 29 | 30 | @Override 31 | protected void resetImpl() { 32 | inputField.setText(new Short(data.getValue()).toString()); 33 | } 34 | 35 | @Override 36 | protected void writeImpl() { 37 | data.setValue(Short.parseShort(inputField.getText())); 38 | } 39 | 40 | private static class Int16Filter extends AbstractFilter { 41 | @Override 42 | protected boolean test(String text) { 43 | try { 44 | Short.parseShort(text); 45 | return true; 46 | } catch (NumberFormatException e) { 47 | return false; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/Int32DataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import org.openmuc.openiec61850.BdaInt32; 20 | import org.openmuc.openiec61850.BdaType; 21 | 22 | public class Int32DataBind extends TextFieldDataBind { 23 | 24 | private static final Int32Filter FILTER = new Int32Filter(); 25 | 26 | public Int32DataBind(BdaInt32 data) { 27 | super(data, BdaType.INT32, FILTER); 28 | } 29 | 30 | @Override 31 | protected void resetImpl() { 32 | inputField.setText(new Integer(data.getValue()).toString()); 33 | } 34 | 35 | @Override 36 | protected void writeImpl() { 37 | data.setValue(Integer.parseInt(inputField.getText())); 38 | } 39 | 40 | private static class Int32Filter extends AbstractFilter { 41 | @Override 42 | protected boolean test(String text) { 43 | try { 44 | Integer.parseInt(text); 45 | return true; 46 | } catch (NumberFormatException e) { 47 | return false; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/TapCommandDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import javax.swing.JComboBox; 20 | import javax.swing.JComponent; 21 | 22 | import org.openmuc.openiec61850.BdaTapCommand; 23 | import org.openmuc.openiec61850.BdaType; 24 | import org.openmuc.openiec61850.clientgui.BasicDataBind; 25 | 26 | public class TapCommandDataBind extends BasicDataBind { 27 | 28 | @SuppressWarnings("unchecked") 29 | private final JComboBox tapCommand = new JComboBox(BdaTapCommand.TapCommand.values()); 30 | 31 | public TapCommandDataBind(BdaTapCommand data) { 32 | super(data, BdaType.TAP_COMMAND); 33 | } 34 | 35 | @Override 36 | protected JComponent init() { 37 | return tapCommand; 38 | } 39 | 40 | @Override 41 | protected void resetImpl() { 42 | tapCommand.setSelectedItem(data.getTapCommand()); 43 | } 44 | 45 | @Override 46 | protected void writeImpl() { 47 | // TODO uncomment once data.setTapCommand is implemented 48 | // data.setTapCommand(tapCommand.getSelectedItem()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/DoubleBitPosDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import javax.swing.JComboBox; 20 | import javax.swing.JComponent; 21 | 22 | import org.openmuc.openiec61850.BdaDoubleBitPos; 23 | import org.openmuc.openiec61850.BdaType; 24 | import org.openmuc.openiec61850.clientgui.BasicDataBind; 25 | 26 | public class DoubleBitPosDataBind extends BasicDataBind { 27 | 28 | @SuppressWarnings("unchecked") 29 | private final JComboBox valueField = new JComboBox(BdaDoubleBitPos.DoubleBitPos.values()); 30 | 31 | public DoubleBitPosDataBind(BdaDoubleBitPos data) { 32 | super(data, BdaType.DOUBLE_BIT_POS); 33 | } 34 | 35 | @Override 36 | protected JComponent init() { 37 | return valueField; 38 | } 39 | 40 | @Override 41 | protected void resetImpl() { 42 | valueField.setSelectedItem(data.getDoubleBitPos()); 43 | } 44 | 45 | @Override 46 | protected void writeImpl() { 47 | // TODO uncomment once data.setTapCommand() is implemented 48 | // data.setTapCommand(valueField.getSelectedItem()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/Int8UDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import org.openmuc.openiec61850.BdaInt8U; 20 | import org.openmuc.openiec61850.BdaType; 21 | 22 | public class Int8UDataBind extends TextFieldDataBind { 23 | 24 | private static final UInt8Filter FILTER = new UInt8Filter(); 25 | 26 | public Int8UDataBind(BdaInt8U data) { 27 | super(data, BdaType.INT8U, FILTER); 28 | } 29 | 30 | @Override 31 | protected void resetImpl() { 32 | inputField.setText(new Short(data.getValue()).toString()); 33 | } 34 | 35 | @Override 36 | protected void writeImpl() { 37 | data.setValue(Short.parseShort(inputField.getText())); 38 | } 39 | 40 | private static class UInt8Filter extends AbstractFilter { 41 | @Override 42 | protected boolean test(String text) { 43 | try { 44 | short value = Short.parseShort(text); 45 | return value >= 0 && value <= 0xFF; 46 | } catch (NumberFormatException e) { 47 | return false; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/Float32DataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import org.openmuc.openiec61850.BdaFloat32; 20 | import org.openmuc.openiec61850.BdaType; 21 | 22 | public class Float32DataBind extends TextFieldDataBind { 23 | 24 | private static final FloatFilter FILTER = new FloatFilter(); 25 | 26 | public Float32DataBind(BdaFloat32 data) { 27 | super(data, BdaType.FLOAT32, FILTER); 28 | } 29 | 30 | @Override 31 | protected void resetImpl() { 32 | inputField.setText(data.getFloat().toString()); 33 | } 34 | 35 | @Override 36 | protected void writeImpl() { 37 | float newFloat = Float.parseFloat(inputField.getText()); 38 | data.setFloat(newFloat); 39 | } 40 | 41 | private static class FloatFilter extends AbstractFilter { 42 | @Override 43 | protected boolean test(String text) { 44 | try { 45 | Float.parseFloat(text); 46 | return true; 47 | } catch (NumberFormatException e) { 48 | return false; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/Int16UDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import org.openmuc.openiec61850.BdaInt16U; 20 | import org.openmuc.openiec61850.BdaType; 21 | 22 | public class Int16UDataBind extends TextFieldDataBind { 23 | 24 | private static final UInt16Filter FILTER = new UInt16Filter(); 25 | 26 | public Int16UDataBind(BdaInt16U data) { 27 | super(data, BdaType.INT16U, FILTER); 28 | } 29 | 30 | @Override 31 | protected void resetImpl() { 32 | inputField.setText(new Integer(data.getValue()).toString()); 33 | } 34 | 35 | @Override 36 | protected void writeImpl() { 37 | data.setValue(Integer.parseInt(inputField.getText())); 38 | } 39 | 40 | private static class UInt16Filter extends AbstractFilter { 41 | @Override 42 | protected boolean test(String text) { 43 | try { 44 | int value = Integer.parseInt(text); 45 | return value >= 0 && value <= 0xFFFF; 46 | } catch (NumberFormatException e) { 47 | return false; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/Int32UDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import org.openmuc.openiec61850.BdaInt32U; 20 | import org.openmuc.openiec61850.BdaType; 21 | 22 | public class Int32UDataBind extends TextFieldDataBind { 23 | 24 | private static final UInt32Filter FILTER = new UInt32Filter(); 25 | 26 | public Int32UDataBind(BdaInt32U data) { 27 | super(data, BdaType.INT32U, FILTER); 28 | } 29 | 30 | @Override 31 | protected void resetImpl() { 32 | inputField.setText(new Long(data.getValue()).toString()); 33 | } 34 | 35 | @Override 36 | protected void writeImpl() { 37 | data.setValue(Long.parseLong(inputField.getText())); 38 | } 39 | 40 | private static class UInt32Filter extends AbstractFilter { 41 | @Override 42 | protected boolean test(String text) { 43 | try { 44 | long value = Long.parseLong(text); 45 | return value >= 0 && value <= 0xFFFFFFFFL; 46 | } catch (NumberFormatException e) { 47 | return false; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/Float64DataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import org.openmuc.openiec61850.BdaFloat64; 20 | import org.openmuc.openiec61850.BdaType; 21 | 22 | public class Float64DataBind extends TextFieldDataBind { 23 | 24 | private static final DoubleFilter FILTER = new DoubleFilter(); 25 | 26 | public Float64DataBind(BdaFloat64 data) { 27 | super(data, BdaType.FLOAT64, FILTER); 28 | } 29 | 30 | @Override 31 | protected void resetImpl() { 32 | inputField.setText(data.getDouble().toString()); 33 | } 34 | 35 | @Override 36 | protected void writeImpl() { 37 | double newDouble = Double.parseDouble(inputField.getText()); 38 | data.setDouble(newDouble); 39 | } 40 | 41 | private static class DoubleFilter extends AbstractFilter { 42 | @Override 43 | protected boolean test(String text) { 44 | try { 45 | Double.parseDouble(text); 46 | return true; 47 | } catch (NumberFormatException e) { 48 | return false; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/josistack/ByteBufferInputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.josistack; 18 | 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | import java.nio.ByteBuffer; 22 | 23 | /** 24 | * Simple InputStream wrapper around a {@link ByteBuffer} object 25 | * 26 | * @author Karsten Mueller-Bier 27 | */ 28 | public final class ByteBufferInputStream extends InputStream { 29 | 30 | private final ByteBuffer buf; 31 | 32 | public ByteBufferInputStream(ByteBuffer buf) { 33 | this.buf = buf; 34 | } 35 | 36 | @Override 37 | public int read() throws IOException { 38 | if (buf.hasRemaining() == false) { 39 | return -1; 40 | } 41 | return buf.get() & 0xFF; 42 | } 43 | 44 | @Override 45 | public int read(byte[] b, int off, int len) throws IOException { 46 | if (buf.hasRemaining() == false) { 47 | return -1; 48 | } 49 | int size = Math.min(len, available()); 50 | 51 | buf.get(b, off, size); 52 | return size; 53 | } 54 | 55 | @Override 56 | public int available() throws IOException { 57 | return buf.limit() - buf.position(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/AbstractElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import org.openmuc.openiec61850.SclParseException; 20 | import org.w3c.dom.NamedNodeMap; 21 | import org.w3c.dom.Node; 22 | 23 | public abstract class AbstractElement { 24 | 25 | private String name = null; 26 | private String desc = null; 27 | 28 | public AbstractElement(String name, String desc) { 29 | this.name = name; 30 | this.desc = desc; 31 | } 32 | 33 | public AbstractElement(Node xmlNode) throws SclParseException { 34 | NamedNodeMap attributes = xmlNode.getAttributes(); 35 | 36 | Node node = attributes.getNamedItem("name"); 37 | if (node == null) { 38 | throw new SclParseException("Required attribute \"name\" not found!"); 39 | } 40 | name = node.getNodeValue(); 41 | 42 | node = attributes.getNamedItem("desc"); 43 | if (node != null) { 44 | desc = node.getNodeValue(); 45 | } 46 | 47 | } 48 | 49 | public String getName() { 50 | return name; 51 | } 52 | 53 | public String getDesc() { 54 | return desc; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/EnumVal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import org.openmuc.openiec61850.SclParseException; 20 | import org.w3c.dom.NamedNodeMap; 21 | import org.w3c.dom.Node; 22 | 23 | public final class EnumVal { 24 | 25 | private final String id; 26 | private int ord; 27 | 28 | public EnumVal(String id, int ord) { 29 | this.id = id; 30 | this.ord = ord; 31 | } 32 | 33 | public EnumVal(Node xmlNode) throws SclParseException { 34 | id = xmlNode.getTextContent(); 35 | 36 | NamedNodeMap attributes = xmlNode.getAttributes(); 37 | 38 | Node node = attributes.getNamedItem("ord"); 39 | 40 | if (node == null) { 41 | throw new SclParseException("Required attribute \"ord\" not found!"); 42 | } 43 | 44 | try { 45 | ord = Integer.parseInt(node.getNodeValue()); 46 | } catch (NumberFormatException e) { 47 | throw new SclParseException("EnumVal contains invalid \"ord\" number."); 48 | } 49 | } 50 | 51 | public String getId() { 52 | return id; 53 | } 54 | 55 | public int getOrd() { 56 | return ord; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/DoType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import org.openmuc.openiec61850.SclParseException; 23 | import org.w3c.dom.Node; 24 | import org.w3c.dom.NodeList; 25 | 26 | public final class DoType extends AbstractType { 27 | 28 | // attributes not needed: cdc, iedType 29 | 30 | public List das = new ArrayList<>(); 31 | public List sdos = new ArrayList<>(); 32 | 33 | public DoType(Node xmlNode) throws SclParseException { 34 | 35 | super(xmlNode); 36 | 37 | if (xmlNode.getAttributes().getNamedItem("cdc") == null) { 38 | throw new SclParseException("Required attribute \"cdc\" not found in DOType!"); 39 | } 40 | 41 | NodeList elements = xmlNode.getChildNodes(); 42 | 43 | for (int i = 0; i < elements.getLength(); i++) { 44 | Node node = elements.item(i); 45 | if (node.getNodeName().equals("SDO")) { 46 | sdos.add(new Sdo(node)); 47 | } 48 | if (node.getNodeName().equals("DA")) { 49 | das.add(new Da(node)); 50 | } 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/ClientEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * The listener interface for receiving incoming reports and association closed events. A listener is registered through 23 | * the {@link ClientSap#associate(java.net.InetAddress, int, String, ClientEventListener) associate} method. 24 | * 25 | * @author Stefan Feuerhahn 26 | * 27 | */ 28 | public interface ClientEventListener { 29 | 30 | /** 31 | * Invoked when a new report arrives. Note that the implementation of this method needs to be thread safe as it can 32 | * be called in parallel if a new report arrives while an old one is still being processed. 33 | * 34 | * @param report 35 | * the report that arrived. 36 | */ 37 | public void newReport(Report report); 38 | 39 | /** 40 | * Invoked when an IOException occurred for the association. An IOException implies that the ClientAssociation that 41 | * feeds this listener was automatically closed and can no longer be used to receive reports. 42 | * 43 | * @param e 44 | * the exception that occured. 45 | */ 46 | public void associationClosed(IOException e); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/EntryTimeDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import javax.swing.JComponent; 20 | import javax.swing.JLabel; 21 | 22 | import org.openmuc.openiec61850.BdaEntryTime; 23 | import org.openmuc.openiec61850.BdaType; 24 | import org.openmuc.openiec61850.clientgui.BasicDataBind; 25 | 26 | public class EntryTimeDataBind extends BasicDataBind { 27 | 28 | public EntryTimeDataBind(BdaEntryTime data) { 29 | super(data, BdaType.ENTRY_TIME); 30 | } 31 | 32 | @Override 33 | protected JComponent init() { 34 | byte[] value = data.getValue(); 35 | StringBuilder sb; 36 | 37 | sb = new StringBuilder("EntryTime ["); 38 | for (int i = 0; i < value.length; i++) { 39 | sb.append(Integer.toHexString(value[i] & 0xff)); 40 | if (i != value.length - 1) { 41 | sb.append(", "); 42 | } 43 | } 44 | sb.append("]"); 45 | return new JLabel(sb.toString()); 46 | } 47 | 48 | @Override 49 | protected void resetImpl() { 50 | // ignore for now 51 | } 52 | 53 | @Override 54 | protected void writeImpl() { 55 | // ignore for now 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/OctetStringDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import javax.swing.JComponent; 20 | import javax.swing.JLabel; 21 | 22 | import org.openmuc.openiec61850.BdaOctetString; 23 | import org.openmuc.openiec61850.BdaType; 24 | import org.openmuc.openiec61850.clientgui.BasicDataBind; 25 | 26 | public class OctetStringDataBind extends BasicDataBind { 27 | 28 | public OctetStringDataBind(BdaOctetString data) { 29 | super(data, BdaType.OCTET_STRING); 30 | } 31 | 32 | @Override 33 | protected JComponent init() { 34 | byte[] value = data.getValue(); 35 | StringBuilder sb; 36 | 37 | sb = new StringBuilder("OctetString ["); 38 | for (int i = 0; i < value.length; i++) { 39 | sb.append(Integer.toHexString(value[i] & 0xff)); 40 | if (i != value.length - 1) { 41 | sb.append(", "); 42 | } 43 | } 44 | sb.append("]"); 45 | return new JLabel(sb.toString()); 46 | } 47 | 48 | @Override 49 | protected void resetImpl() { 50 | // ignore for now 51 | } 52 | 53 | @Override 54 | protected void writeImpl() { 55 | // ignore for now 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/EnumType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import org.openmuc.openiec61850.SclParseException; 23 | import org.w3c.dom.Node; 24 | import org.w3c.dom.NodeList; 25 | 26 | public final class EnumType extends AbstractType { 27 | 28 | public List values; 29 | public int max = 0; 30 | public int min = 0; 31 | 32 | public EnumType(Node xmlNode) throws SclParseException { 33 | super(xmlNode); 34 | 35 | NodeList elements = xmlNode.getChildNodes(); 36 | 37 | values = new ArrayList<>(); 38 | 39 | for (int i = 0; i < elements.getLength(); i++) { 40 | Node node = elements.item(i); 41 | 42 | if (node.getNodeName().equals("EnumVal")) { 43 | EnumVal val = new EnumVal(node); 44 | if (val.getOrd() < min) { 45 | min = val.getOrd(); 46 | } 47 | else if (val.getOrd() > max) { 48 | max = val.getOrd(); 49 | } 50 | values.add(val); 51 | } 52 | } 53 | 54 | } 55 | 56 | public List getValues() { 57 | return values; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/Fc.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | public enum Fc { 20 | 21 | // The following FCs are not part of this enum because they are not really 22 | // FCs and only defined in part 8-1: 23 | // RP (report), LG (log), BR (buffered report), GO, GS, MS, US 24 | 25 | // FCs according to IEC 61850-7-2: 26 | /** Status information */ 27 | ST, 28 | /** Measurands - analogue values */ 29 | MX, 30 | /** Setpoint */ 31 | SP, 32 | /** Substitution */ 33 | SV, 34 | /** Configuration */ 35 | CF, 36 | /** Description */ 37 | DC, 38 | /** Setting group */ 39 | SG, 40 | /** Setting group editable */ 41 | SE, 42 | /** Service response / Service tracking */ 43 | SR, 44 | /** Operate received */ 45 | OR, 46 | /** Blocking */ 47 | BL, 48 | /** Extended definition */ 49 | EX, 50 | /** Control, deprecated but kept here for backward compatibility */ 51 | CO, 52 | /** Unbuffered Reporting */ 53 | RP, 54 | /** Buffered Reporting */ 55 | BR; 56 | 57 | /* 58 | * * @param fc 59 | * 60 | * @return 61 | */ 62 | 63 | public static Fc fromString(String fc) { 64 | try { 65 | return Fc.valueOf(fc); 66 | } catch (Exception e) { 67 | return null; 68 | } 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/DataObjectTreeCellRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui; 18 | 19 | import java.awt.Component; 20 | 21 | import javax.swing.JTree; 22 | import javax.swing.tree.DefaultTreeCellRenderer; 23 | 24 | import org.openmuc.openiec61850.BasicDataAttribute; 25 | import org.openmuc.openiec61850.FcModelNode; 26 | 27 | public class DataObjectTreeCellRenderer extends DefaultTreeCellRenderer { 28 | 29 | private static final long serialVersionUID = 1682378972258556129L; 30 | 31 | @Override 32 | public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, 33 | int row, boolean hasFocus) { 34 | super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); 35 | 36 | if (value instanceof DataObjectTreeNode) { 37 | DataObjectTreeNode treeNode = (DataObjectTreeNode) value; 38 | if (!leaf && treeNode.getNode() instanceof FcModelNode) { 39 | setIcon(getLeafIcon()); 40 | } 41 | 42 | if (treeNode.getNode() instanceof BasicDataAttribute) { 43 | BasicDataAttribute attribute = (BasicDataAttribute) treeNode.getNode(); 44 | String tooltip = attribute.getSAddr(); 45 | setToolTipText(tooltip); 46 | } 47 | } 48 | 49 | return this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/Brcb.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | public class Brcb extends Rcb { 23 | 24 | public Brcb(ObjectReference objectReference, List children) { 25 | super(objectReference, Fc.BR, children); 26 | } 27 | 28 | public BdaBoolean getPurgeBuf() { 29 | return (BdaBoolean) children.get("PurgeBuf"); 30 | } 31 | 32 | public BdaOctetString getEntryId() { 33 | return (BdaOctetString) children.get("EntryID"); 34 | } 35 | 36 | public BdaEntryTime getTimeOfEntry() { 37 | return (BdaEntryTime) children.get("TimeOfEntry"); 38 | } 39 | 40 | /** 41 | * Gets the ResvTms attribute. This attribute is optional. Will return NULL if the attribute is not available. 42 | * 43 | * @return the ResvTms attribute, null if not available. 44 | */ 45 | public BdaInt16 getResvTms() { 46 | return (BdaInt16) children.get("ResvTms"); 47 | } 48 | 49 | @Override 50 | public FcDataObject copy() { 51 | List childCopies = new ArrayList<>(children.size()); 52 | for (ModelNode childNode : children.values()) { 53 | childCopies.add((FcModelNode) childNode.copy()); 54 | } 55 | Brcb brcb = new Brcb(objectReference, childCopies); 56 | brcb.dataSet = dataSet; 57 | return brcb; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/BasicDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui; 18 | 19 | import javax.swing.JComponent; 20 | import javax.swing.JLabel; 21 | 22 | import org.openmuc.openiec61850.BasicDataAttribute; 23 | import org.openmuc.openiec61850.BdaType; 24 | 25 | public abstract class BasicDataBind { 26 | protected final E data; 27 | 28 | private JComponent valueField; 29 | 30 | public BasicDataBind(E data, BdaType type) { 31 | if (data.getBasicType() != type) { 32 | throw new IllegalArgumentException(data.getName() + " is no " + type); 33 | } 34 | this.data = data; 35 | } 36 | 37 | public JLabel getNameLabel() { 38 | return new JLabel(data.getName()); 39 | } 40 | 41 | public JComponent getValueField() { 42 | if (valueField == null) { 43 | valueField = init(); 44 | } 45 | 46 | return valueField; 47 | } 48 | 49 | public void reset() { 50 | if (valueField == null) { 51 | valueField = init(); 52 | } 53 | 54 | resetImpl(); 55 | } 56 | 57 | public void write() { 58 | if (valueField == null) { 59 | valueField = init(); 60 | } 61 | 62 | writeImpl(); 63 | } 64 | 65 | protected abstract JComponent init(); 66 | 67 | protected abstract void resetImpl(); 68 | 69 | protected abstract void writeImpl(); 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/CliParameterBuilder.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | import java.util.List; 4 | 5 | public class CliParameterBuilder { 6 | 7 | final String name; 8 | String description; 9 | boolean optional = true; 10 | 11 | public CliParameterBuilder(String name) { 12 | this.name = name; 13 | } 14 | 15 | public CliParameterBuilder setDescription(String description) { 16 | this.description = description; 17 | return this; 18 | } 19 | 20 | public CliParameterBuilder setMandatory() { 21 | optional = false; 22 | return this; 23 | } 24 | 25 | public LongCliParameter buildLongParameter(String parameterName, long defaultValue) { 26 | return new LongCliParameter(this, parameterName, defaultValue); 27 | } 28 | 29 | public LongCliParameter buildLongParameter(String parameterName) { 30 | return new LongCliParameter(this, parameterName); 31 | } 32 | 33 | public IntCliParameter buildIntParameter(String parameterName, int defaultValue) { 34 | return new IntCliParameter(this, parameterName, defaultValue); 35 | } 36 | 37 | public IntCliParameter buildIntParameter(String parameterName) { 38 | return new IntCliParameter(this, parameterName); 39 | } 40 | 41 | public StringCliParameter buildStringParameter(String parameterName, String defaultValue) { 42 | return new StringCliParameter(this, parameterName, defaultValue); 43 | } 44 | 45 | public StringCliParameter buildStringParameter(String parameterName) { 46 | return new StringCliParameter(this, parameterName); 47 | } 48 | 49 | public StringListCliParameter buildStringListParameter(String parameterName) { 50 | return new StringListCliParameter(this, parameterName); 51 | } 52 | 53 | public StringListCliParameter buildStringListParameter(String parameterName, List defaultValue) { 54 | return new StringListCliParameter(this, parameterName, defaultValue); 55 | } 56 | 57 | public FlagCliParameter buildFlagParameter() { 58 | return new FlagCliParameter(this); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/CheckDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import java.awt.Component; 20 | 21 | import javax.swing.BoxLayout; 22 | import javax.swing.JCheckBox; 23 | import javax.swing.JComponent; 24 | import javax.swing.JPanel; 25 | 26 | import org.openmuc.openiec61850.BdaCheck; 27 | import org.openmuc.openiec61850.BdaType; 28 | import org.openmuc.openiec61850.clientgui.BasicDataBind; 29 | 30 | public class CheckDataBind extends BasicDataBind { 31 | 32 | private final JCheckBox interlock = new JCheckBox("Interlock"); 33 | private final JCheckBox synchron = new JCheckBox("Synchron"); 34 | 35 | public CheckDataBind(BdaCheck data) { 36 | super(data, BdaType.CHECK); 37 | } 38 | 39 | @Override 40 | protected JComponent init() { 41 | interlock.setAlignmentX(Component.LEFT_ALIGNMENT); 42 | JPanel valuePanel = new JPanel(); 43 | valuePanel.setLayout(new BoxLayout(valuePanel, BoxLayout.PAGE_AXIS)); 44 | valuePanel.add(interlock); 45 | valuePanel.add(synchron); 46 | return valuePanel; 47 | } 48 | 49 | @Override 50 | protected void resetImpl() { 51 | interlock.setSelected(data.getInterlockCheck()); 52 | synchron.setSelected(data.getSynchrocheck()); 53 | } 54 | 55 | @Override 56 | protected void writeImpl() { 57 | data.setInterlockCheck(interlock.isSelected()); 58 | data.setSynchrocheck(synchron.isSelected()); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/cli/StringListCliParameter.java: -------------------------------------------------------------------------------- 1 | package org.openmuc.openiec61850.internal.cli; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class StringListCliParameter extends ValueCliParameter { 7 | 8 | List value; 9 | private List defaultValue = null; 10 | 11 | StringListCliParameter(CliParameterBuilder builder, String parameterName, List defaultValue) { 12 | super(builder, parameterName); 13 | this.defaultValue = defaultValue; 14 | value = defaultValue; 15 | } 16 | 17 | StringListCliParameter(CliParameterBuilder builder, String parameterName) { 18 | super(builder, parameterName); 19 | } 20 | 21 | public List getValue() { 22 | return value; 23 | } 24 | 25 | @Override 26 | int parse(String[] args, int i) throws CliParseException { 27 | selected = true; 28 | 29 | value = new ArrayList<>(); 30 | i++; 31 | while (i < args.length) { 32 | if (args[i].length() > 0 && args[i].startsWith("-")) { 33 | break; 34 | } 35 | value.add(args[i++]); 36 | } 37 | 38 | if (value.size() == 0) { 39 | throw new CliParseException("Parameter " + name + " has no value."); 40 | } 41 | 42 | return value.size() + 1; 43 | } 44 | 45 | @Override 46 | int appendSynopsis(StringBuilder sb) { 47 | int length = 0; 48 | if (optional) { 49 | sb.append("["); 50 | length++; 51 | } 52 | sb.append(name).append(" <").append(parameterName).append(">..."); 53 | length += (name.length() + 6 + parameterName.length()); 54 | if (optional) { 55 | sb.append("]"); 56 | length++; 57 | } 58 | return length; 59 | } 60 | 61 | @Override 62 | public void appendDescription(StringBuilder sb) { 63 | sb.append("\t").append(name).append(" <").append(parameterName).append(">...\n\t ").append(description); 64 | if (defaultValue != null) { 65 | sb.append(" Default is \""); 66 | for (String stringValue : defaultValue) { 67 | sb.append(stringValue); 68 | } 69 | sb.append("\"."); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/UnicodeStringDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import java.nio.CharBuffer; 20 | import java.nio.charset.CharacterCodingException; 21 | import java.nio.charset.Charset; 22 | import java.nio.charset.CharsetEncoder; 23 | 24 | import org.openmuc.openiec61850.BdaType; 25 | import org.openmuc.openiec61850.BdaUnicodeString; 26 | 27 | public class UnicodeStringDataBind extends TextFieldDataBind { 28 | 29 | private static final Charset UTF8 = Charset.forName("UTF-8"); 30 | 31 | public UnicodeStringDataBind(BdaUnicodeString data) { 32 | super(data, BdaType.UNICODE_STRING, new Utf8Filter(data.getMaxLength())); 33 | } 34 | 35 | @Override 36 | protected void resetImpl() { 37 | inputField.setText(new String(data.getValue(), UTF8)); 38 | } 39 | 40 | @Override 41 | protected void writeImpl() { 42 | data.setValue(UTF8.encode(inputField.getText()).array()); 43 | } 44 | 45 | private static class Utf8Filter extends AbstractFilter { 46 | private final CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder(); 47 | private final int maxBytes; 48 | 49 | public Utf8Filter(int maxBytes) { 50 | this.maxBytes = maxBytes; 51 | } 52 | 53 | @Override 54 | protected boolean test(String text) { 55 | try { 56 | byte[] codedString = encoder.encode(CharBuffer.wrap(text)).array(); 57 | return codedString.length <= maxBytes; 58 | } catch (CharacterCodingException e) { 59 | return false; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/VisibleStringDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import java.nio.CharBuffer; 20 | import java.nio.charset.CharacterCodingException; 21 | import java.nio.charset.Charset; 22 | import java.nio.charset.CharsetEncoder; 23 | 24 | import org.openmuc.openiec61850.BdaType; 25 | import org.openmuc.openiec61850.BdaVisibleString; 26 | 27 | public class VisibleStringDataBind extends TextFieldDataBind { 28 | 29 | private static final Charset ASCII = Charset.forName("US-ASCII"); 30 | 31 | public VisibleStringDataBind(BdaVisibleString data) { 32 | super(data, BdaType.VISIBLE_STRING, new AsciiFilter(data.getMaxLength())); 33 | } 34 | 35 | @Override 36 | protected void resetImpl() { 37 | inputField.setText(new String(data.getValue(), ASCII)); 38 | } 39 | 40 | @Override 41 | protected void writeImpl() { 42 | data.setValue(ASCII.encode(inputField.getText()).array()); 43 | } 44 | 45 | private static class AsciiFilter extends TextFieldDataBind.AbstractFilter { 46 | private final CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder(); 47 | private final int maxBytes; 48 | 49 | public AsciiFilter(int maxBytes) { 50 | this.maxBytes = maxBytes; 51 | } 52 | 53 | @Override 54 | protected boolean test(String text) { 55 | try { 56 | byte[] codedString = encoder.encode(CharBuffer.wrap(text)).array(); 57 | return codedString.length <= maxBytes; 58 | } catch (CharacterCodingException e) { 59 | return false; 60 | } 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | /** 20 | * 21 | * Check packed list according to 61850-7-2 22 | * 23 | */ 24 | public final class BdaCheck extends BdaBitString { 25 | 26 | public BdaCheck(ObjectReference objectReference) { 27 | super(objectReference, Fc.CO, null, 2, false, false); 28 | basicType = BdaType.CHECK; 29 | setDefault(); 30 | } 31 | 32 | public boolean getSynchrocheck() { 33 | return ((value[0] & 0x80) == 0x80); 34 | } 35 | 36 | public boolean getInterlockCheck() { 37 | return ((value[0] & 0x40) == 0x40); 38 | } 39 | 40 | public void setSynchrocheck(boolean synchrocheck) { 41 | if (synchrocheck) { 42 | value[0] = (byte) (value[0] | 0x80); 43 | } 44 | else { 45 | value[0] = (byte) (value[0] & 0x7f); 46 | } 47 | } 48 | 49 | public void setInterlockCheck(boolean interlockCheck) { 50 | if (interlockCheck) { 51 | value[0] = (byte) (value[0] | 0x40); 52 | } 53 | else { 54 | value[0] = (byte) (value[0] & 0xbf); 55 | } 56 | } 57 | 58 | @Override 59 | public BdaCheck copy() { 60 | BdaCheck copy = new BdaCheck(objectReference); 61 | 62 | byte[] valueCopy = new byte[value.length]; 63 | System.arraycopy(value, 0, valueCopy, 0, value.length); 64 | copy.setValue(valueCopy); 65 | if (mirror == null) { 66 | copy.mirror = this; 67 | } 68 | else { 69 | copy.mirror = mirror; 70 | } 71 | return copy; 72 | } 73 | 74 | @Override 75 | public String toString() { 76 | return getReference().toString() + ": " + String.format("0x%x", value[0]); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/ReportEntryData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | public class ReportEntryData { 20 | 21 | public static enum ReasonCode { 22 | DCHG, 23 | QCHG, 24 | DUPD, 25 | INTEGRITY, 26 | GI, 27 | APPTRIGGER 28 | }; 29 | 30 | /** 31 | * Not specified in IEC61850 but useful for data persistence 32 | */ 33 | private long id; 34 | /** 35 | * Reference to to {@link DataSet}-member 36 | */ 37 | private String dataRef; 38 | /** 39 | * Attribute value to be reported 40 | */ 41 | private ModelNode value; 42 | /** 43 | * Trigger that caused the data to be put into the report 44 | */ 45 | // private TriggerConditions reasonCode; 46 | private ReasonCode reasonCode; 47 | /** 48 | * Backreference to report 49 | */ 50 | private Report report; 51 | 52 | public String getDataRef() { 53 | return dataRef; 54 | } 55 | 56 | public void setDataRef(String dataRef) { 57 | this.dataRef = dataRef; 58 | } 59 | 60 | public ModelNode getValue() { 61 | return value; 62 | } 63 | 64 | public void setValue(ModelNode value) { 65 | this.value = value; 66 | } 67 | 68 | public ReasonCode getReasonCode() { 69 | return reasonCode; 70 | } 71 | 72 | public void setReasonCode(ReasonCode reasonCode) { 73 | this.reasonCode = reasonCode; 74 | } 75 | 76 | public long getId() { 77 | return id; 78 | } 79 | 80 | public void setId(long id) { 81 | this.id = id; 82 | } 83 | 84 | public Report getReport() { 85 | return report; 86 | } 87 | 88 | public void setReport(Report report) { 89 | this.report = report; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/Da.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import org.openmuc.openiec61850.Fc; 20 | import org.openmuc.openiec61850.SclParseException; 21 | import org.w3c.dom.NamedNodeMap; 22 | import org.w3c.dom.Node; 23 | 24 | public final class Da extends AbstractDataAttribute { 25 | 26 | private Fc fc = null; 27 | private boolean dchg = false; 28 | private boolean qchg = false; 29 | private boolean dupd = false; 30 | 31 | public Da(Node xmlNode) throws SclParseException { 32 | 33 | super(xmlNode); 34 | 35 | NamedNodeMap attributes = xmlNode.getAttributes(); 36 | 37 | for (int i = 0; i < attributes.getLength(); i++) { 38 | Node node = attributes.item(i); 39 | String nodeName = node.getNodeName(); 40 | 41 | if (nodeName.equals("fc")) { 42 | fc = Fc.fromString(node.getNodeValue()); 43 | if (fc == null) { 44 | throw new SclParseException("Invalid Functional Constraint"); 45 | } 46 | } 47 | else if (nodeName.equals("dchg")) { 48 | dchg = "true".equals(node.getNodeValue()); 49 | } 50 | else if (nodeName.equals("qchg")) { 51 | qchg = "true".equals(node.getNodeValue()); 52 | } 53 | else if (nodeName.equals("dupd")) { 54 | dupd = "true".equals(node.getNodeValue()); 55 | } 56 | } 57 | 58 | if (fc == null) { 59 | throw new SclParseException("Required attribute \"fc\" not found!"); 60 | } 61 | 62 | } 63 | 64 | public Fc getFc() { 65 | return fc; 66 | } 67 | 68 | public boolean isDchg() { 69 | return dchg; 70 | } 71 | 72 | public boolean isQchg() { 73 | return qchg; 74 | } 75 | 76 | public boolean isDupd() { 77 | return dupd; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/TypeDefinitions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import java.util.ArrayList; 20 | 21 | public final class TypeDefinitions { 22 | 23 | private final ArrayList lnodeTypes = new ArrayList<>(); 24 | private final ArrayList doTypes = new ArrayList<>(); 25 | private final ArrayList daTypes = new ArrayList<>(); 26 | private final ArrayList enumTypes = new ArrayList<>(); 27 | 28 | public TypeDefinitions() { 29 | } 30 | 31 | public void putLNodeType(LnType lnodeType) { 32 | lnodeTypes.add(lnodeType); 33 | } 34 | 35 | public void putDOType(DoType doType) { 36 | doTypes.add(doType); 37 | } 38 | 39 | public void putDAType(DaType daType) { 40 | daTypes.add(daType); 41 | } 42 | 43 | public void putEnumType(EnumType enumType) { 44 | enumTypes.add(enumType); 45 | } 46 | 47 | public DaType getDaType(String daType) { 48 | for (DaType datype : daTypes) { 49 | if (datype.id.equals(daType)) { 50 | return datype; 51 | } 52 | } 53 | 54 | return null; 55 | } 56 | 57 | public DoType getDOType(String doType) { 58 | for (DoType dotype : doTypes) { 59 | if (dotype.id.equals(doType)) { 60 | return dotype; 61 | } 62 | } 63 | 64 | return null; 65 | } 66 | 67 | public LnType getLNodeType(String lnType) { 68 | 69 | for (LnType ntype : lnodeTypes) { 70 | if (ntype.id.equals(lnType)) { 71 | return ntype; 72 | } 73 | } 74 | 75 | return null; 76 | } 77 | 78 | public EnumType getEnumType(String enumTypeRef) { 79 | for (EnumType enumType : enumTypes) { 80 | if (enumType.id.equals(enumTypeRef)) { 81 | return enumType; 82 | } 83 | } 84 | 85 | return null; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/DataSetTreeNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui; 18 | 19 | import java.io.IOException; 20 | 21 | import javax.swing.tree.DefaultMutableTreeNode; 22 | 23 | import org.openmuc.openiec61850.ClientAssociation; 24 | import org.openmuc.openiec61850.DataSet; 25 | import org.openmuc.openiec61850.ServiceError; 26 | 27 | public class DataSetTreeNode extends DefaultMutableTreeNode implements DataTreeNode { 28 | 29 | private static final long serialVersionUID = 7919716359809465616L; 30 | 31 | private final DataSet node; 32 | 33 | public DataSetTreeNode(String name, DataSet node) { 34 | super(name); 35 | this.node = node; 36 | } 37 | 38 | public DataSet getNode() { 39 | return node; 40 | } 41 | 42 | @Override 43 | public void reset(ClientAssociation association) throws ServiceError, IOException { 44 | if (association != null) { 45 | association.getDataSetValues(node); 46 | } 47 | for (int i = 0; i < getChildCount(); i++) { 48 | if (getChildAt(i) instanceof DataObjectTreeNode) { 49 | DataTreeNode child = (DataTreeNode) getChildAt(i); 50 | child.reset(null); 51 | } 52 | } 53 | } 54 | 55 | @Override 56 | public void writeValues(ClientAssociation association) throws ServiceError, IOException { 57 | for (int i = 0; i < getChildCount(); i++) { 58 | if (getChildAt(i) instanceof DataObjectTreeNode) { 59 | DataTreeNode child = (DataTreeNode) getChildAt(i); 60 | child.writeValues(null); 61 | } 62 | } 63 | if (association != null) { 64 | association.setDataSetValues(node); 65 | } 66 | } 67 | 68 | @Override 69 | public BasicDataBind getData() { 70 | return null; 71 | } 72 | 73 | @Override 74 | public boolean writable() { 75 | return true; 76 | } 77 | 78 | @Override 79 | public boolean readable() { 80 | return true; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaInt16.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import org.openmuc.jasn1.ber.types.BerInteger; 20 | import org.openmuc.openiec61850.internal.mms.asn1.Data; 21 | import org.openmuc.openiec61850.internal.mms.asn1.TypeDescription; 22 | import org.openmuc.openiec61850.internal.mms.asn1.Unsigned8; 23 | 24 | public final class BdaInt16 extends BasicDataAttribute { 25 | 26 | private short value; 27 | 28 | public BdaInt16(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 29 | super(objectReference, fc, sAddr, dchg, dupd); 30 | basicType = BdaType.INT16; 31 | setDefault(); 32 | } 33 | 34 | public void setValue(short value) { 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public void setValueFrom(BasicDataAttribute bda) { 40 | value = ((BdaInt16) bda).getValue(); 41 | } 42 | 43 | public short getValue() { 44 | return value; 45 | } 46 | 47 | @Override 48 | public void setDefault() { 49 | value = 0; 50 | } 51 | 52 | @Override 53 | public BdaInt16 copy() { 54 | BdaInt16 copy = new BdaInt16(objectReference, fc, sAddr, dchg, dupd); 55 | copy.setValue(value); 56 | if (mirror == null) { 57 | copy.mirror = this; 58 | } 59 | else { 60 | copy.mirror = mirror; 61 | } 62 | return copy; 63 | } 64 | 65 | @Override 66 | Data getMmsDataObj() { 67 | Data data = new Data(); 68 | data.setInteger(new BerInteger(value)); 69 | return data; 70 | } 71 | 72 | @Override 73 | void setValueFromMmsDataObj(Data data) throws ServiceError { 74 | if (data.getInteger() == null) { 75 | throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: integer"); 76 | } 77 | value = data.getInteger().value.shortValue(); 78 | } 79 | 80 | @Override 81 | TypeDescription getMmsTypeSpec() { 82 | TypeDescription typeDescription = new TypeDescription(); 83 | typeDescription.setInteger(new Unsigned8(16)); 84 | return typeDescription; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return getReference().toString() + ": " + value; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaInt64.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import org.openmuc.jasn1.ber.types.BerInteger; 20 | import org.openmuc.openiec61850.internal.mms.asn1.Data; 21 | import org.openmuc.openiec61850.internal.mms.asn1.TypeDescription; 22 | import org.openmuc.openiec61850.internal.mms.asn1.Unsigned8; 23 | 24 | public final class BdaInt64 extends BasicDataAttribute { 25 | 26 | private long value; 27 | 28 | public BdaInt64(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 29 | super(objectReference, fc, sAddr, dchg, dupd); 30 | basicType = BdaType.INT64; 31 | setDefault(); 32 | } 33 | 34 | public void setValue(long value) { 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public void setValueFrom(BasicDataAttribute bda) { 40 | value = ((BdaInt64) bda).getValue(); 41 | } 42 | 43 | public long getValue() { 44 | return value; 45 | } 46 | 47 | @Override 48 | public void setDefault() { 49 | value = 0; 50 | } 51 | 52 | @Override 53 | public BdaInt64 copy() { 54 | BdaInt64 copy = new BdaInt64(objectReference, fc, sAddr, dchg, dupd); 55 | copy.setValue(value); 56 | if (mirror == null) { 57 | copy.mirror = this; 58 | } 59 | else { 60 | copy.mirror = mirror; 61 | } 62 | return copy; 63 | } 64 | 65 | @Override 66 | Data getMmsDataObj() { 67 | Data data = new Data(); 68 | data.setInteger(new BerInteger(value)); 69 | return data; 70 | } 71 | 72 | @Override 73 | void setValueFromMmsDataObj(Data data) throws ServiceError { 74 | if (data.getInteger() == null) { 75 | throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: integer"); 76 | } 77 | value = data.getInteger().value.longValue(); 78 | } 79 | 80 | @Override 81 | TypeDescription getMmsTypeSpec() { 82 | TypeDescription typeDescription = new TypeDescription(); 83 | typeDescription.setInteger(new Unsigned8(64)); 84 | return typeDescription; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return getReference().toString() + ": " + value; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaInt16U.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import org.openmuc.jasn1.ber.types.BerInteger; 20 | import org.openmuc.openiec61850.internal.mms.asn1.Data; 21 | import org.openmuc.openiec61850.internal.mms.asn1.TypeDescription; 22 | import org.openmuc.openiec61850.internal.mms.asn1.Unsigned8; 23 | 24 | public final class BdaInt16U extends BasicDataAttribute { 25 | 26 | private int value; 27 | 28 | public BdaInt16U(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 29 | super(objectReference, fc, sAddr, dchg, dupd); 30 | basicType = BdaType.INT16U; 31 | setDefault(); 32 | } 33 | 34 | public void setValue(int value) { 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public void setValueFrom(BasicDataAttribute bda) { 40 | value = ((BdaInt16U) bda).getValue(); 41 | } 42 | 43 | public int getValue() { 44 | return value; 45 | } 46 | 47 | @Override 48 | public void setDefault() { 49 | value = 0; 50 | } 51 | 52 | @Override 53 | public BdaInt16U copy() { 54 | BdaInt16U copy = new BdaInt16U(objectReference, fc, sAddr, dchg, dupd); 55 | copy.setValue(value); 56 | if (mirror == null) { 57 | copy.mirror = this; 58 | } 59 | else { 60 | copy.mirror = mirror; 61 | } 62 | return copy; 63 | } 64 | 65 | @Override 66 | Data getMmsDataObj() { 67 | Data data = new Data(); 68 | data.setUnsigned(new BerInteger(value)); 69 | return data; 70 | } 71 | 72 | @Override 73 | void setValueFromMmsDataObj(Data data) throws ServiceError { 74 | if (data.getUnsigned() == null) { 75 | throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: unsigned"); 76 | } 77 | value = data.getUnsigned().value.intValue(); 78 | } 79 | 80 | @Override 81 | TypeDescription getMmsTypeSpec() { 82 | TypeDescription typeDescription = new TypeDescription(); 83 | typeDescription.setUnsigned(new Unsigned8(16)); 84 | return typeDescription; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return getReference().toString() + ": " + value; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaInt8U.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import org.openmuc.jasn1.ber.types.BerInteger; 20 | import org.openmuc.openiec61850.internal.mms.asn1.Data; 21 | import org.openmuc.openiec61850.internal.mms.asn1.TypeDescription; 22 | import org.openmuc.openiec61850.internal.mms.asn1.Unsigned8; 23 | 24 | public final class BdaInt8U extends BasicDataAttribute { 25 | 26 | private short value; 27 | 28 | public BdaInt8U(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 29 | super(objectReference, fc, sAddr, dchg, dupd); 30 | basicType = BdaType.INT8U; 31 | setDefault(); 32 | } 33 | 34 | public void setValue(short value) { 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public void setValueFrom(BasicDataAttribute bda) { 40 | value = ((BdaInt8U) bda).getValue(); 41 | } 42 | 43 | public short getValue() { 44 | return value; 45 | } 46 | 47 | @Override 48 | public void setDefault() { 49 | value = 0; 50 | } 51 | 52 | @Override 53 | public BdaInt8U copy() { 54 | BdaInt8U copy = new BdaInt8U(objectReference, fc, sAddr, dchg, dupd); 55 | copy.setValue(value); 56 | if (mirror == null) { 57 | copy.mirror = this; 58 | } 59 | else { 60 | copy.mirror = mirror; 61 | } 62 | return copy; 63 | } 64 | 65 | @Override 66 | Data getMmsDataObj() { 67 | Data data = new Data(); 68 | data.setUnsigned(new BerInteger(value)); 69 | return data; 70 | } 71 | 72 | @Override 73 | void setValueFromMmsDataObj(Data data) throws ServiceError { 74 | if (data.getUnsigned() == null) { 75 | throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: unsigned"); 76 | } 77 | value = data.getUnsigned().value.shortValue(); 78 | } 79 | 80 | @Override 81 | TypeDescription getMmsTypeSpec() { 82 | TypeDescription typeDescription = new TypeDescription(); 83 | typeDescription.setUnsigned(new Unsigned8(8)); 84 | return typeDescription; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return getReference().toString() + ": " + value; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/TriggerConditionDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import java.awt.Component; 20 | 21 | import javax.swing.BoxLayout; 22 | import javax.swing.JCheckBox; 23 | import javax.swing.JComponent; 24 | import javax.swing.JPanel; 25 | 26 | import org.openmuc.openiec61850.BdaTriggerConditions; 27 | import org.openmuc.openiec61850.BdaType; 28 | import org.openmuc.openiec61850.clientgui.BasicDataBind; 29 | 30 | public class TriggerConditionDataBind extends BasicDataBind { 31 | 32 | private final JCheckBox dataChange = new JCheckBox("DataChange"); 33 | private final JCheckBox dataUpdate = new JCheckBox("DataUpdate"); 34 | private final JCheckBox generalInterrogation = new JCheckBox("GeneralInterrogation"); 35 | private final JCheckBox integrity = new JCheckBox("Integrity"); 36 | private final JCheckBox qualityChange = new JCheckBox("QualityChange"); 37 | 38 | public TriggerConditionDataBind(BdaTriggerConditions data) { 39 | super(data, BdaType.TRIGGER_CONDITIONS); 40 | } 41 | 42 | @Override 43 | protected JComponent init() { 44 | dataChange.setAlignmentX(Component.LEFT_ALIGNMENT); 45 | JPanel valuePanel = new JPanel(); 46 | valuePanel.setLayout(new BoxLayout(valuePanel, BoxLayout.PAGE_AXIS)); 47 | valuePanel.add(dataChange); 48 | valuePanel.add(dataUpdate); 49 | valuePanel.add(generalInterrogation); 50 | valuePanel.add(integrity); 51 | valuePanel.add(qualityChange); 52 | return valuePanel; 53 | } 54 | 55 | @Override 56 | protected void resetImpl() { 57 | dataChange.setSelected(data.isDataChange()); 58 | dataUpdate.setSelected(data.isDataUpdate()); 59 | generalInterrogation.setSelected(data.isGeneralInterrogation()); 60 | integrity.setSelected(data.isIntegrity()); 61 | qualityChange.setSelected(data.isQualityChange()); 62 | } 63 | 64 | @Override 65 | protected void writeImpl() { 66 | data.setDataChange(dataChange.isSelected()); 67 | data.setDataUpdate(dataUpdate.isSelected()); 68 | data.setGeneralInterrogation(generalInterrogation.isSelected()); 69 | data.setIntegrity(integrity.isSelected()); 70 | data.setQualityChange(qualityChange.isSelected()); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/internal/scl/AbstractDataAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.internal.scl; 18 | 19 | import org.openmuc.openiec61850.SclParseException; 20 | import org.w3c.dom.NamedNodeMap; 21 | import org.w3c.dom.Node; 22 | import org.w3c.dom.NodeList; 23 | 24 | public abstract class AbstractDataAttribute extends AbstractElement { 25 | 26 | // attributes not needed: valKind 27 | 28 | private String sAddr = null; /* optional - short address */ 29 | private String bType = null; /* mandatory - basic type */ 30 | 31 | private String type = null; /* conditional - if bType = "Enum" or "Struct" */ 32 | private int count = 0; /* optional - number of array elements */ 33 | public String value = null; 34 | 35 | public AbstractDataAttribute(Node xmlNode) throws SclParseException { 36 | super(xmlNode); 37 | 38 | NamedNodeMap attributes = xmlNode.getAttributes(); 39 | 40 | for (int i = 0; i < attributes.getLength(); i++) { 41 | Node node = attributes.item(i); 42 | String nodeName = node.getNodeName(); 43 | 44 | if (nodeName.equals("type")) { 45 | type = node.getNodeValue(); 46 | } 47 | else if (nodeName.equals("sAddr")) { 48 | sAddr = node.getNodeValue(); 49 | } 50 | else if (nodeName.equals("bType")) { 51 | bType = node.getNodeValue(); 52 | } 53 | else if (nodeName.equals("count")) { 54 | count = Integer.parseInt(node.getNodeValue()); 55 | } 56 | } 57 | 58 | if (bType == null) { 59 | throw new SclParseException("Required attribute \"bType\" not found!"); 60 | } 61 | 62 | NodeList elements = xmlNode.getChildNodes(); 63 | for (int i = 0; i < elements.getLength(); i++) { 64 | Node node = elements.item(i); 65 | if (node.getNodeName().equals("Val")) { 66 | value = node.getTextContent(); 67 | } 68 | } 69 | 70 | } 71 | 72 | public String getsAddr() { 73 | return sAddr; 74 | } 75 | 76 | public String getbType() { 77 | return bType; 78 | } 79 | 80 | public String getType() { 81 | return type; 82 | } 83 | 84 | public int getCount() { 85 | return count; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaBoolean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import org.openmuc.jasn1.ber.types.BerBoolean; 20 | import org.openmuc.jasn1.ber.types.BerNull; 21 | import org.openmuc.openiec61850.internal.mms.asn1.Data; 22 | import org.openmuc.openiec61850.internal.mms.asn1.TypeDescription; 23 | 24 | public final class BdaBoolean extends BasicDataAttribute { 25 | 26 | private boolean value; 27 | 28 | public BdaBoolean(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 29 | super(objectReference, fc, sAddr, dchg, dupd); 30 | basicType = BdaType.BOOLEAN; 31 | setDefault(); 32 | } 33 | 34 | public void setValue(boolean value) { 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public void setValueFrom(BasicDataAttribute bda) { 40 | value = ((BdaBoolean) bda).getValue(); 41 | } 42 | 43 | public boolean getValue() { 44 | return value; 45 | } 46 | 47 | @Override 48 | public void setDefault() { 49 | value = false; 50 | } 51 | 52 | @Override 53 | public BdaBoolean copy() { 54 | BdaBoolean copy = new BdaBoolean(objectReference, fc, sAddr, dchg, dupd); 55 | copy.setValue(value); 56 | if (mirror == null) { 57 | copy.mirror = this; 58 | } 59 | else { 60 | copy.mirror = mirror; 61 | } 62 | return copy; 63 | } 64 | 65 | @Override 66 | Data getMmsDataObj() { 67 | Data data = new Data(); 68 | data.setBool(new BerBoolean(value)); 69 | return data; 70 | } 71 | 72 | @Override 73 | void setValueFromMmsDataObj(Data data) throws ServiceError { 74 | if (data.getBool() == null) { 75 | throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: boolean"); 76 | } 77 | value = data.getBool().value; 78 | } 79 | 80 | @Override 81 | TypeDescription getMmsTypeSpec() { 82 | TypeDescription typeDescription = new TypeDescription(); 83 | typeDescription.setBool(new BerNull()); 84 | return typeDescription; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return getReference().toString() + ": " + value; 90 | } 91 | 92 | @Override 93 | public String getValueString() { 94 | return "" + value; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaInt32.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import org.openmuc.jasn1.ber.types.BerInteger; 20 | import org.openmuc.openiec61850.internal.mms.asn1.Data; 21 | import org.openmuc.openiec61850.internal.mms.asn1.TypeDescription; 22 | import org.openmuc.openiec61850.internal.mms.asn1.Unsigned8; 23 | 24 | public final class BdaInt32 extends BasicDataAttribute { 25 | 26 | private int value; 27 | 28 | public BdaInt32(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 29 | super(objectReference, fc, sAddr, dchg, dupd); 30 | basicType = BdaType.INT32; 31 | setDefault(); 32 | } 33 | 34 | public void setValue(int value) { 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public void setValueFrom(BasicDataAttribute bda) { 40 | value = ((BdaInt32) bda).getValue(); 41 | } 42 | 43 | public int getValue() { 44 | return value; 45 | } 46 | 47 | @Override 48 | public void setDefault() { 49 | value = 0; 50 | } 51 | 52 | @Override 53 | public BdaInt32 copy() { 54 | BdaInt32 copy = new BdaInt32(objectReference, fc, sAddr, dchg, dupd); 55 | copy.setValue(value); 56 | if (mirror == null) { 57 | copy.mirror = this; 58 | } 59 | else { 60 | copy.mirror = mirror; 61 | } 62 | return copy; 63 | } 64 | 65 | @Override 66 | Data getMmsDataObj() { 67 | Data data = new Data(); 68 | data.setInteger(new BerInteger(value)); 69 | return data; 70 | } 71 | 72 | @Override 73 | void setValueFromMmsDataObj(Data data) throws ServiceError { 74 | if (data.getInteger() == null) { 75 | throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: integer"); 76 | } 77 | value = data.getInteger().value.intValue(); 78 | } 79 | 80 | @Override 81 | TypeDescription getMmsTypeSpec() { 82 | TypeDescription typeDescription = new TypeDescription(); 83 | typeDescription.setInteger(new Unsigned8(32)); 84 | return typeDescription; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return getReference().toString() + ": " + value; 90 | } 91 | 92 | @Override 93 | public String getValueString() { 94 | return "" + value; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaInt8.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import org.openmuc.jasn1.ber.types.BerInteger; 20 | import org.openmuc.openiec61850.internal.mms.asn1.Data; 21 | import org.openmuc.openiec61850.internal.mms.asn1.TypeDescription; 22 | import org.openmuc.openiec61850.internal.mms.asn1.Unsigned8; 23 | 24 | public final class BdaInt8 extends BasicDataAttribute { 25 | 26 | private byte value; 27 | 28 | public BdaInt8(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 29 | super(objectReference, fc, sAddr, dchg, dupd); 30 | basicType = BdaType.INT8; 31 | setDefault(); 32 | } 33 | 34 | public void setValue(byte value) { 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public void setValueFrom(BasicDataAttribute bda) { 40 | value = ((BdaInt8) bda).getValue(); 41 | } 42 | 43 | public byte getValue() { 44 | return value; 45 | } 46 | 47 | @Override 48 | public void setDefault() { 49 | value = 0; 50 | } 51 | 52 | @Override 53 | public BdaInt8 copy() { 54 | BdaInt8 copy = new BdaInt8(objectReference, fc, sAddr, dchg, dupd); 55 | copy.setValue(value); 56 | if (mirror == null) { 57 | copy.mirror = this; 58 | } 59 | else { 60 | copy.mirror = mirror; 61 | } 62 | return copy; 63 | } 64 | 65 | @Override 66 | Data getMmsDataObj() { 67 | Data data = new Data(); 68 | data.setInteger(new BerInteger(value)); 69 | return data; 70 | } 71 | 72 | @Override 73 | void setValueFromMmsDataObj(Data data) throws ServiceError { 74 | if (data.getInteger() == null) { 75 | throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: integer"); 76 | } 77 | value = data.getInteger().value.byteValue(); 78 | } 79 | 80 | @Override 81 | TypeDescription getMmsTypeSpec() { 82 | TypeDescription typeDescription = new TypeDescription(); 83 | typeDescription.setInteger(new Unsigned8(8)); 84 | return typeDescription; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return getReference().toString() + ": " + value; 90 | } 91 | 92 | @Override 93 | public String getValueString() { 94 | return "" + value; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaInt128.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import org.openmuc.jasn1.ber.types.BerInteger; 20 | import org.openmuc.openiec61850.internal.mms.asn1.Data; 21 | import org.openmuc.openiec61850.internal.mms.asn1.TypeDescription; 22 | import org.openmuc.openiec61850.internal.mms.asn1.Unsigned8; 23 | 24 | public final class BdaInt128 extends BasicDataAttribute { 25 | 26 | private long value; 27 | 28 | public BdaInt128(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 29 | super(objectReference, fc, sAddr, dchg, dupd); 30 | basicType = BdaType.INT128; 31 | setDefault(); 32 | } 33 | 34 | public void setValue(long value) { 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public void setValueFrom(BasicDataAttribute bda) { 40 | value = ((BdaInt128) bda).getValue(); 41 | } 42 | 43 | public long getValue() { 44 | return value; 45 | } 46 | 47 | @Override 48 | public void setDefault() { 49 | value = 0; 50 | } 51 | 52 | @Override 53 | public BdaInt128 copy() { 54 | BdaInt128 copy = new BdaInt128(objectReference, fc, sAddr, dchg, dupd); 55 | copy.setValue(value); 56 | if (mirror == null) { 57 | copy.mirror = this; 58 | } 59 | else { 60 | copy.mirror = mirror; 61 | } 62 | return copy; 63 | } 64 | 65 | @Override 66 | Data getMmsDataObj() { 67 | Data data = new Data(); 68 | data.setInteger(new BerInteger(value)); 69 | return data; 70 | } 71 | 72 | @Override 73 | void setValueFromMmsDataObj(Data data) throws ServiceError { 74 | if (data.getInteger() == null) { 75 | throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: integer"); 76 | } 77 | value = data.getInteger().value.longValue(); 78 | } 79 | 80 | @Override 81 | TypeDescription getMmsTypeSpec() { 82 | TypeDescription typeDescription = new TypeDescription(); 83 | typeDescription.setInteger(new Unsigned8(128)); 84 | return typeDescription; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return getReference().toString() + ": " + value; 90 | } 91 | 92 | @Override 93 | public String getValueString() { 94 | return "" + value; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaInt32U.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | import org.openmuc.jasn1.ber.types.BerInteger; 20 | import org.openmuc.openiec61850.internal.mms.asn1.Data; 21 | import org.openmuc.openiec61850.internal.mms.asn1.TypeDescription; 22 | import org.openmuc.openiec61850.internal.mms.asn1.Unsigned8; 23 | 24 | public final class BdaInt32U extends BasicDataAttribute { 25 | 26 | private long value; 27 | 28 | public BdaInt32U(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 29 | super(objectReference, fc, sAddr, dchg, dupd); 30 | basicType = BdaType.INT32U; 31 | setDefault(); 32 | } 33 | 34 | public void setValue(long value) { 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public void setValueFrom(BasicDataAttribute bda) { 40 | value = ((BdaInt32U) bda).getValue(); 41 | } 42 | 43 | public long getValue() { 44 | return value; 45 | } 46 | 47 | @Override 48 | public void setDefault() { 49 | value = 0; 50 | } 51 | 52 | @Override 53 | public BdaInt32U copy() { 54 | BdaInt32U copy = new BdaInt32U(objectReference, fc, sAddr, dchg, dupd); 55 | copy.setValue(value); 56 | if (mirror == null) { 57 | copy.mirror = this; 58 | } 59 | else { 60 | copy.mirror = mirror; 61 | } 62 | return copy; 63 | } 64 | 65 | @Override 66 | Data getMmsDataObj() { 67 | Data data = new Data(); 68 | data.setUnsigned(new BerInteger(value)); 69 | return data; 70 | } 71 | 72 | @Override 73 | void setValueFromMmsDataObj(Data data) throws ServiceError { 74 | if (data.getUnsigned() == null) { 75 | throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: unsigned"); 76 | } 77 | value = data.getUnsigned().value.longValue(); 78 | } 79 | 80 | @Override 81 | TypeDescription getMmsTypeSpec() { 82 | TypeDescription typeDescription = new TypeDescription(); 83 | typeDescription.setUnsigned(new Unsigned8(32)); 84 | return typeDescription; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return getReference().toString() + ": " + value; 90 | } 91 | 92 | @Override 93 | public String getValueString() { 94 | return "" + value; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaTapCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | public final class BdaTapCommand extends BdaBitString { 20 | 21 | public enum TapCommand { 22 | STOP(0), 23 | LOWER(1), 24 | HIGHER(2), 25 | RESERVED(3); 26 | private final int value; 27 | 28 | private TapCommand(int value) { 29 | this.value = value; 30 | } 31 | 32 | public int getIntValue() { 33 | return value; 34 | } 35 | } 36 | 37 | public BdaTapCommand(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 38 | super(objectReference, fc, sAddr, 2, dchg, dupd); 39 | basicType = BdaType.TAP_COMMAND; 40 | setDefault(); 41 | } 42 | 43 | /** 44 | * Sets the value to TapCommand.STOP 45 | */ 46 | @Override 47 | public void setDefault() { 48 | value = new byte[] { 0x00 }; 49 | } 50 | 51 | @Override 52 | public BdaTapCommand copy() { 53 | BdaTapCommand copy = new BdaTapCommand(objectReference, fc, sAddr, dchg, dupd); 54 | byte[] valueCopy = new byte[value.length]; 55 | System.arraycopy(value, 0, valueCopy, 0, value.length); 56 | copy.setValue(valueCopy); 57 | if (mirror == null) { 58 | copy.mirror = this; 59 | } 60 | else { 61 | copy.mirror = mirror; 62 | } 63 | return copy; 64 | } 65 | 66 | public TapCommand getTapCommand() { 67 | 68 | if ((value[0] & 0xC0) == 0xC0) { 69 | return TapCommand.RESERVED; 70 | } 71 | 72 | if ((value[0] & 0x80) == 0x80) { 73 | return TapCommand.HIGHER; 74 | } 75 | 76 | if ((value[0] & 0x40) == 0x40) { 77 | return TapCommand.LOWER; 78 | } 79 | 80 | return TapCommand.STOP; 81 | 82 | } 83 | 84 | public void setTapCommand(TapCommand tapCommand) { 85 | if (tapCommand == TapCommand.RESERVED) { 86 | value[0] = (byte) 0xC0; 87 | } 88 | else if (tapCommand == TapCommand.HIGHER) { 89 | value[0] = (byte) 0x80; 90 | } 91 | else if (tapCommand == TapCommand.LOWER) { 92 | value[0] = (byte) 0x40; 93 | } 94 | else { 95 | value[0] = (byte) 0x00; 96 | } 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /configuration.gradle: -------------------------------------------------------------------------------- 1 | 2 | project.ext { 3 | 4 | cfgVersion = "1.5.1-SNAPSHOT" 5 | 6 | cfgGroup = "org.openmuc" 7 | 8 | cfgCopyDependencies = true 9 | 10 | cfgCopyToRoot = false 11 | 12 | cfgSignPom = true 13 | 14 | cfgRepository = project.properties.sonatypeRepository 15 | 16 | cfgSnapshotRepository = project.properties.sonatypeSnapshotRepository 17 | 18 | cfgRepositoryUser = project.properties.sonatypeUser 19 | 20 | cfgRepositoryPass = project.properties.sonatypePass 21 | 22 | javaProjects = allprojects 23 | 24 | distributionProjects = javaProjects 25 | 26 | docProjects = javaProjects 27 | 28 | repositoryProjects = javaProjects 29 | } 30 | 31 | tasks.withType(Tar) { 32 | 33 | into(project.name) { 34 | from("./") { 35 | include "build.gradle" 36 | include "configuration.gradle" 37 | include "license/**" 38 | include "doc/CHANGELOG.txt" 39 | include "run-scripts/**" 40 | include "gradle/wrapper/**" 41 | include "gradlew" 42 | include "gradlew.bat" 43 | include "build/libs-all/**" 44 | include "src/**" 45 | 46 | include "asn1/**" 47 | } 48 | 49 | if (name.equals("tar") ){ 50 | exclude "**/dependencies/**/src" 51 | } 52 | 53 | } 54 | 55 | into(project.name + "/doc/user-guide/") { 56 | from("./build/asciidoc/html5/") { 57 | include "**" 58 | } 59 | from("./build/asciidoc/pdf/") { 60 | include "*.pdf" 61 | } 62 | } 63 | 64 | into(project.name + "/doc/") { 65 | from("./build/docs/") { 66 | include "javadoc/**" 67 | } 68 | } 69 | 70 | } 71 | 72 | 73 | 74 | //------------------project specific configurations-------------------- 75 | 76 | apply plugin: "java" 77 | apply plugin: "eclipse" 78 | apply plugin: "osgi" 79 | apply plugin: "maven" 80 | apply plugin: "signing" 81 | 82 | def projectName = 'OpenIEC61850' 83 | 84 | dependencies { 85 | compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' 86 | compile group: 'org.openmuc', name: 'jasn1', version: '1.9.0' 87 | compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3' 88 | compile group: 'com.toedter', name: 'jcalendar', version: '1.4' 89 | } 90 | 91 | jar { 92 | manifest { 93 | name = projectName 94 | instruction 'Export-Package', '!*.internal.*,*' 95 | instruction 'Import-Package', 'org.openmuc.jasn1.*,javax.net,*;resolution:=optional' 96 | } 97 | } 98 | 99 | sourceSets { 100 | main { 101 | java.srcDirs = ['src/main/java', 'src/main/java-gen'] 102 | } 103 | } 104 | 105 | uploadArchives { 106 | repositories { 107 | mavenDeployer { 108 | pom.project { 109 | name projectName 110 | packaging 'jar' 111 | description 'OpenIEC61850 is a library implementing the IEC 61850 MMS communication standard (client and server).' 112 | url 'http://www.openmuc.org/' 113 | 114 | licenses { 115 | license { 116 | name 'Apache License, Version 2.0' 117 | url 'http://www.apache.org/licenses/LICENSE-2.0' 118 | distribution 'repo' 119 | } 120 | } 121 | 122 | } 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/TimeStampDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import java.awt.Dimension; 20 | import java.awt.FlowLayout; 21 | import java.util.Date; 22 | 23 | import javax.swing.Box; 24 | import javax.swing.JComponent; 25 | import javax.swing.JPanel; 26 | import javax.swing.JSpinner; 27 | import javax.swing.SpinnerDateModel; 28 | 29 | import org.openmuc.openiec61850.BdaTimestamp; 30 | import org.openmuc.openiec61850.BdaType; 31 | import org.openmuc.openiec61850.clientgui.BasicDataBind; 32 | 33 | import com.toedter.calendar.JDateChooser; 34 | 35 | public class TimeStampDataBind extends BasicDataBind { 36 | 37 | private static final Dimension DATECHOOSERDIMENSION = new Dimension(120, 20); 38 | 39 | private JDateChooser dateChooser; 40 | private JSpinner timeSpinner; 41 | 42 | public TimeStampDataBind(BdaTimestamp data) { 43 | super(data, BdaType.TIMESTAMP); 44 | } 45 | 46 | @Override 47 | protected JComponent init() { 48 | dateChooser = new JDateChooser(); 49 | dateChooser.setDateFormatString("dd-MM-yyyy"); 50 | dateChooser.setPreferredSize(DATECHOOSERDIMENSION); 51 | timeSpinner = new JSpinner(new SpinnerDateModel()); 52 | JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "HH:mm:ss"); 53 | timeSpinner.setEditor(timeEditor); 54 | 55 | Date d = data.getDate(); 56 | if (d == null) { 57 | d = new Date(0); 58 | } 59 | dateChooser.setDate(d); 60 | timeSpinner.setValue(d); 61 | 62 | JPanel dateTimePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); 63 | dateTimePanel.add(dateChooser); 64 | dateTimePanel.add(Box.createRigidArea(new Dimension(5, 0))); 65 | dateTimePanel.add(timeSpinner); 66 | return dateTimePanel; 67 | } 68 | 69 | @Override 70 | protected void resetImpl() { 71 | Date d = data.getDate(); 72 | if (d == null) { 73 | d = new Date(0); 74 | } 75 | dateChooser.setDate(d); 76 | timeSpinner.setValue(d); 77 | } 78 | 79 | @SuppressWarnings("deprecation") 80 | @Override 81 | protected void writeImpl() { 82 | Date newDate = dateChooser.getDate(); 83 | Date timeValues = (Date) timeSpinner.getValue(); 84 | newDate.setHours(timeValues.getHours()); 85 | newDate.setMinutes(timeValues.getMinutes()); 86 | newDate.setSeconds(timeValues.getSeconds()); 87 | data.setDate(newDate); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/AETitle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.io.OutputStream; 10 | import java.io.Serializable; 11 | 12 | import org.openmuc.jasn1.ber.BerTag; 13 | import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; 14 | import org.openmuc.jasn1.ber.types.BerObjectIdentifier; 15 | 16 | public class AETitle implements Serializable { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | public byte[] code = null; 21 | private AETitleForm2 aeTitleForm2 = null; 22 | 23 | public AETitle() { 24 | } 25 | 26 | public AETitle(byte[] code) { 27 | this.code = code; 28 | } 29 | 30 | public void setAeTitleForm2(AETitleForm2 aeTitleForm2) { 31 | this.aeTitleForm2 = aeTitleForm2; 32 | } 33 | 34 | public AETitleForm2 getAeTitleForm2() { 35 | return aeTitleForm2; 36 | } 37 | 38 | public int encode(OutputStream os) throws IOException { 39 | 40 | if (code != null) { 41 | for (int i = code.length - 1; i >= 0; i--) { 42 | os.write(code[i]); 43 | } 44 | return code.length; 45 | } 46 | 47 | int codeLength = 0; 48 | if (aeTitleForm2 != null) { 49 | codeLength += aeTitleForm2.encode(os, true); 50 | return codeLength; 51 | } 52 | 53 | throw new IOException("Error encoding CHOICE: No element of CHOICE was selected."); 54 | } 55 | 56 | public int decode(InputStream is) throws IOException { 57 | return decode(is, null); 58 | } 59 | 60 | public int decode(InputStream is, BerTag berTag) throws IOException { 61 | 62 | int codeLength = 0; 63 | BerTag passedTag = berTag; 64 | 65 | if (berTag == null) { 66 | berTag = new BerTag(); 67 | codeLength += berTag.decode(is); 68 | } 69 | 70 | if (berTag.equals(BerObjectIdentifier.tag)) { 71 | aeTitleForm2 = new AETitleForm2(); 72 | codeLength += aeTitleForm2.decode(is, false); 73 | return codeLength; 74 | } 75 | 76 | if (passedTag != null) { 77 | return 0; 78 | } 79 | 80 | throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); 81 | } 82 | 83 | public void encodeAndSave(int encodingSizeGuess) throws IOException { 84 | ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); 85 | encode(os); 86 | code = os.getArray(); 87 | } 88 | 89 | @Override 90 | public String toString() { 91 | StringBuilder sb = new StringBuilder(); 92 | appendAsString(sb, 0); 93 | return sb.toString(); 94 | } 95 | 96 | public void appendAsString(StringBuilder sb, int indentLevel) { 97 | 98 | if (aeTitleForm2 != null) { 99 | sb.append("aeTitleForm2: ").append(aeTitleForm2); 100 | return; 101 | } 102 | 103 | sb.append(""); 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java-gen/org/openmuc/josistack/internal/acse/asn1/APTitle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) 3 | */ 4 | 5 | package org.openmuc.josistack.internal.acse.asn1; 6 | 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.io.OutputStream; 10 | import java.io.Serializable; 11 | 12 | import org.openmuc.jasn1.ber.BerTag; 13 | import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; 14 | import org.openmuc.jasn1.ber.types.BerObjectIdentifier; 15 | 16 | public class APTitle implements Serializable { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | public byte[] code = null; 21 | private APTitleForm2 apTitleForm2 = null; 22 | 23 | public APTitle() { 24 | } 25 | 26 | public APTitle(byte[] code) { 27 | this.code = code; 28 | } 29 | 30 | public void setApTitleForm2(APTitleForm2 apTitleForm2) { 31 | this.apTitleForm2 = apTitleForm2; 32 | } 33 | 34 | public APTitleForm2 getApTitleForm2() { 35 | return apTitleForm2; 36 | } 37 | 38 | public int encode(OutputStream os) throws IOException { 39 | 40 | if (code != null) { 41 | for (int i = code.length - 1; i >= 0; i--) { 42 | os.write(code[i]); 43 | } 44 | return code.length; 45 | } 46 | 47 | int codeLength = 0; 48 | if (apTitleForm2 != null) { 49 | codeLength += apTitleForm2.encode(os, true); 50 | return codeLength; 51 | } 52 | 53 | throw new IOException("Error encoding CHOICE: No element of CHOICE was selected."); 54 | } 55 | 56 | public int decode(InputStream is) throws IOException { 57 | return decode(is, null); 58 | } 59 | 60 | public int decode(InputStream is, BerTag berTag) throws IOException { 61 | 62 | int codeLength = 0; 63 | BerTag passedTag = berTag; 64 | 65 | if (berTag == null) { 66 | berTag = new BerTag(); 67 | codeLength += berTag.decode(is); 68 | } 69 | 70 | if (berTag.equals(BerObjectIdentifier.tag)) { 71 | apTitleForm2 = new APTitleForm2(); 72 | codeLength += apTitleForm2.decode(is, false); 73 | return codeLength; 74 | } 75 | 76 | if (passedTag != null) { 77 | return 0; 78 | } 79 | 80 | throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); 81 | } 82 | 83 | public void encodeAndSave(int encodingSizeGuess) throws IOException { 84 | ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); 85 | encode(os); 86 | code = os.getArray(); 87 | } 88 | 89 | @Override 90 | public String toString() { 91 | StringBuilder sb = new StringBuilder(); 92 | appendAsString(sb, 0); 93 | return sb.toString(); 94 | } 95 | 96 | public void appendAsString(StringBuilder sb, int indentLevel) { 97 | 98 | if (apTitleForm2 != null) { 99 | sb.append("apTitleForm2: ").append(apTitleForm2); 100 | return; 101 | } 102 | 103 | sb.append(""); 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/BdaDoubleBitPos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850; 18 | 19 | public final class BdaDoubleBitPos extends BdaBitString { 20 | 21 | public enum DoubleBitPos { 22 | INTERMEDIATE_STATE(0), 23 | OFF(1), 24 | ON(2), 25 | BAD_STATE(3); 26 | private final int value; 27 | 28 | private DoubleBitPos(int value) { 29 | this.value = value; 30 | } 31 | 32 | public int getIntValue() { 33 | return value; 34 | } 35 | } 36 | 37 | public BdaDoubleBitPos(ObjectReference objectReference, Fc fc, String sAddr, boolean dchg, boolean dupd) { 38 | super(objectReference, fc, sAddr, 2, dchg, dupd); 39 | basicType = BdaType.DOUBLE_BIT_POS; 40 | setDefault(); 41 | } 42 | 43 | /** 44 | * Sets the value to DoubleBitPos.OFF 45 | */ 46 | @Override 47 | public void setDefault() { 48 | value = new byte[] { 0x40 }; 49 | } 50 | 51 | @Override 52 | public BdaDoubleBitPos copy() { 53 | BdaDoubleBitPos copy = new BdaDoubleBitPos(objectReference, fc, sAddr, dchg, dupd); 54 | byte[] valueCopy = new byte[value.length]; 55 | System.arraycopy(value, 0, valueCopy, 0, value.length); 56 | copy.setValue(valueCopy); 57 | if (mirror == null) { 58 | copy.mirror = this; 59 | } 60 | else { 61 | copy.mirror = mirror; 62 | } 63 | return copy; 64 | } 65 | 66 | public DoubleBitPos getDoubleBitPos() { 67 | 68 | if ((value[0] & 0xC0) == 0xC0) { 69 | return DoubleBitPos.BAD_STATE; 70 | } 71 | 72 | if ((value[0] & 0x80) == 0x80) { 73 | return DoubleBitPos.ON; 74 | } 75 | 76 | if ((value[0] & 0x40) == 0x40) { 77 | return DoubleBitPos.OFF; 78 | } 79 | 80 | return DoubleBitPos.INTERMEDIATE_STATE; 81 | } 82 | 83 | public void setDoubleBitPos(DoubleBitPos doubleBitPos) { 84 | if (doubleBitPos == DoubleBitPos.BAD_STATE) { 85 | value[0] = (byte) 0xC0; 86 | } 87 | else if (doubleBitPos == DoubleBitPos.ON) { 88 | value[0] = (byte) 0x80; 89 | } 90 | else if (doubleBitPos == DoubleBitPos.OFF) { 91 | value[0] = (byte) 0x40; 92 | } 93 | else { 94 | value[0] = (byte) 0; 95 | } 96 | } 97 | 98 | @Override 99 | public String getValueString() { 100 | return getDoubleBitPos().toString(); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/org/openmuc/openiec61850/clientgui/databind/ReasonForInclusionDataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-17 Fraunhofer ISE, energy & meteo Systems GmbH and other contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.openmuc.openiec61850.clientgui.databind; 18 | 19 | import java.awt.Component; 20 | 21 | import javax.swing.BoxLayout; 22 | import javax.swing.JCheckBox; 23 | import javax.swing.JComponent; 24 | import javax.swing.JPanel; 25 | 26 | import org.openmuc.openiec61850.BdaReasonForInclusion; 27 | import org.openmuc.openiec61850.BdaType; 28 | import org.openmuc.openiec61850.clientgui.BasicDataBind; 29 | 30 | public class ReasonForInclusionDataBind extends BasicDataBind { 31 | 32 | private final JCheckBox applicationTrigger = new JCheckBox("ApplicationTrigger"); 33 | private final JCheckBox dataChange = new JCheckBox("DataChange"); 34 | private final JCheckBox dataUpdate = new JCheckBox("DataUpdate"); 35 | private final JCheckBox generalInterrogation = new JCheckBox("GeneralInterrogation"); 36 | private final JCheckBox integrity = new JCheckBox("Integrity"); 37 | private final JCheckBox qualitychanged = new JCheckBox("QualityChanged"); 38 | 39 | public ReasonForInclusionDataBind(BdaReasonForInclusion data) { 40 | super(data, BdaType.REASON_FOR_INCLUSION); 41 | } 42 | 43 | @Override 44 | protected JComponent init() { 45 | applicationTrigger.setAlignmentX(Component.LEFT_ALIGNMENT); 46 | JPanel valuePanel = new JPanel(); 47 | valuePanel.setLayout(new BoxLayout(valuePanel, BoxLayout.PAGE_AXIS)); 48 | valuePanel.add(applicationTrigger); 49 | valuePanel.add(dataChange); 50 | valuePanel.add(dataUpdate); 51 | valuePanel.add(generalInterrogation); 52 | valuePanel.add(integrity); 53 | valuePanel.add(qualitychanged); 54 | return valuePanel; 55 | } 56 | 57 | @Override 58 | protected void resetImpl() { 59 | applicationTrigger.setSelected(data.isApplicationTrigger()); 60 | dataChange.setSelected(data.isDataChange()); 61 | dataUpdate.setSelected(data.isDataUpdate()); 62 | generalInterrogation.setSelected(data.isGeneralInterrogation()); 63 | integrity.setSelected(data.isIntegrity()); 64 | qualitychanged.setSelected(data.isQualityChange()); 65 | } 66 | 67 | @Override 68 | protected void writeImpl() { 69 | data.setApplicationTrigger(applicationTrigger.isSelected()); 70 | data.setDataChange(dataChange.isSelected()); 71 | data.setDataUpdate(dataUpdate.isSelected()); 72 | data.setGeneralInterrogation(generalInterrogation.isSelected()); 73 | data.setIntegrity(integrity.isSelected()); 74 | data.setQualityChange(qualitychanged.isSelected()); 75 | } 76 | } 77 | --------------------------------------------------------------------------------