org.openmuc.jdlms.internal.lnassociation.AssociationException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdlms Show documentation
Show all versions of jdlms Show documentation
jDLMS is a library implementing the DLMS/COSEM (IEC 62056) communication standard.
package org.openmuc.jdlms.internal.lnassociation;
import org.openmuc.jdlms.internal.APdu;
import org.openmuc.jdlms.internal.ServiceError;
import org.openmuc.jdlms.internal.StateError;
import org.openmuc.jdlms.internal.asn1.cosem.COSEMpdu;
import org.openmuc.jdlms.internal.asn1.cosem.EXCEPTION_Response;
import org.openmuc.jdlms.internal.asn1.cosem.Enum;
class AssociationException extends GenericAssociationException {
private final StateError stateError;
private final ServiceError serviceErorr;
public AssociationException(StateError stateError, ServiceError serviceErorr) {
this.stateError = stateError;
this.serviceErorr = serviceErorr;
}
@Override
public APdu getErrorMessageApdu() {
Enum stateError_ = stateError != null ? stateError.asEnum() : null;
Enum serviceErorr_ = serviceErorr != null ? serviceErorr.asEnum() : null;
EXCEPTION_Response ex = new EXCEPTION_Response(stateError_, serviceErorr_);
COSEMpdu cosemPdu = new COSEMpdu();
cosemPdu.setexception_response(ex);
return new APdu(null, cosemPdu);
}
}