예제 #1
0
        private DicomNSetResponse SetFilmBox(DicomNSetRequest request)
        {
            if (_filmSession == null)
            {
                this.Logger.Error("A basic film session does not exist for this association {0}", CallingAE);
                return(new DicomNSetResponse(request, DicomStatus.NoSuchObjectInstance));
            }

            this.Logger.Info("Set film box {0}", request.SOPInstanceUID.UID);
            var filmBox = _filmSession.FindFilmBox(request.SOPInstanceUID);

            if (filmBox == null)
            {
                this.Logger.Error(
                    "Received N-SET request for invalid film box {0} from {1}",
                    request.SOPInstanceUID.UID,
                    CallingAE);
                return(new DicomNSetResponse(request, DicomStatus.NoSuchObjectInstance));
            }

            request.Dataset.CopyTo(filmBox);

            filmBox.Initialize();

            var response = new DicomNSetResponse(request, DicomStatus.Success);

            response.Command.Add(DicomTag.AffectedSOPInstanceUID, filmBox.SOPInstanceUID);
            response.Command.Add(DicomTag.CommandDataSetType, (ushort)0x0202);
            response.Dataset = filmBox;
            return(response);
        }
        public async Task OnNSetRequestAsync_ShouldRespond()
        {
            var port = Ports.GetNext();

            using (DicomServerFactory.Create <AsyncDicomNServiceProvider>(port, logger: _logger.IncludePrefix("DicomServer")))
            {
                var client = DicomClientFactory.Create("127.0.0.1", port, false, "SCU", "ANY-SCP");
                client.Logger = _logger.IncludePrefix(typeof(DicomClient).Name);

                DicomNSetResponse response = null;
                DicomRequest.OnTimeoutEventArgs timeout = null;
                var request = new DicomNSetRequest(
                    DicomUID.BasicFilmSession,
                    new DicomUID("1.2.3", null, DicomUidType.SOPInstance))
                {
                    OnResponseReceived = (req, res) => response = res,
                    OnTimeout          = (sender, args) => timeout = args
                };

                await client.AddRequestAsync(request).ConfigureAwait(false);

                await client.SendAsync().ConfigureAwait(false);

                Assert.NotNull(response);
                Assert.Equal(DicomStatus.Success, response.Status);
                Assert.Null(timeout);
            }
        }
예제 #3
0
        public DicomNSetResponse OnNSetRequest(DicomNSetRequest request)
        {
            UpdateMppsStatusInLocalCollections(request);

            var resp = new DicomNSetResponse(request, DicomStatus.Success);

            return(resp);
        }