LDicomNet::OnReceiveAssociateRequest

#include "ltdic.h"

virtual L_VOID LDicomNet::OnReceiveAssociateRequest(pPDU)

LDicomAssociate *pPDU;

/* a DICOM Association object */

Notifies a connection that an Associate Request message was received. This function is available in the Medical Suite Toolkit.

Parameter

Description

pPDU

A DICOM Associate object.

Returns

None.

Comments

A call to this function is generated on an SCP when an SCU calls LDicomNet::SendAssociateRequest. For more information on DICOM Associate connections, refer to Creating a DICOM Associate Connection.

To customize this function, you must derive a class from LDicomNet and override this function.

When the DICOM Association is no longer needed, it should be ended. For more information, refer to Closing a DICOM Associate Connection.

Required DLLs and Libraries

LTDIC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LDicomNet::SendAssociateReject, LDicomNet::SendAssociateAccept, LDicomNet::SendAssociateRequest, LDicomNet::OnReceiveAssociateAccept, LDicomNet::OnReceiveAssociateRequest

Topics:

Creating a DICOM Associate Connection

 

Receiving Messages

 

Diagram of a Basic SCU-SCP Set-up

 

Creating an SCU

 

Creating an SCP

Example

//LMyDicomNet is a class derived from LDicomNet
//In class LMyDicomNet, all events (virtual functions OnXXX())  have been 
//overridden so that they can be processed.  Each event displays a MessageBox 
//identifying the event, the IP that generated the event, the IP that received the event, and
//any other relevant data.

For the entire derived class, see (hyperlink)LMyDicomNet class

L_VOID   LMyDicomNet::OnReceiveAssociateRequest(LDicomAssociate *pPDU)
{
   CString strMsg;
   int i;
   int nId;
   int nResult;
   CString strAbstract;
   CString strTransfer;
   
   strMsg = "*** OnReceiveAssociateRequest ***\n";
   
   //check the version, if not 1, reject it
   if (pPDU->GetVersion() != 1)
   {
      SendAssociateReject(
         PDU_REJECT_RESULT_PERMANENT, 
         PDU_REJECT_SOURCE_USER, 
         PDU_REJECT_REASON_UNKNOWN
         );
   }
   else
   {        
      //send associate accept class back
      LDicomAssociate DicomAssociate(FALSE);
      
      //copy all presentation objects from received
      //Reply that we only support the first Transfer Syntax from the received hPDU

      L_INT iPresentationCount = pPDU->GetPresentationCount();
      for (i = 0; i<iPresentationCount; i++)
      {
         nId = pPDU->GetPresentation(i);
         strTransfer = pPDU->GetTransfer(nId, 0);
         nResult = PDU_ACCEPT_RESULT_SUCCESS;
         strAbstract = pPDU->GetAbstract(nId);
         DicomAssociate.AddPresentation( nId, nResult, (L_CHAR *)(LPCTSTR)strAbstract);
         DicomAssociate.AddTransfer( nId, (L_CHAR *)(LPCTSTR)strTransfer);
      }
      SendAssociateAccept(&DicomAssociate);
   }
   
   AfxMessageBox(strMsg);
}