SendCFindResponse Example for Delphi
procedure TForm1.LEADDicomNet1NetReceiveCFindRequest(ASender: TObject;
hNet: Integer; nPresentationID, nMessageID: Smallint;
const pszClass: WideString; nPriority: Smallint; hDS: Integer);
var
x: Integer;
hPDU: LongInt;
strAE: String;
NewNode: TTreeNode;
nRet: Integer;
strName: String;
strFile: String;
begin
//this sample simple returns all the data sets that it is managing.
//in a real-life scenario, this should perform an actual query based
//on the attribute values supplied in hDS
hPDU:= LEADDICOMNet1.GetAssociate (hNet);
strAE:= LEADDICOMNet1.GetCalling(hPDU);
NewNode:= TreeView1.Items.Add(TreeView1.Selected, 'Command Set - ' + 'C-FIND-REQUEST');
NewNode.MakeVisible();
TreeView1.Items.Add(NewNode, 'Presentation ID: ' + IntToStr(nPresentationID));
TreeView1.Items.Add(NewNode, 'Message ID: ' + IntToStr(nMessageID));
nRet:= LEADDicomDS1.FindUID (pszClass);
if(nRet = 0)then
begin
strName:= LEADDicomDS1.DefaultInterface.Get_CurrentUID().Name;
TreeView1.Items.Add(NewNode, 'Affected SOP Class: ' + strName + ' - ' + pszClass);
end
else
TreeView1.Items.Add(NewNode, 'Affected SOP Class: ' + pszClass);
TreeView1.Items.Add(NewNode, 'Priority: ' + IntToStr(nPriority));
if(FileListBox1.Items.Count > 1)then
begin
for x:= 0 to FileListBox1.Items.Count - 1 do
begin
//load each file and send it to the calling AE
strFile:= FileListBox1.Directory + '\' + FileListBox1.Items[x];
nRet:= LEADDicomDS1.LoadDS (strFile, 0);
if(nRet = 0)then
begin
//now, send a Find Response - PENDING
LEADDICOMNet1.SendCFindResponse(hNet, nPresentationID, nMessageID, pszClass, COMMAND_STATUS_PENDING, LEADDicomDS1.hDicomDS);
end;
end;
end;
//now, send a Find Response - SUCCESS
LEADDICOMNet1.SendCFindResponse(hNet, nPresentationID, nMessageID, pszClass, COMMAND_STATUS_SUCCESS, 0);
end;