public void OnRequestReceived(NEventReportRequest req, Association asc)
        {
            asc.Logger.Log("<-- DIMSE" + req.GetLogString());
            req.LogData(asc);
            asc.LastActive = DateTime.Now;
            var resp = new NEventReportResponse(req, Status.SUCCESS);

            _dms.RaiseDIMSERequestReceived(req, asc);
            PDataMessenger.Send(resp, asc);
        }
Exemple #2
0
        public void OnRequestRecieved(CFindRequest req, Association asc)
        {
            asc.Logger.LogInformation("<-- DIMSE" + req.GetLogString());
            req.LogData(asc);
            asc.LastActive = DateTime.Now;
            asc.IdleClock.Restart();
            asc.State = NetworkState.TRANSPORT_CONNECTION_OPEN;
            var resp = new CFindResponse(req, Status.SUCCESS);

            dms.RaiseDIMSERequestReceived(req, asc);
            var results = RetrieveResults(req);

            if (results != null)
            {
                foreach (var result in results)
                {
                    resp.Data        = new DICOMObject(result.Elements);
                    resp.Status      = (ushort)Status.PENDING;
                    resp.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(resp.Elements.Skip(1).ToList()),
                                                                         new DICOMIOSettings(), "0000").Length;
                    PDataMessenger.Send(resp, asc,
                                        asc.PresentationContexts.First(p => p.Id == req.DataPresentationContextId));
                }
                //Finish
                resp.Status      = results.Any() ? (ushort)Status.SUCCESS : (ushort)Status.FAILURE_UNABLE_TO_FIND;
                resp.Data        = null;
                resp.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(resp.Elements.Skip(1).ToList()),
                                                                     new DICOMIOSettings(), "0000").Length;
                PDataMessenger.Send(resp, asc);
            }
            else
            {
                resp.Status      = (ushort)Status.FAILURE;
                resp.Data        = null;
                resp.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(resp.Elements.Skip(1).ToList()),
                                                                     new DICOMIOSettings(), "0000").Length;
                PDataMessenger.Send(resp, asc);
            }
        }
Exemple #3
0
        public void OnRequestReceived(NActionRequest req, Association asc)
        {
            asc.Logger.LogInformation("<-- DIMSE" + req.GetLogString());
            req.LogData(asc);
            asc.LastActive = DateTime.Now;
            var resp = new NActionResponse(req, Status.SUCCESS);

            _dms.RaiseDIMSERequestReceived(req, asc);

            //STORAGE COMMITMENT PUSH
            if (req.RequestedSOPClassUID == AbstractSyntax.StorageCommitment_Push)
            {
                resp.Status = (ushort)Status.SUCCESS;
                PDataMessenger.Send(resp, asc);
                PerformStorageCommitment(req, asc);
            }
            else
            {
                //Abstract syntax not supported
                resp.Status = (ushort)Status.FAILURE_UNABLE_TO_PROCESS;
                PDataMessenger.Send(resp, asc);
            }
        }
Exemple #4
0
        public void OnRequestRecieved(CStoreRequest req, Association asc)
        {
            asc.Logger.Log("<-- DIMSE" + req.GetLogString());
            req.LogData(asc);
            asc.LastActive = DateTime.Now;
            asc.State      = NetworkState.TRANSPORT_CONNECTION_OPEN;
            var resp   = new CStoreResponse(req, Status.SUCCESS);
            var syntax = req.Data.FindFirst(TagHelper.SOP​Class​UID);

            dms.RaiseDIMSERequestReceived(req, asc);

            if (syntax != null)
            {
                if (asc.PresentationContexts.Any(p => p.Id == req.DataPresentationContextId))
                {
                    try
                    {
                        var success = CStorePayloadAction != null?CStorePayloadAction.Invoke(req.Data, asc) : false;

                        resp.Status = success ? resp.Status : (ushort)Status.FAILURE;
                        PDataMessenger.Send(resp, asc,
                                            asc.PresentationContexts.First(p => p.Id == req.DataPresentationContextId));
                    }
                    catch (Exception e)
                    {
                        resp.Status = (ushort)Status.FAILURE;
                        PDataMessenger.Send(resp, asc);
                    }
                }
                else
                {
                    //Abstract syntax not supported
                    resp.Status = (ushort)Status.FAILURE;
                    PDataMessenger.Send(resp, asc);
                }
            }
        }