internal override void PostResponse(DicomService service, DicomResponse response) {
			try {
				if (OnResponseReceived != null)
					OnResponseReceived(this, (DicomNActionResponse)response);
			} catch {
			}
		}
        public void ErrorCommentIsNotThereForSuccess()
        {
            var rsp = new DicomResponse(new DicomDataset());

            rsp.Status = DicomStatus.Success;

            Assert.False(rsp.Command.Contains(DicomTag.ErrorComment));
        }
 protected internal override void PostResponse(DicomService service, DicomResponse response)
 {
     try
     {
         if (OnResponseReceived != null) OnResponseReceived(this, (DicomNEventReportResponse)response);
     }
     catch
     {
     }
 }
        public void ErrorCommentIsThereForFailure()
        {
            var rsp = new DicomResponse(new DicomDataset());

            var failure = new DicomStatus("FF01", DicomState.Failure, "Failed", "Comment on the failure mode");

            rsp.Status = failure;

            Assert.True(rsp.Command.Contains(DicomTag.ErrorComment));
        }
示例#5
0
 /// <summary>
 /// Send response from service.
 /// </summary>
 /// <param name="response">Response to send.</param>
 protected void SendResponse(DicomResponse response)
 {
     SendMessage(response);
 }
示例#6
0
        private void PerformDimseCallback(object state)
        {
            var dimse = state as DicomMessage;

            try {
                Logger.Info("{0} <- {1}", LogID, dimse.ToString(Options.LogDimseDatasets));

                if (!DicomMessage.IsRequest(dimse.Type))
                {
                    var rsp = dimse as DicomResponse;
                    lock (_lock) {
                        var req = _pending.FirstOrDefault(x => x.MessageID == rsp.RequestMessageID);
                        if (req != null)
                        {
                            rsp.UserState = req.UserState;
                            (req as DicomRequest).PostResponse(this, rsp);
                            if (rsp.Status.State != DicomState.Pending)
                            {
                                _pending.Remove(req);
                            }
                        }
                    }
                    return;
                }

                if (dimse.Type == DicomCommandField.CStoreRequest)
                {
                    if (this is IDicomCStoreProvider)
                    {
                        var response = (this as IDicomCStoreProvider).OnCStoreRequest(dimse as DicomCStoreRequest);
                        SendResponse(response);
                        return;
                    }
                    else
                    {
                        throw new DicomNetworkException("C-Store SCP not implemented");
                    }
                }

                if (dimse.Type == DicomCommandField.CFindRequest)
                {
                    if (this is IDicomCFindProvider)
                    {
                        var responses = (this as IDicomCFindProvider).OnCFindRequest(dimse as DicomCFindRequest);
                        foreach (var response in responses)
                        {
                            SendResponse(response);
                        }
                        return;
                    }
                    else
                    {
                        throw new DicomNetworkException("C-Find SCP not implemented");
                    }
                }

                if (dimse.Type == DicomCommandField.CMoveRequest)
                {
                    if (this is IDicomCMoveProvider)
                    {
                        var responses = (this as IDicomCMoveProvider).OnCMoveRequest(dimse as DicomCMoveRequest);
                        foreach (var response in responses)
                        {
                            SendResponse(response);
                        }
                        return;
                    }
                    else
                    {
                        throw new DicomNetworkException("C-Move SCP not implemented");
                    }
                }

                if (dimse.Type == DicomCommandField.CEchoRequest)
                {
                    if (this is IDicomCEchoProvider)
                    {
                        var response = (this as IDicomCEchoProvider).OnCEchoRequest(dimse as DicomCEchoRequest);
                        SendResponse(response);
                        return;
                    }
                    else
                    {
                        throw new DicomNetworkException("C-Echo SCP not implemented");
                    }
                }

                if (dimse.Type == DicomCommandField.NActionRequest || dimse.Type == DicomCommandField.NCreateRequest ||
                    dimse.Type == DicomCommandField.NDeleteRequest || dimse.Type == DicomCommandField.NEventReportRequest ||
                    dimse.Type == DicomCommandField.NGetRequest || dimse.Type == DicomCommandField.NSetRequest)
                {
                    if (!(this is IDicomNServiceProvider))
                    {
                        throw new DicomNetworkException("N-Service SCP not implemented");
                    }

                    DicomResponse response = null;
                    if (dimse.Type == DicomCommandField.NActionRequest)
                    {
                        response = (this as IDicomNServiceProvider).OnNActionRequest(dimse as DicomNActionRequest);
                    }
                    else if (dimse.Type == DicomCommandField.NCreateRequest)
                    {
                        response = (this as IDicomNServiceProvider).OnNCreateRequest(dimse as DicomNCreateRequest);
                    }
                    else if (dimse.Type == DicomCommandField.NDeleteRequest)
                    {
                        response = (this as IDicomNServiceProvider).OnNDeleteRequest(dimse as DicomNDeleteRequest);
                    }
                    else if (dimse.Type == DicomCommandField.NEventReportRequest)
                    {
                        response = (this as IDicomNServiceProvider).OnNEventReportRequest(dimse as DicomNEventReportRequest);
                    }
                    else if (dimse.Type == DicomCommandField.NGetRequest)
                    {
                        response = (this as IDicomNServiceProvider).OnNGetRequest(dimse as DicomNGetRequest);
                    }
                    else if (dimse.Type == DicomCommandField.NSetRequest)
                    {
                        response = (this as IDicomNServiceProvider).OnNSetRequest(dimse as DicomNSetRequest);
                    }

                    SendResponse(response);
                    return;
                }

                throw new DicomNetworkException("Operation not implemented");
            } finally {
                SendNextMessage();
            }
        }
示例#7
0
 protected void SendResponse(DicomResponse response)
 {
     SendMessage(response);
 }
示例#8
0
 /// <summary>
 /// Operation to perform after response has been made.
 /// </summary>
 /// <param name="service">Active DICOM service.</param>
 /// <param name="response">Response to be post-processed.</param>
 protected internal abstract void PostResponse(DicomService service, DicomResponse response);
示例#9
0
 internal abstract void PostResponse(DicomService service, DicomResponse response);