Write() public méthode

Writes A-ASSOCIATE-AC to PDU buffer
public Write ( ) : RawPDU
Résultat RawPDU
Exemple #1
0
        public void AssociateAC_WriteRead_ExpectedExtendedNegotiation(DicomUID sopClassUid, DicomServiceApplicationInfo applicationInfo, DicomUID commonServiceClass, DicomUID[] relatedSopClasses)
        {
            var inAssociation = new DicomAssociation("testCalling", "testCalled");

            inAssociation.ExtendedNegotiations.Add(sopClassUid, applicationInfo, commonServiceClass, relatedSopClasses);
            var acceptedApplicationInfo = new DicomServiceApplicationInfo(applicationInfo.GetValues());

            acceptedApplicationInfo.AddOrUpdate(1, 10);
            inAssociation.ExtendedNegotiations.AcceptApplicationInfo(sopClassUid, acceptedApplicationInfo);

            var ac       = new AAssociateAC(inAssociation);
            var writePdu = ac.Write();

            var readPdu = ConvertWriteToReadPdu(writePdu);

            var outAssociation = new DicomAssociation();

            outAssociation.ExtendedNegotiations.Add(sopClassUid, applicationInfo);
            var ac2 = new AAssociateAC(outAssociation);

            ac2.Read(readPdu);

            Assert.Single(outAssociation.ExtendedNegotiations);
            var negotiation = outAssociation.ExtendedNegotiations.First();

            Assert.Equal(sopClassUid, negotiation.SopClassUid);
            Assert.Equal(applicationInfo, negotiation.RequestedApplicationInfo);
            Assert.Equal(acceptedApplicationInfo, negotiation.AcceptedApplicationInfo);
            Assert.Null(negotiation.ServiceClassUid);
            Assert.Empty(negotiation.RelatedGeneralSopClasses);
        }
Exemple #2
0
 /// <summary>
 /// The called AE shall accept or reject the association by sending an A-ASSOCIATE 
 /// response primitive with an appropriate Result parameter. The Upper layer 
 /// service-provider shall issue an A-ASSOCIATE confirmation primitive having the 
 /// same Result parameter. The Result Source parameter shall be assigned the 
 /// symbolic value of “UL service-user.”
 /// </summary>
 /// <param name="associate"></param>
 protected void SendAssociateAccept(DcmAssociate associate)
 {
     Log.Info("{0} -> Association accept:\n{1}", LogID, Associate.ToString());
     AAssociateAC pdu = new AAssociateAC(_assoc);
     SendRawPDU(pdu.Write());
 }