L_DicomSendNReportRequest

#include "ltdic.h"

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

HDICOMNET hNet;

/* a DICOM Network handle */

L_UCHAR nPresentationID;

/* presentation ID */

L_UINT16 nMessageID;

/* message ID */

L_CHAR * pszClass;

/* class type */

L_CHAR * pszInstance;

/* instance */

L_UINT16 nEvent;

/* event */

HDICOMDS hDS;

/* data set */

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

Parameter

Description

hNet

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

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.

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.

pszClass

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

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.

nEvent

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

hDS

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

Returns

0

SUCCESS

>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

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:

L_DicomSendNReportResponse, RECEIVENREPORTREQUESTCALLBACK, RECEIVENREPORTRESPONSECALLBACK

Topics:

Working with DICOM Network Connections

Example

HWND hList;      /* handle to list box */
HDICOMNET hServer;

L_VOID TestSendNReport(L_VOID)
{
   L_UINT32 x;
   HDICOMNET hClient=NULL;
   L_CHAR szClass[200];
   L_CHAR szInstance[200];
   L_CHAR szMsg[200];
   HDICOMPDU hPDU;
   L_UCHAR nID;
   HDICOMDS hDS=NULL;
   pDICOMTAG pTag = NULL;
   pDICOMELEMENT pElement=NULL;
   VALUEDATE d;
   VALUETIME t;
   
   /* 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, "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);
   
   pTag = L_DicomFindTag(TAG_INSTANCE_CREATION_DATE);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_INSTANCE_CREATION_DATE, pTag->nVR, FALSE, 0);
   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);
   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);
   L_DicomSetStringValue(hDS, pElement, "9.9.9999.9", 1); /* some unique value */
   
   pTag = L_DicomFindTag(TAG_PATIENT_NAME);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_NAME, pTag->nVR, FALSE, 0);
   L_DicomSetStringValue(hDS, pElement, "dummy_patient_name", 1);

   pTag = L_DicomFindTag(TAG_PATIENT_ID);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_ID, pTag->nVR, FALSE, 0);
   L_DicomSetStringValue(hDS, pElement, "dummy_patient_id", 1);

   pTag = L_DicomFindTag(TAG_PATIENT_BIRTH_DATE);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_BIRTH_DATE, pTag->nVR, FALSE, 0);
   L_DicomSetStringValue(hDS, pElement, "dummy_patient_id", 1);

   pTag = L_DicomFindTag(TAG_PATIENT_BIRTH_DATE);
   pElement = L_DicomInsertElement(hDS, NULL, FALSE, TAG_PATIENT_BIRTH_DATE, pTag->nVR, FALSE, 0);
   L_DicomSetStringValue(hDS, pElement, "dummy_patient_id", 1);
   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);
   L_DicomSetStringValue(hDS, pElement, "M", 1);

   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, "Abstract Syntax %s Not Supported by Association!", szClass);
         MessageBox(NULL, szMsg, "Error", MB_OK);
      }
      else
      {
         /* now, send the message */
         L_DicomSendNReportRequest(hClient, nID, 1, szClass, szInstance, 1, hDS);
      }
   }
   L_DicomFreeDS(hDS);
}