Example #1
0
        /// <summary>
        /// Method to handle the workflow after receiving a Release Request.
        /// </summary>
        /// <param name="releaseRq">Release Request message.</param>
        public override void AfterHandlingReleaseRequest(ReleaseRq releaseRq)
        {
            if (IsMessageHandled == false)
            {
                // determine which workflow to follow
                switch (_scpRespondToReleaseRequest)
                {
                case ScpRespondToReleaseRequestEnum.WithReleaseResponse:
                    // send a release response
                    SendReleaseRp();
                    break;

                case ScpRespondToReleaseRequestEnum.WithAbort:
                default:
                    // send an abort request with the given parameters
                    SendAbort(_abortSource, _abortReason);
                    break;
                }

                // handle results files
                if (_resultsFilePerAssociation == true)
                {
                    StopResultsGathering();
                    StartResultsGathering();
                }

                // message has now been handled
                IsMessageHandled = true;
            }
        }
Example #2
0
 public override void AfterHandlingReleaseRequest(ReleaseRq releaseRq)
 {
     if (!IsMessageHandled)
     {
         SendReleaseRp();
         IsMessageHandled = true;
     }
 }
Example #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;
        }
Example #4
0
        /// <summary>
        /// Method to handle the workflow after receiving a Release Request.
        /// </summary>
        /// <param name="releaseRq">Release Request message.</param>
        public override void AfterHandlingReleaseRequest(ReleaseRq releaseRq)
        {
            if (IsMessageHandled == false)
            {
                // send a release response
                SendReleaseRp();

                // message has now been handled
                IsMessageHandled = true;
            }
        }
Example #5
0
        public override void AfterHandlingReleaseRequest(ReleaseRq releaseRq)
        {
            if (!IsMessageHandled)
            {
                SendReleaseRp();

                CheckForNewResultsFile();

                IsMessageHandled = true;
            }
        }
Example #6
0
        /// <summary>
        /// Method to handle the workflow after receiving a Release Request.
        /// </summary>
        /// <param name="releaseRq">Release Request message.</param>
        public override void AfterHandlingReleaseRequest(ReleaseRq releaseRq)
        {
            if (IsMessageHandled == false)
            {
                SendReleaseRp();

                // message has now been handled
                IsMessageHandled = true;

                this.receiveMessages = false;
            }
        }
Example #7
0
        /// <summary>
        /// This class was only intended as an example of a MessageIterator derived class. Please use the MessageIterator class instead.
        /// </summary>
        /// <param name="releaseRq">-</param>
        public override void AfterHandlingReleaseRequest(ReleaseRq releaseRq)
        {
            if (!IsMessageHandled)
            {
                SendReleaseRp();

                if (this.resultsFilePerAssociation)
                {
                    StopResultsGathering();
                    StartResultsGathering();
                }

                IsMessageHandled = true;
            }
        }
Example #8
0
 public override void BeforeHandlingReleaseRequest(ReleaseRq releaseRq)
 {
     this.SendingMessageEvent  -= new SendingMessageEventHandler(QRScp_SendingMessageEvent);
     this.MessageReceivedEvent -= new MessageReceivedEventHandler(QRScp_MessageReceivedEvent);
     base.BeforeHandlingReleaseRequest(releaseRq);
 }
Example #9
0
        //
        // - Methods -
        //


        /// <summary>
        /// This override makes sure that this SCP object only nadles one association and
        /// exists after that.
        /// </summary>
        /// <param name="releaseRq">The received A-RELEASE-RQ.</param>
        public override void AfterHandlingReleaseRequest(ReleaseRq releaseRq)
        {
            base.AfterHandlingReleaseRequest(releaseRq);
            this.receiveMessages = false;
        }
Example #10
0
        /// <summary>
        /// Overridden N-ACTION-RQ message handler. Return an N-EVENT-REPORT-RQ
        /// after the N-ACTION-RSP.
        /// </summary>
        /// <param name="queryMessage">N-ACTION-RQ and Dataset.</param>
        /// <returns>Boolean - true if dicomMessage handled here.</returns>
        protected override void AfterHandlingNActionRequest(DicomMessage dicomMessage)
        {
            isEventSent = false;

            // set up the default N-ACTION-RSP with a successful status
            DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.NACTIONRSP);

            responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0);

            // send the response
            this.Send(responseMessage);

            IsMessageHandled = true;

            // creating information model
            QueryRetrieveInformationModels qrInfoModels = CreateQueryRetrieveInformationModels(true, _dataDirectory);

            // delay before generating the N-EVENT-REPORT-RQ
            WriteInformation(string.Format("Delaying the N-EVENT-REPORT by {0} secs", _eventDelay / 1000));

            isAssociated = true;
            int waitedTime = 0;

            if (WaitForPendingDataInNetworkInputBuffer(_eventDelay, ref waitedTime))
            {
                ReleaseRq releaseRq = ReceiveReleaseRq();

                if (releaseRq != null)
                {
                    SendReleaseRp();

                    isAssociated = false;
                }
            }

            if (!isAssociated)
            {
                string info = "Sending the N-Event-Report asynchronously.";
                WriteInformation(info);

                SCU commitScu = new SCU();

                commitScu.Initialize(this.Parent);

                // Set the correct settings for the overview DicomThread.
                //
                commitScu.Options.Identifier = "Storage_Commitment_SCU_association_" + storageCommitmentScuIndex.ToString();
                commitScu.Options.ResultsFileNameOnlyWithoutExtension = (this.overviewThread as StoreCommitScp).startDateTime + "_Storage_Commitment_SCU_association_" + storageCommitmentScuIndex.ToString();
                storageCommitmentScuIndex++;
                commitScu.Options.LocalAeTitle     = this.Options.LocalAeTitle;
                commitScu.Options.RemoteAeTitle    = _remoteAETitle;
                commitScu.Options.RemotePort       = _port;
                commitScu.Options.RemoteHostName   = _remoteHostName;
                commitScu.Options.RemoteRole       = Dvtk.Sessions.SutRole.Requestor;
                commitScu.Options.ResultsDirectory = this.Options.ResultsDirectory;
                commitScu.Options.DataDirectory    = this.Options.DataDirectory;
                commitScu.Options.StorageMode      = Dvtk.Sessions.StorageMode.NoStorage;
                commitScu.Options.LogThreadStartingAndStoppingInParent = false;
                commitScu.Options.LogWaitingForCompletionChildThreads  = false;
                commitScu.Options.AutoValidate = false;

                PresentationContext presentationContext = new PresentationContext("1.2.840.10008.1.20.1", // Abstract Syntax Name
                                                                                  "1.2.840.10008.1.2");   // Transfer Syntax Name(s)
                PresentationContext[] presentationContexts = new PresentationContext[1];
                presentationContexts[0] = presentationContext;

                // create the N-EVENT-REPORT-RQ based in the contents of the N-ACTION-RQ
                DicomMessage requestMessage = GenerateTriggers.MakeStorageCommitEvent(qrInfoModels, dicomMessage);

                if (waitedTime < _eventDelay)
                {
                    Sleep(_eventDelay - waitedTime);
                }

                commitScu.Start();

                isEventSent = commitScu.TriggerSendAssociationAndWait(requestMessage, presentationContexts);
            }
            else
            {
                string info = "Sending the N-Event-Report synchronously.";
                WriteInformation(info);

                if (!isEventSent)
                {
                    SendNEventReport(qrInfoModels, dicomMessage);
                }
            }
        }
Example #11
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);
 }
Example #12
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.
 }
Example #13
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.
 }