public async Task OnNEventReportRequestAsync_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);

                DicomNEventReportResponse       response = null;
                DicomRequest.OnTimeoutEventArgs timeout  = null;
                var request = new DicomNEventReportRequest(
                    DicomUID.BasicFilmSession,
                    new DicomUID("1.2.3", null, DicomUidType.SOPInstance),
                    1)
                {
                    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);
            }
        }
Ejemplo n.º 2
0
        internal async Task <DicomResponse> OnNEventReportRequestAsync(DicomNEventReportRequest request)
        {
            if (OnNEventReportRequest == null)
            {
                return(new DicomNEventReportResponse(request, DicomStatus.AttributeListError));
            }

            return(await OnNEventReportRequest(request).ConfigureAwait(false));
        }
Ejemplo n.º 3
0
        public void SOPInstanceUIDGetter_ResponseCreatedFromRequest_DoesNotThrow()
        {
            var request = new DicomNEventReportRequest(
                DicomUID.BasicFilmSession,
                new DicomUID("1.2.3", null, DicomUidType.SOPInstance),
                1);
            var response = new DicomNEventReportResponse(request, DicomStatus.Success);

            var exception = Record.Exception(() => response.SOPInstanceUID);

            Assert.Null(exception);
        }
Ejemplo n.º 4
0
        void OnPrintJobStatusUpdate(object sender, StatusUpdateEventArgs e)
        {
            var printJob = sender as PrintJob;

            if (printJob.SendNEventReport)
            {
                var reportRequest = new DicomNEventReportRequest(printJob.SOPClassUID, printJob.SOPInstanceUID, e.EventTypeId);
                var ds            = new DicomDataset();
                ds.Add(DicomTag.ExecutionStatusInfo, e.ExecutionStatusInfo);
                ds.Add(DicomTag.FilmSessionLabel, e.FilmSessionLabel);
                ds.Add(DicomTag.PrinterName, e.PrinterName);

                reportRequest.Dataset = ds;
                this.SendRequest(reportRequest);
            }
        }
Ejemplo n.º 5
0
        public DicomNEventReportResponse OnNEventReportRequest(DicomNEventReportRequest request)
        {
            //Console.WriteLine("OnNEventReportRequest:{0}", request.EventTypeID);

            //   string OnNEventReportRequest = request.EventTypeID.ToString();
            // string studyInstanceUId = request.Dataset.Get<string>(DicomTag.StudyInstanceUID);
            DicomSequence seq = null;

            seq = request.Dataset.Get <DicomSequence>(DicomTag.ReferencedSOPSequence);
            DicomDataset d = seq.Items.First();
            string       studyInstanceUId = d.Get <string>(DicomTag.StudyInstanceUID);
            string       sendState        = "success";

            OnDicomNEevent.BeginInvoke(new StudySendArgs()
            {
                StudyInstanceUID = studyInstanceUId,
                SendState        = sendState
            }, null, null);
            return(new DicomNEventReportResponse(request, DicomStatus.Success));
        }
Ejemplo n.º 6
0
        private void OnPrintJobStatusUpdate(object sender, StatusUpdateEventArgs e)
        {
            var printJob = sender as PrintJob;

            if (printJob.SendNEventReport)
            {
                var reportRequest = new DicomNEventReportRequest(
                    printJob.SOPClassUID,
                    printJob.SOPInstanceUID,
                    e.EventTypeId);
                var ds = new DicomDataset
                {
                    { DicomTag.ExecutionStatusInfo, e.ExecutionStatusInfo },
                    { DicomTag.FilmSessionLabel, e.FilmSessionLabel },
                    { DicomTag.PrinterName, e.PrinterName }
                };

                reportRequest.Dataset = ds;
                SendRequestAsync(reportRequest).Wait();
            }
        }
Ejemplo n.º 7
0
 public async Task <DicomNEventReportResponse> OnNEventReportRequestAsync(DicomNEventReportRequest request)
 {
     Logger.Log(LogLevel.Info, "receiving N-Event, not supported");
     return(new DicomNEventReportResponse(request, DicomStatus.UnrecognizedOperation));
 }
Ejemplo n.º 8
0
 public DicomNEventReportResponse OnNEventReportRequest(DicomNEventReportRequest request)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 9
0
 public Task <DicomNEventReportResponse> OnNEventReportRequestAsync(DicomNEventReportRequest request)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 10
0
 public DicomNEventReportResponse OnNEventReportRequest(DicomNEventReportRequest request)
 {
     return(new DicomNEventReportResponse(request, DicomStatus.Success));
 }
 public Task <DicomNEventReportResponse> OnNEventReportRequestAsync(DicomNEventReportRequest request)
 => Task.FromResult(new DicomNEventReportResponse(request, DicomStatus.Success)
 {
     Dataset = request.Dataset
 });
Ejemplo n.º 12
0
 public Task <DicomResponse> OnNEventReportRequestAsync(DicomNEventReportRequest request)
 {
     return(DicomClient.OnNEventReportRequestAsync(request));
 }
Ejemplo n.º 13
0
 public DicomNEventReportResponse OnNEventReportRequest(DicomNEventReportRequest request)
 {
     return(null);
 }
Ejemplo n.º 14
0
 public Task <DicomResponse> OnNEventReportRequestAsync(DicomNEventReportRequest request) => DicomClient.OnNEventReportRequestAsync(request);