예제 #1
0
파일: SCP.cs 프로젝트: ewcasas/DVTK
        public override void AfterHandlingReleaseRequest(ReleaseRq releaseRq)
        {
            if (!IsMessageHandled)
            {
                SendReleaseRp();

                CheckForNewResultsFile();

                IsMessageHandled = true;
            }
        }
예제 #2
0
 /// <summary>
 /// Override this method to handle an A-RELEASE-RQ.
 /// </summary>
 /// <param name="releaseRq">The received A-RELEASE-RQ.</param>
 /// <returns>Return true when this methods has handled the received A-RELEASE-RQ, otherwise false.</returns>
 public virtual bool HandleReleaseRequest(ReleaseRq releaseRq)
 {
     return false;
 }
예제 #3
0
        /// <summary>
        /// This method is called after an A-RELEASE-RQ has been received and has 
        /// (possibly) been handled by the (zero or more) MessageHandler objects that
        /// are attached to this object.
        /// 
        /// This implementation makes sure that if the received A-RELEASE-RQ has not been
        /// handled yet, this object will send a release response.
        /// </summary>
        /// <param name="releaseRq">The received A-RELEASE-RQ.</param>
        public override void AfterHandlingReleaseRequest(ReleaseRq releaseRq)
        {
            if (!IsMessageHandled)
            {
                SendReleaseRp();
                IsMessageHandled = true;
            }

            this.receiveMessages = false;
        }
예제 #4
0
파일: DicomThread.cs 프로젝트: ewcasas/DVTK
        /// <summary>
        /// Send a A-RELEASE-RQ.
        /// </summary>
        /// <returns>The A-RELEASE-RQ.</returns>
        public ReleaseRq SendReleaseRq()
        {
            // Start Interface logging.
            // InterfaceLogging.Start(this);

            ReleaseRq releaseRq = new ReleaseRq(new DvtkData.Dul.A_RELEASE_RQ());

            Dvtk.Sessions.SendReturnCode sendReturnCode = DvtkScriptSession.Send(releaseRq.DvtkDataDulMessage);

            if (sendReturnCode != Dvtk.Sessions.SendReturnCode.Success)
            {
                DvtkHighLevelInterfaceException.Throw("Error while trying to send a A_RELEASE_RQ");
            }
            else
            {
                releaseRq.IsSend = true;
                ThreadManager.DataWarehouse.AddMessage(this, releaseRq);

                if (AssociationReleasedEvent != null)
                {
                    AssociationReleasedEvent(this);
                }
            }

            // End Interface logging.
            // InterfaceLogging.End(releaseRq);

            return(releaseRq);
        }
예제 #5
0
파일: DicomThread.cs 프로젝트: ewcasas/DVTK
        /// <summary>
        /// Receive a message (can be a Dicom or Dul message).
        /// 
        /// An exception is thrown when receiving of a message fails.
        /// </summary>
        /// <returns>The received message.</returns>
        public Message ReceiveMessage()
        {
            // Start Interface logging.
            // InterfaceLogging.Start(this);

            DicomProtocolMessage receivedMessage = null;

            DvtkData.Message dvtkDataMessage = null;

            WriteInformation("Receive message...");

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

            if (receiveReturnCode != Dvtk.Sessions.ReceiveReturnCode.Success)
            {
                DvtkHighLevelInterfaceException.Throw("Error while trying to receive a Message. Error code " + receiveReturnCode.ToString() + ".");
            }
            else
            {
                if (dvtkDataMessage is DvtkData.Dimse.DicomMessage)
                {
                    receivedMessage = new DicomMessage(dvtkDataMessage as DvtkData.Dimse.DicomMessage);
                }
                else if (dvtkDataMessage is DvtkData.Dul.A_ASSOCIATE_RQ)
                {
                    lastAssociateRq = new AssociateRq(dvtkDataMessage as DvtkData.Dul.A_ASSOCIATE_RQ);
                    receivedMessage = lastAssociateRq;
                }
                else if (dvtkDataMessage is DvtkData.Dul.A_ASSOCIATE_AC)
                {
                    receivedMessage = new AssociateAc(dvtkDataMessage as DvtkData.Dul.A_ASSOCIATE_AC);
                }
                else if (dvtkDataMessage is DvtkData.Dul.A_ASSOCIATE_RJ)
                {
                    receivedMessage = new AssociateRj(dvtkDataMessage as DvtkData.Dul.A_ASSOCIATE_RJ);
                }
                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);
                }
                else if (dvtkDataMessage is DvtkData.Dul.A_ABORT)
                {
                    receivedMessage = new Abort(dvtkDataMessage as DvtkData.Dul.A_ABORT);
                }
                else
                {
                    Debug.Assert(true, "Unexpected DvtkData Message descendant type.");
                }

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

                receivedMessage.IsReceived = true;
                ThreadManager.DataWarehouse.AddMessage(this, receivedMessage);

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

            // End Interface logging.
            // InterfaceLogging.End(receivedMessage);

            return(receivedMessage);
        }
예제 #6
0
 /// <summary>
 /// This method is called after an A-RELEASE-RQ 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="releaseRq">The received A-RELEASE-RQ.</param>
 public virtual void BeforeHandlingReleaseRequest(ReleaseRq releaseRq)
 {
     // Do nothing.
 }
예제 #7
0
 /// <summary>
 /// This method is called after an A-RELEASE-RQ 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="releaseRq">The received A-RELEASE-RQ.</param>
 public virtual void AfterHandlingReleaseRequest(ReleaseRq releaseRq)
 {
     // Do nothing.
 }