예제 #1
0
 public void OnResponseRecieved(CFindResponse resp, Association asc)
 {
     asc.Logger.LogInformation("<-- DIMSE" + resp.GetLogString());
     asc.LastActive = DateTime.Now;
     dms.RaiseDIMSEResponseReceived(resp, asc);
     resp.LogData(asc);
     if (resp.Status != (ushort)Status.PENDING)
     {
         AssociationMessenger.SendReleaseRequest(asc);
     }
 }
예제 #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);
            }
        }