コード例 #1
0
ファイル: SCUStoreDicomThread.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Handle Abort Rq
        /// </summary>
        /// <param name="abort"></param>
        public override void AfterHandlingAbort(Abort abort)
        {
            if (!IsMessageHandled)
            {
                StopResultsGathering();
                StartResultsGathering();

                IsMessageHandled = true;
            }
        }
コード例 #2
0
ファイル: MessageHandler.cs プロジェクト: ewcasas/DVTK
 //
 // - Methods -
 //
 /// <summary>
 /// Override this method to handle an A-ABORT.
 /// </summary>
 /// <param name="abort">The received A-ABORT.</param>
 /// <returns>Return true when this methods has handled the received A-ABORT, otherwise false.</returns>
 public virtual bool HandleAbort(Abort abort)
 {
     return false;
 }
コード例 #3
0
ファイル: HliScp.cs プロジェクト: ewcasas/DVTK
 /// <summary>
 /// Method to handle the workflow after receiving an Abort Request.
 /// </summary>
 /// <param name="abort">Abort Request message.</param>
 public override void AfterHandlingAbort(Abort abort)
 {
     // message has now been handled
     IsMessageHandled = true;
 }
コード例 #4
0
ファイル: MessageIterator.cs プロジェクト: ewcasas/DVTK
 /// <summary>
 /// This method is called after an A-ABORT has been received but before it
 /// (possibly) will be handled by the (zero or more) MessageHandler objects that
 /// are attached to this object.
 /// 
 /// Default, nothing is done in this method. Override if needed.
 /// </summary>
 /// <param name="abort">The received A-ABORT.</param>
 public virtual void BeforeHandlingAbort(Abort abort)
 {
     // Do nothing.
 }
コード例 #5
0
ファイル: MessageIterator.cs プロジェクト: ewcasas/DVTK
 /// <summary>
 /// This method is called after an A-ABORT has been received and has 
 /// (possibly) been handled by the (zero or more) MessageHandler objects that
 /// are attached to this object.
 /// 
 /// Default, nothing is done in this method. Override if needed.
 /// </summary>
 /// <param name="abort">The received A-ABORT.</param>
 public virtual void AfterHandlingAbort(Abort abort)
 {
     // Do nothing.
 }
