Using the Events OnStatus, OnPrinterReport, and OnPrintJobReport (Delphi)
// global
LEADDicomPrintSCU1: TLEADDicomPrintSCU;
procedure TForm1.LEADDicomPrintSCU1Status(ASender: TObject;
Status: TOleEnum; OperationStatus: Integer);
var
strMsg: String;
strStatusCodeType: String;
strOpStatus: String;
begin
Case (Status) of
PRNSCU_STATUS_RECEIVE_ABORT:
begin
strMsg:= 'Source = ' + IntToStr(LEADDicomPrintSCU1.AbortSource) + ', ' +
'Reason = ' + IntToStr(LEADDicomPrintSCU1.AbortReason);
Application.MessageBox(PChar(strMsg), 'Print SCP Aborted the Association', MB_OK);
end;
PRNSCU_STATUS_RECEIVE_PRINT_FILM_SESSION_RSP:
begin
if(OperationStatus = COMMAND_STATUS_SUCCESS)then
begin
if(LEADDicomPrintSCU1.LastOperationStatus = COMMAND_STATUS_SUCCESS)then
strStatusCodeType:= 'Success'
else
strStatusCodeType:= 'Warning';
end
else
strStatusCodeType:= 'Failure';
strOpStatus:= IntToStr(LEADDicomPrintSCU1.LastOperationStatus);
while(Length(strOpStatus) < 4)do
begin
strOpStatus:= '0' + strOpStatus;
end;
strOpStatus:= '0x' + strOpStatus;
StrMsg:= 'Status: ' + strOpStatus + ' (' + strStatusCodeType + ')';
Application.MessageBox(PChar(strMsg), 'Received N-ACTION-RSP (Basic Film Session SOP Class)', MB_OK);
end;
end;
end;
procedure TForm1.LEADDicomPrintSCU1PrinterReport(ASender: TObject;
EventTypeID: Smallint; const PrinterStatusInfo, FilmDestination,
PrinterName: WideString);
var
strMsg: String;
strEventTypeName: String;
begin
strEventTypeName:= 'Normal';
Case (EventTypeID) of
2:
begin
strEventTypeName:= 'Warning';
end;
3:
begin
strEventTypeName:= 'Failure';
end;
end;
strMsg:= 'Event Type Name: ' + strEventTypeName;
if(EventTypeID <> 1)then
begin
strMsg:= strMsg + Chr(13) +
'Printer Status Info: ' + PrinterStatusInfo + Chr(13) +
'Film Destination: ' + FilmDestination + Chr(13) +
'Printer Name: ' + PrinterName;
end;
Application.MessageBox(Pchar(strMsg), 'Printer Status Report', MB_OK);
end;
procedure TForm1.LEADDicomPrintSCU1PrintJobReport(ASender: TObject;
const PrintJobSOPInstanceUID: WideString; EventTypeID: Smallint;
const ExecutionStatusInfo, PrintJobID, FilmSessionLabel,
PrinterName: WideString);
var
strMsg: String;
strEventTypeName: String;
begin
strEventTypeName:= 'Pending';
Case (EventTypeID) of
2:
begin
strEventTypeName:= 'Printing';
end;
3:
begin
strEventTypeName:= 'Done';
end;
4:
begin
strEventTypeName:= 'Failure'
end;
end;
strMsg:= 'Print Job SOP Instance UID: ' + PrintJobSOPInstanceUID + Chr(13) +
'Event Type Name: ' + strEventTypeName + Chr(13) +
'Execution Status Info: ' + ExecutionStatusInfo + Chr(13) +
'Film Session Label: ' + FilmSessionLabel + Chr(13) +
'Printer Name: ' + PrinterName;
Application.MessageBox(PChar(strMsg), 'Print Job Status Report', MB_OK);
end;