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 PACS Imaging 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   LMyDicomNetExt::OnReceiveAssociateRequest(LDicomAssociate *pPDU)
{
   CString strMsg;
   int i;
   L_UCHAR  uId;
   L_UCHAR nResult;
   CString strAbstract;
   CString strTransfer;
   
   strMsg = TEXT("*** 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();
      L_TCHAR szTransfer[PDU_MAX_UID_SIZE+1];
      L_TCHAR szAbstract[PDU_MAX_UID_SIZE+1];
      for (i = 0; i<iPresentationCount; i++)
      {
         uId = pPDU->GetPresentation(i);
         pPDU->GetTransfer(uId, 0,
    szTransfer, PDU_MAX_UID_SIZE+1 );
         strTransfer = szTransfer;
         nResult = PDU_ACCEPT_RESULT_SUCCESS;
         pPDU->GetAbstract(uId,
    szAbstract, PDU_MAX_UID_SIZE+1);
         strAbstract = szAbstract;
         DicomAssociate.AddPresentation( uId,nResult, (L_TCHAR *)(LPCTSTR)strAbstract);
         DicomAssociate.AddTransfer( uId, (L_TCHAR *)(LPCTSTR)strTransfer);
      }
      SendAssociateAccept(&DicomAssociate);
   }
   
   AfxMessageBox(strMsg);
}