Example #1
0
 public void OnNetworkError(IClientService nwClientSrvc, string msg, AbortSource abortSource, AbortReason abortReason, Object userCookie)
 {
     if (abortSource == AbortSource.Server)
     {
         (userCookie as TransactionCookie).Log("Network Error: Server not responding");
     }
     else if (abortSource == AbortSource.Client)
     {
         (userCookie as TransactionCookie).Log("Network Error: Your device isn't connected to a network");
     }
 }
Example #2
0
 public static void SendAbort(Association asc, AbortSource abortSource = AbortSource.DICOM_UL_SERV_PROVIDER, AbortReason reason = AbortReason.REASON_NOT_SPECIFIED)
 {
     if (asc.Stream.CanWrite)
     {
         var abort = new Abort {
             Source = abortSource, Reason = reason
         };
         var message = abort.Write();
         asc.Stream.Write(message, 0, message.Length);
     }
 }
Example #3
0
        public override long Read(Stream stream)
        {
            long bytes = 0;

            if (stream.CanRead)
            {
                EndianBinaryReader reader = new EndianBinaryReader(stream, Endian.Big);
                long start = stream.Position;
                type      = (ProtocolDataUnit.Type)reader.ReadByte();
                reserved1 = reader.ReadByte();
                length    = reader.ReadInt32();
                reserved2 = reader.ReadByte();
                reserved3 = reader.ReadByte();
                source    = (AbortSource)reader.ReadByte();
                reason    = (AbortReason)reader.ReadByte();
                bytes     = stream.Position - start;
            }
            return(bytes);
        }
Example #4
0
        /// <summary>
        /// Aborts the association.
        /// </summary>
        internal void Abort(AbortSource source, AbortReason reason)
        {
            AssertValid();
            if (!IsOpen())
            {
                throw new Exception("Association not open.");
            }

            // the exception should be thrown on the foreground service thread
            abortexception = new AssociationAbortedException(source, reason, "Association aborted at the client's request.");
            State          = State.Aborted;
            // the association is aborted, free any services awaiting respsonses
            foreach (ServiceClass service in services)
            {
                service.completeEvent.Set();
            }

            AssociateAbortPdu abort = new AssociateAbortPdu();

            abort.Source = source;
            abort.reason = reason;

            Send("A-ABORT", abort);
        }
 public static void SendAbort(Association asc, AbortSource abortSource = AbortSource.DICOM_UL_SERV_PROVIDER, AbortReason reason = AbortReason.REASON_NOT_SPECIFIED)
 {
     if (asc.Stream.CanWrite)
     {
         var abort = new Abort { Source = abortSource, Reason = reason };
         var message = abort.Write();
         asc.Stream.Write(message, 0, message.Length);
     }
 }
Example #6
0
 public AssociationAbortedException(AbortSource source, AbortReason reason, string message, Exception innerException)
     : base(message, innerException)
 {
     this.source = source;
     this.reason = reason;
 }
Example #7
0
 public AssociationAbortedException(AbortSource source, AbortReason reason)
     : base()
 {
     this.source = source;
     this.reason = reason;
 }
Example #8
0
 public void OnNetworkError(IClientService nwClientSrvc, string msg, AbortSource abortSource, AbortReason abortReason, Object userCookie)
 {
     if (abortSource == AbortSource.Server)
     {
         (userCookie as TransactionCookie).Log("Network Error: Server not responding");
     }
     else if (abortSource == AbortSource.Client)
     {
         (userCookie as TransactionCookie).Log("Network Error: Your device isn't connected to a network");
     }
 }