LDicomPrintSCU::GetPrinterConfiguration
#include "ltdic.h"
L_INT LDicomPrintSCU::GetPrinterConfiguration()
Queries the Print SCP for the printer configuration information.
Returns
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
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: |
Class Members, LDicomPrintSCU::m_PrinterConfiguration, LDicomPrintSCU::GetLastOperationStatus, LDicomPrintSCU::GetPrinterInfo |
Topics: |
|
|
Example
L_VOID GetPrinterConfigInfo(LDicomPrintSCU& PrintSCU)
{
// Assume that the Association is already established
// Query the Print SCP for the printer configuration information
if (PrintSCU.GetPrinterConfiguration () == DICOM_SUCCESS)
{
// We will display only the Printer Name and Memory Bit Depth
// in the first Item
LDicomDS& PrnConfig = PrintSCU.m_PrinterConfiguration;
pDICOMELEMENT pElement;
L_CHAR szPrnConfigInfo[128];
pElement = PrnConfig.FindFirstElement (NULL,
TAG_PRINTER_CONFIGURATION_SEQUENCE,
FALSE);
if (!pElement)
return;
pElement = PrnConfig.GetChildElement (pElement, TRUE);
if (!pElement)
return;
pElement = PrnConfig.GetChildElement (pElement, TRUE);
if (!pElement)
return;
wsprintf(szPrnConfigInfo, "Printer Name: ");
pDICOMELEMENT pPrinterName;
pPrinterName = PrnConfig.FindFirstElement (pElement,
TAG_PRINTER_NAME,
TRUE);
if (pPrinterName)
{
L_CHAR* pszPrinterName = PrnConfig.GetStringValue (pPrinterName, 0, 1);
if (pszPrinterName)
{
wsprintf(szPrnConfigInfo, "%s%s", szPrnConfigInfo, pszPrinterName);
}
}
wsprintf(szPrnConfigInfo, "%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, "%s%hu",
szPrnConfigInfo, *pnMemoryBitDepth);
}
}
MessageBox(NULL, szPrnConfigInfo, "Printer Config Info", MB_OK);
}
}