Пример #1
0
 public static void Send(AbstractDIMSEBase dimse, Association asc, PresentationContext pContext = null)
 {
     if (asc.State != NetworkState.TRANSPORT_CONNECTION_OPEN)
     {
         asc.OutboundMessages.Enqueue(dimse);
         AssociationMessenger.SendRequest(asc, dimse.AffectedSOPClassUID);
     }
     else if (!asc.IsClientConnected)
     {
         //Connection lost
         asc.Logger.Log("TCP connection has been lost. Ending association");
     }
     else
     {
         asc.Logger.Log("--> DIMSE" + dimse.GetLogString());
         dimse.LogData(asc);
         pContext = pContext ?? asc.PresentationContexts.First(a => a.AbstractSyntax == dimse.AffectedSOPClassUID);
         var maxPDU = asc.UserInfo.MaxPDULength;
         WriteDimseToStream(dimse, asc.Stream, pContext, maxPDU);
         if (dimse is AbstractDIMSEResponse && !(dimse is NEventReportResponse))
         {
             asc.State = NetworkState.AWAITING_RELEASE;
         }
         else if (dimse is NEventReportResponse)
         {
             AssociationMessenger.SendReleaseRequest(asc);
         }
         else
         {
             asc.State = NetworkState.ASSOCIATION_ESTABLISHED_WAITING_ON_DATA;
         }
     }
 }
Пример #2
0
 public static void Send(AbstractDIMSEBase dimse, Association asc, PresentationContext pContext = null)
 {
     if (asc.State != NetworkState.TRANSPORT_CONNECTION_OPEN)
     {
         asc.OutboundMessages.Enqueue(dimse);
         AssociationMessenger.SendRequest(asc, dimse.AffectedSOPClassUID);
     }
     else
     {
         asc.Logger.Log("--> DIMSE" + dimse.GetLogString());
         dimse.LogData(asc);
         var stream = asc.Stream;
         pContext =
             pContext ?? asc.PresentationContexts.First(a => a.AbstractSyntax == dimse.AffectedSOPClassUID);
         var pds = GetPDataTFs(dimse, pContext, asc.UserInfo.MaxPDULength);
         if (pds.Count > 0 && stream.CanWrite)
         {
             foreach (var pd in pds)
             {
                 var message = pd.Write();
                 stream.Write(message, 0, message.Length);
             }
         }
     }
 }
Пример #3
0
 public static void Send(AbstractDIMSEBase dimse, Association asc, PresentationContext pContext = null)
 {
     if (asc.State != NetworkState.TRANSPORT_CONNECTION_OPEN)
     {
         asc.OutboundMessages.Enqueue(dimse);
         AssociationMessenger.SendRequest(asc, dimse.AffectedSOPClassUID);
     }
     else
     {
         asc.Logger.Log("--> DIMSE" + dimse.GetLogString());
         dimse.LogData(asc);
         pContext = pContext ?? asc.PresentationContexts.First(a => a.AbstractSyntax == dimse.AffectedSOPClassUID);
         var maxPDU = asc.UserInfo.MaxPDULength;
         WriteDimseToStream(dimse, asc.Stream, pContext, maxPDU);
     }
 }