ClearCanvas.Dicom.Network.NetworkBase.SendAssociateReject C# (CSharp) Method

SendAssociateReject() public method

Method to send an association rejection.
public SendAssociateReject ( DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason ) : void
result DicomRejectResult The
source DicomRejectSource
reason DicomRejectReason
return void
        public void SendAssociateReject(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
        {
            if (State != DicomAssociationState.Sta3_AwaitingLocalAAssociationResponsePrimative)
            {
                Platform.Log(LogLevel.Error, "Error attempting to send association reject at invalid time in association.");
                SendAssociateAbort(DicomAbortSource.ServiceProvider, DicomAbortReason.NotSpecified);
                throw new DicomNetworkException(
                    "Attempting to send association reject at invalid time in association, aborting");
            }
            var pdu = new AAssociateRJ(result, source, reason);

            EnqueuePdu(pdu.Write());

            State = DicomAssociationState.Sta13_AwaitingTransportConnectionClose;

            if (AssociationRejected != null)
                AssociationRejected(source, reason);
        }