L_DicomSendNReportRequest

#include "ltdic.h"

L_LTDIC_API L_INT L_DicomSendNReportRequest(hNet, nPresentationID, nMessageID, pszClass, pszInstance, nEvent, hDS)

Sends an N-EVENT-REPORT-REQ message to a peer member of a connection. This function is available in the PACS Imaging Toolkit.

Parameters

HDICOMNET hNet

A DICOM Network handle to the peer member of the connection.

L_UCHAR nPresentationID

Presentation ID. The presentation ID provides information about both the class type of the data and the transfer syntax to use when transferring the data.

L_UINT16 nMessageID

Message ID. Each message sent by a member of a connection should have a unique ID. Since a member of a connection may send several messages, this ID allows that member to identify when a specific request has been completed.

L_TCHAR * pszClass

Class affected by the request. This will be an SOP Class or an SOP MetaClass.

L_TCHAR * pszInstance

The instance of the class. A server may, for example, have three instances of the Nuclear Medicine Class. This value identifies the data with a specific instance.

L_UINT16 nEvent

An application specific event for which a report is to be generated.

HDICOMDS hDS

Application specific data set which contains information related to the operation.

Returns

Value Meaning
DICOM_SUCCESS The function was successful.
>0 An error occurred. Refer to Return Codes.

Comments

Calling this function generates a call to RECEIVENREPORTREQUESTCALLBACK on the SCP. The SCP should respond by calling L_DicomSendNReportResponse which will generate a call to RECEIVENREPORTRESPONSECALLBACK.

A report is generated to let all peers attached to a server know of some event that has occurred. This event may be the addition of a new patient, the deletion of a patient, the addition of a new study, etc. The nEvent value, which designates the event that occurred is determined by the server. To find out the values used, you must contact the organization that created the server. When creating a server, the values and their corresponding meanings are determined by those creating the server.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_INT DicomSendNReportRequestExample(HDICOMNET hServer) 
{ 
   L_UINT32 x; 
   HDICOMNET hClient=NULL; 
   L_TCHAR szClass[200]; 
   L_TCHAR szInstance[200]; 
   L_TCHAR szMsg[200]; 
   HDICOMPDU hPDU; 
   L_UCHAR nID; 
   HDICOMDS hDS=NULL; 
   pDICOMTAG pTag = NULL; 
   pDICOMELEMENT pElement=NULL; 
   VALUEDATE d; 
   VALUETIME t; 
   L_INT nRet; 
    
   /* send an event report message to all clients */ 
   /* let them know a new patient was created */ 
    
   /* this sample just uses a made up instance */ 
   lstrcpy(szClass, UID_US_IMAGE_STORAGE); 
   lstrcpy(szInstance, TEXT("1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1")); 
    
   /* create the data set */ 
   hDS = L_DicomCreateDS(NULL); 
   L_DicomInitDS(hDS, CLASS_UNKNOWN, 0); 
    
   /* add the required elements */ 
   pTag = L_DicomFindTag(TAG_SPECIFIC_CHARACTER_SET); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_SPECIFIC_CHARACTER_SET, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
    
   pTag = L_DicomFindTag(TAG_INSTANCE_CREATION_DATE); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_INSTANCE_CREATION_DATE, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   d.nDay   = 31; 
   d.nMonth = 12; 
   d.nYear  = 1999; 
   L_DicomSetDateValue(hDS, pElement, &d, 1); 
    
   pTag = L_DicomFindTag(TAG_INSTANCE_CREATION_TIME); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_INSTANCE_CREATION_TIME, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   t.nHours       = 12; 
   t.nMinutes     = 30; 
   t.nSeconds     = 0; 
   t.nFractions   = 0; 
   L_DicomSetTimeValue(hDS, pElement, &t, 1); 
    
   pTag = L_DicomFindTag(TAG_INSTANCE_CREATOR_UID); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_INSTANCE_CREATOR_UID, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   L_DicomSetStringValue(hDS, pElement, TEXT("9.9.9999.9"), 1, DICOM_CHARACTER_SET_DEFAULT); /* some unique value */ 
    
   pTag = L_DicomFindTag(TAG_PATIENT_NAME); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_NAME, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   L_DicomSetStringValue(hDS, pElement, TEXT("dummy_patient_name"), 1, DICOM_CHARACTER_SET_DEFAULT); 
 
   pTag = L_DicomFindTag(TAG_PATIENT_ID); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_ID, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   L_DicomSetStringValue(hDS, pElement, TEXT("dummy_patient_id"), 1, DICOM_CHARACTER_SET_DEFAULT); 
 
   pTag = L_DicomFindTag(TAG_PATIENT_BIRTH_DATE); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_BIRTH_DATE, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   L_DicomSetStringValue(hDS, pElement, TEXT("dummy_patient_id"), 1, DICOM_CHARACTER_SET_DEFAULT); 
 
   pTag = L_DicomFindTag(TAG_PATIENT_BIRTH_DATE); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_BIRTH_DATE, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   L_DicomSetStringValue(hDS, pElement, TEXT("dummy_patient_id"), 1, DICOM_CHARACTER_SET_DEFAULT); 
   L_DicomSetDateValue(hDS, pElement, &d, 1); 
    
   pTag = L_DicomFindTag(TAG_PATIENT_SEX); 
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_SEX, pTag->nVR, FALSE, 0); 
   if (pElement == NULL) 
   { 
      L_DicomFreeDS(hDS); 
      return DICOM_ERROR_MEMORY; 
   } 
 
   L_DicomSetStringValue(hDS, pElement, TEXT("M"), 1, DICOM_CHARACTER_SET_DEFAULT); 
 
   for(x=0; x<L_DicomGetClientCount(hServer); x++) 
   { 
      hClient = L_DicomGetClient(hServer, x); 
      hPDU = L_DicomGetAssociate(hClient); 
      nID = L_DicomFindAbstract(hPDU, szClass); 
      if(nID == 0) 
      { 
         wsprintf(szMsg, TEXT("Abstract Syntax %s Not Supported by Association!"), szClass); 
         MessageBox(NULL, szMsg, TEXT("Error"), MB_OK); 
      } 
      else 
      { 
         /* now, send the message */ 
         nRet = L_DicomSendNReportRequest(hClient, nID, 1, szClass, szInstance, 1, hDS); 
         if (nRet != DICOM_SUCCESS) 
         { 
            L_DicomFreeDS(hDS); 
            return nRet; 
         } 
      } 
   } 
   L_DicomFreeDS(hDS); 
   return DICOM_SUCCESS; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.