コード例 #6
0
ファイル: DicomThread.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Receives a messages (can be a Dicom or Dul message).
        /// </summary>
        /// <param name="messageToExpect">Message to expect that is written in the results.</param>
        /// <returns>The received message.</returns>
        /// <exception cref="DicomProtocolMessageReceiveException">
        ///	Receiving of a message fails.
        /// </exception> 
        private DicomProtocolMessage ReceiveMessage(String messageToExpect)
        {
            DicomProtocolMessage receivedMessage = null;

            DvtkData.Message dvtkDataMessage = null;

            if (this.hasOpenConnection)
            {
                if (messageToExpect == "")
                {
                    WriteInformation("Receiving message...");
                }
                else
                {
                    WriteInformation("Receiving message (expecting " +  messageToExpect + ")...");
                }
            }
            else
            {
                WriteInformation(String.Format("Listening for incoming Dicom connection on port {0}...", Options.LocalPort));
            }

            Dvtk.Sessions.ReceiveReturnCode receiveReturnCode = DvtkScriptSession.Receive(out dvtkDataMessage);

            if (receiveReturnCode != Dvtk.Sessions.ReceiveReturnCode.Success)
            {
                throw new DicomProtocolMessageReceiveException("Error while trying to receive a Message. Error code " + receiveReturnCode.ToString() + ".", receiveReturnCode);
            }
            else
            {
                if (dvtkDataMessage is DvtkData.Dimse.DicomMessage)
                {
                    DicomMessage receivedDicomMessage = new DicomMessage(dvtkDataMessage as DvtkData.Dimse.DicomMessage);

                    // Apply the inbound DicomMessage filters if this is a DicomMessage.
                    foreach (InboundDicomMessageFilter inboundDicomMessageFilter in this.inboundDicomMessageFilters)
                    {
                        inboundDicomMessageFilter.Apply(receivedDicomMessage);
                    }

                    receivedMessage = receivedDicomMessage;
                }
                else if (dvtkDataMessage is DvtkData.Dul.A_ASSOCIATE_RQ)
                {
                    receivedMessage = new AssociateRq(dvtkDataMessage as DvtkData.Dul.A_ASSOCIATE_RQ);
                    hasOpenConnection = true;
                }
                else if (dvtkDataMessage is DvtkData.Dul.A_ASSOCIATE_AC)
                {
                    receivedMessage = new AssociateAc(dvtkDataMessage as DvtkData.Dul.A_ASSOCIATE_AC);
                    this.lastAssociateAc = receivedMessage as AssociateAc;
                }
                else if (dvtkDataMessage is DvtkData.Dul.A_ASSOCIATE_RJ)
                {
                    receivedMessage = new AssociateRj(dvtkDataMessage as DvtkData.Dul.A_ASSOCIATE_RJ);
                    hasOpenConnection = false;
                }
                else if (dvtkDataMessage is DvtkData.Dul.A_RELEASE_RQ)
                {
                    receivedMessage = new ReleaseRq(dvtkDataMessage as DvtkData.Dul.A_RELEASE_RQ);
                }
                else if (dvtkDataMessage is DvtkData.Dul.A_RELEASE_RP)
                {
                    receivedMessage = new ReleaseRp(dvtkDataMessage as DvtkData.Dul.A_RELEASE_RP);
                    hasOpenConnection = false;
                }
                else if (dvtkDataMessage is DvtkData.Dul.A_ABORT)
                {
                    receivedMessage = new Abort(dvtkDataMessage as DvtkData.Dul.A_ABORT);
                    hasOpenConnection = false;
                }
                else
                {
                    Debug.Assert(true, "Unexpected DvtkData Message descendant type.");
                }

                WriteInformation("... " + receivedMessage.ToString() + " received.");

                // If the options AutoValidate is true, try to validate as much
                // as possible for the received message.
                if (Options.AutoValidate)
                {
                    Validate(receivedMessage);
                }

                MessageReceived(receivedMessage);

                if (receivedMessage is ReleaseRq)
                {
                    if (AssociationReleasedEvent != null)
                    {
                        AssociationReleasedEvent(this);
                    }
                }
            }

            return (receivedMessage);
        }
コード例 #7
0
ファイル: DicomThread.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Sends a Dicom A_ABORT.
        /// </summary>
        /// <param name="source">The Abort source.</param>
        /// <param name="reason">The Abort reason.</param>
        /// <returns>The sent A_ABORT.</returns>
        /// <exception cref="System.Exception">
        ///	Sending of the A_ABORT fails.
        /// </exception> 
        protected internal Abort SendAbort(Byte source, Byte reason)
        {
            Abort abort = new Abort(source, reason);

            SendMessage(abort);

            return (abort);
        }
コード例 #8
0
ファイル: OverviewThread.cs プロジェクト: ewcasas/DVTK
 public override void BeforeHandlingAbort(Abort abort)
 {
     this.SendingMessageEvent -= new SendingMessageEventHandler(QRScp_SendingMessageEvent);
     this.MessageReceivedEvent -= new MessageReceivedEventHandler(QRScp_MessageReceivedEvent);
     base.BeforeHandlingAbort(abort);
 }
コード例 #9
0
ファイル: StorageCommitScp.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Method to handle the workflow after receiving an Abort Request.
        /// </summary>
        /// <param name="abort">Abort Request message.</param>
        public override void AfterHandlingAbort(Abort abort)
        {
            // message has now been handled
            if (!IsMessageHandled)
            {
                StopResultsGathering();
                StartResultsGathering();

                IsMessageHandled = true;
                isAssociated = false;
            }
        }