Exemplo n.º 1
0
        protected override void OnAccept(DicomExceptionCode error)
        {
            if (error == DicomExceptionCode.Success)
            {
                CFindClient client = new CFindClient(this);

                Accept(client);
            }
        }
Exemplo n.º 2
0
        public void DoAssociateRequest(CFindClient client, DicomAssociate association)
        {
            using (DicomAssociate retAssociate = new DicomAssociate(false))
            {
                if (retAssociate == null)
                {
                    client.SendAssociateReject(DicomAssociateRejectResultType.Permanent,
                                               DicomAssociateRejectSourceType.Provider1,
                                               DicomAssociateRejectReasonType.Application);
                    return;
                }

                retAssociate.MaxLength = 46726;
                retAssociate.Version   = 1;
                retAssociate.Called    = (CalledAE == null) ? association.Called : CalledAE;
                retAssociate.Calling   = (CallingAE == null) ? association.Calling : CallingAE;
                retAssociate.ApplicationContextName = (string)DicomUidType.ApplicationContextName;

                for (int i = 0; i < association.PresentationContextCount; i++)
                {
                    byte   id             = association.GetPresentationContextID(i);
                    string abstractSyntax = association.GetAbstract(id);

                    retAssociate.AddPresentationContext(id, DicomAssociateAcceptResultType.Success, abstractSyntax);
                    if (IsSupported(abstractSyntax))
                    {
                        for (int j = 0; j < association.GetTransferCount(id); j++)
                        {
                            string transferSyntax = association.GetTransfer(id, j);

                            if (IsSupported(transferSyntax))
                            {
                                retAssociate.AddTransfer(id, transferSyntax);
                                break;
                            }
                        }

                        if (retAssociate.GetTransferCount(id) == 0)
                        {
                            //
                            // Presentation id doesn't have any abstract
                            //  syntaxes therefore we will reject it.
                            //
                            retAssociate.SetResult(id, DicomAssociateAcceptResultType.AbstractSyntax);
                        }
                    }
                    else
                    {
                        retAssociate.SetResult(id, DicomAssociateAcceptResultType.AbstractSyntax);
                    }
                }

                if (association.MaxLength != 0)
                {
                    retAssociate.MaxLength = association.MaxLength;
                }

                retAssociate.ImplementClass            = ImplementationClass;
                retAssociate.ImplementationVersionName = ImplementationVersionName;

                client.SendAssociateAccept(retAssociate);
            }
        }