All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openmuc.jdlms.internal.lnassociation.AssociationException Maven / Gradle / Ivy

Go to download

jDLMS is a library implementing the DLMS/COSEM (IEC 62056) communication standard.

There is a newer version: 1.8.0
Show newest version
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);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy