Exemplo n.º 1
0
 public PacsStorageScu(IServerPartition partition, IDevice remoteDevice, string moveOriginatorAe,
                       ushort moveOrginatorMessageId)
     : base(
         partition.AeTitle, remoteDevice.AeTitle, remoteDevice.Hostname, remoteDevice.Port,
         moveOriginatorAe, moveOrginatorMessageId)
 {
     _remoteDevice = remoteDevice;
 }
Exemplo n.º 2
0
        public IDevice LookupDevice(IServerPartition partition, string aet)
        {
            Device device = null;

            using (var ctx = new PacsContext())
            {
                var part = (from p in ctx.ServerPartitions select p).FirstOrDefault();
                if (part != null)
                {
                    device = part.Devices.FirstOrDefault(d => d.AeTitle.Equals(aet));
                }
            }

            return(device);
        }
Exemplo n.º 3
0
        private bool IsChanged(IServerPartition partition)
        {
            // new partitions
            if (!_partitions.ContainsKey(partition.AeTitle))
            {
                return(true);
            }

            IServerPartition origalPartition = _partitions[partition.AeTitle];

            if (origalPartition.AcceptAnyDevice != partition.AcceptAnyDevice)
            {
                return(true);
            }

            if (origalPartition.AutoInsertDevice != partition.AutoInsertDevice)
            {
                return(true);
            }

            if (origalPartition.Description != partition.Description)
            {
                return(true);
            }

            if (origalPartition.Enable != partition.Enable)
            {
                return(true);
            }

            if (origalPartition.Port != partition.Port)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
        private void StartListeners(IServerPartition part)
        {
            var parms = new DicomScpContext(part);

            //TODO support IPV6
            var scp = new DicomScp <DicomScpContext>(parms, AssociationVerifier.Verify)
            {
                ListenPort = part.Port,
                AeTitle    = part.AeTitle
            };

            if (scp.Start(IPAddress.Any))
            {
                _listenerList.Add(scp);
                Log.Info("Start listen on {0} for server destAe {1}",
                         part.Port, part.Description);
            }
            else
            {
                Log.Error("Unable to listen on {0} for server destAe {1}",
                          part.Port, part.Description);
                Log.Error("destAe {0} will not accept any DICOM associations", part.Description);
            }
        }
Exemplo n.º 5
0
 public DicomScpContext(IServerPartition partition)
 {
     Partition = partition;
 }
Exemplo n.º 6
0
        public IDevice LookupDevice(IServerPartition partition, AssociationParameters association, out bool isNew)
        {
            isNew = false;

            Device device = null;

            using (var ctx = new PacsContext())
            {
                var part = (from p in ctx.ServerPartitions select p).FirstOrDefault();
                if (part != null)
                {
                    device = part.Devices.FirstOrDefault(d => d.AeTitle.Equals(association.CallingAE));
                }

                if (device == null)
                {
                    if (!partition.AcceptAnyDevice)
                    {
                        return(null);
                    }

                    if (partition.AutoInsertDevice)
                    {
                        device = new Device()
                        {
                            AeTitle           = association.CallingAE,
                            Enabled           = true,
                            Description       = string.Format("AE: {0}", association.CallingAE),
                            Hostname          = association.RemoteEndPoint.Address.ToString(),
                            Port              = 104,
                            AllowQuery        = true,
                            AllowRetrieve     = true,
                            AllowStorage      = true,
                            ServerPartitionPK = part.Id,
                            LastAccessTime    = DateTime.Now
                        };

                        ctx.Devices.Add(device);
                        ctx.SaveChanges();

                        isNew = true;
                    }
                }

                if (device != null)
                {
                    if (device.Dhcp && !association.RemoteEndPoint.Address.ToString().Equals(device.Hostname))
                    {
                        device.Hostname = association.RemoteEndPoint.Address.ToString();

                        device.LastAccessTime = DateTime.Now;
                        ctx.SaveChanges();
                    }
                    else if (!isNew)
                    {
                        device.LastAccessTime = DateTime.Now;
                        ctx.SaveChanges();
                    }
                }
            }

            return(device);
        }
Exemplo n.º 7
0
 public PacsStorageScu(IServerPartition partition, IDevice remoteDevice)
     : base(partition.AeTitle, remoteDevice.AeTitle, remoteDevice.Hostname, remoteDevice.Port)
 {
     _remoteDevice = remoteDevice;
 }