LDicomPrintSCU::GetPrinterConfiguration

#include "ltdic.h"

L_INT LDicomPrintSCU::GetPrinterConfiguration()

Queries the Print SCP for the printer configuration information.

Returns

Value Meaning
0 The printer configuration information was retrieved successfully.
DICOM_ERROR_PRINTSCU_FAILURE_STATUS The response of the Print SCP specifies a Failure status code.
DICOM_ERROR_PRINTSCU_CLASS_NOT_SUPPORTED The Printer Configuration Retrieval SOP Class is not supported on the Association.
> 0 An error occurred. Refer to Return Codes.

Comments

The function will not return until it receives the response of the Print SCP, or an error occurs. The function LDicomPrintSCU::GetLastOperationStatus can be used to obtain the status code specified in the response of the Print SCP. When the return value of the function GetPrinterConfiguration is 0, then the printer configuration information was retrieved successfully, with either a Success or Warning status code in the response of the Print SCP.

The retrieved printer configuration information is stored in the data member LDicomPrintSCU::m_PrinterConfiguration, which is an LDicomDS object.

Required DLLs and Libraries

Platforms

Win32, x64

See Also

Functions

Topics

Example

L_INT LDicomPrintSCU_GetPrinterConfigurationExample(LDicomPrintSCU& PrintSCU) 
{ 
   L_INT nRet; 
   // Assume that the Association is already established 
 
   // Query the Print SCP for the printer configuration information 
   nRet = PrintSCU.GetPrinterConfiguration (); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
   else 
   { 
      // We will display only the Printer Name and Memory Bit Depth 
      // in the first Item 
 
      LDicomDS&      PrnConfig = PrintSCU.m_PrinterConfiguration;  
      pDICOMELEMENT  pElement;  
      L_TCHAR        szPrnConfigInfo[128];  
 
      pElement = PrnConfig.FindFirstElement (NULL,  
                                            TAG_PRINTER_CONFIGURATION_SEQUENCE,  
                                            FALSE);  
 
      if (!pElement) 
         return -1; 
 
      pElement = PrnConfig.GetChildElement (pElement, TRUE);  
      if (!pElement)  
         return -1; 
 
      pElement = PrnConfig.GetChildElement (pElement, TRUE);  
      if (!pElement)  
         return -1; 
 
      wsprintf(szPrnConfigInfo, TEXT("Printer Name: ")); 
 
      pDICOMELEMENT pPrinterName;  
      pPrinterName = PrnConfig.FindFirstElement (pElement,  
                                                TAG_PRINTER_NAME,  
                                                TRUE); 
 
      if (pPrinterName)  
      { 
         L_TCHAR* pszPrinterName = PrnConfig.GetStringValue (pPrinterName, 0, 1);  
         if (pszPrinterName)  
         { 
            wsprintf(szPrnConfigInfo, TEXT("%s%s"), szPrnConfigInfo, pszPrinterName);  
         } 
      } 
 
      wsprintf(szPrnConfigInfo, TEXT("%s\nMemory Bit Depth: "), szPrnConfigInfo);  
 
      pDICOMELEMENT pMemoryBitDepth;  
      pMemoryBitDepth = PrnConfig.FindFirstElement (pElement,  
                                                   TAG_MEMORY_BIT_DEPTH,  
                                                   TRUE);  
 
      if (pMemoryBitDepth)  
      { 
         L_INT16* pnMemoryBitDepth = PrnConfig.GetShortValue(pMemoryBitDepth,  
                                                             0,  
                                                             1);  
         if (pnMemoryBitDepth)  
         { 
            wsprintf(szPrnConfigInfo, TEXT("%s%hu"), 
                     szPrnConfigInfo, *pnMemoryBitDepth);  
         } 
      } 
 
      MessageBox(NULL, szPrnConfigInfo, TEXT("Printer Config Info"), MB_OK);  
   } 
 
   return DICOM_SUCCESS; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C++ Class Library Help