Mercurial > hg > orthanc
comparison OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp @ 4281:d2f79a475b51
debug log for DCMTK SCU
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 04 Nov 2020 13:48:42 +0100 |
parents | 0034f855c023 |
children | 756126cd2219 |
comparison
equal
deleted
inserted
replaced
4280:58e757ded69e | 4281:d2f79a475b51 |
---|---|
68 int responseCount, | 68 int responseCount, |
69 T_DIMSE_C_FindRSP *response, /* pending response received */ | 69 T_DIMSE_C_FindRSP *response, /* pending response received */ |
70 DcmDataset *responseIdentifiers /* pending response identifiers */ | 70 DcmDataset *responseIdentifiers /* pending response identifiers */ |
71 ) | 71 ) |
72 { | 72 { |
73 if (response != NULL) | |
74 { | |
75 OFString str; | |
76 CLOG(TRACE, DICOM) << "Received Find Response " << responseCount << ":" << std::endl | |
77 << DIMSE_dumpMessage(str, *response, DIMSE_INCOMING); | |
78 } | |
79 | |
80 if (responseIdentifiers != NULL) | |
81 { | |
82 CLOG(TRACE, DICOM) << "Response Identifiers " << responseCount << ":" << std::endl | |
83 << DcmObject::PrintHelper(*responseIdentifiers); | |
84 } | |
85 | |
73 if (responseIdentifiers != NULL) | 86 if (responseIdentifiers != NULL) |
74 { | 87 { |
75 FindPayload& payload = *reinterpret_cast<FindPayload*>(callbackData); | 88 FindPayload& payload = *reinterpret_cast<FindPayload*>(callbackData); |
76 | 89 |
77 if (payload.isWorklist) | 90 if (payload.isWorklist) |
232 DcmDataset* dataset, | 245 DcmDataset* dataset, |
233 const char* sopClass, | 246 const char* sopClass, |
234 bool isWorklist, | 247 bool isWorklist, |
235 const char* level) | 248 const char* level) |
236 { | 249 { |
250 assert(dataset != NULL); | |
237 assert(isWorklist ^ (level != NULL)); | 251 assert(isWorklist ^ (level != NULL)); |
238 assert(association_.get() != NULL); | 252 assert(association_.get() != NULL); |
239 | 253 |
240 association_->Open(parameters_); | 254 association_->Open(parameters_); |
241 | 255 |
264 DcmDataset* statusDetail = NULL; | 278 DcmDataset* statusDetail = NULL; |
265 | 279 |
266 #if DCMTK_VERSION_NUMBER >= 364 | 280 #if DCMTK_VERSION_NUMBER >= 364 |
267 int responseCount; | 281 int responseCount; |
268 #endif | 282 #endif |
283 | |
284 { | |
285 OFString str; | |
286 CLOG(TRACE, DICOM) << "Sending Find Request:" << std::endl | |
287 << DIMSE_dumpMessage(str, request, DIMSE_OUTGOING, NULL, presID) << std::endl | |
288 << DcmObject::PrintHelper(*dataset); | |
289 } | |
269 | 290 |
270 OFCondition cond = DIMSE_findUser( | 291 OFCondition cond = DIMSE_findUser( |
271 &association_->GetDcmtkAssociation(), presID, &request, dataset, | 292 &association_->GetDcmtkAssociation(), presID, &request, dataset, |
272 #if DCMTK_VERSION_NUMBER >= 364 | 293 #if DCMTK_VERSION_NUMBER >= 364 |
273 responseCount, | 294 responseCount, |
282 delete statusDetail; | 303 delete statusDetail; |
283 } | 304 } |
284 | 305 |
285 DicomAssociation::CheckCondition(cond, parameters_, "C-FIND"); | 306 DicomAssociation::CheckCondition(cond, parameters_, "C-FIND"); |
286 | 307 |
308 { | |
309 OFString str; | |
310 CLOG(TRACE, DICOM) << "Received Final Find Response:" << std::endl | |
311 << DIMSE_dumpMessage(str, response, DIMSE_INCOMING); | |
312 } | |
313 | |
287 | 314 |
288 /** | 315 /** |
289 * New in Orthanc 1.6.0: Deal with failures during C-FIND. | 316 * New in Orthanc 1.6.0: Deal with failures during C-FIND. |
290 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.html#table_C.4-1 | 317 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.html#table_C.4-1 |
291 **/ | 318 **/ |
364 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN); | 391 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN); |
365 request.Priority = DIMSE_PRIORITY_MEDIUM; | 392 request.Priority = DIMSE_PRIORITY_MEDIUM; |
366 request.DataSetType = DIMSE_DATASET_PRESENT; | 393 request.DataSetType = DIMSE_DATASET_PRESENT; |
367 strncpy(request.MoveDestination, targetAet.c_str(), DIC_AE_LEN); | 394 strncpy(request.MoveDestination, targetAet.c_str(), DIC_AE_LEN); |
368 | 395 |
396 { | |
397 OFString str; | |
398 CLOG(TRACE, DICOM) << "Sending Move Request:" << std::endl | |
399 << DIMSE_dumpMessage(str, request, DIMSE_OUTGOING, NULL, presID); | |
400 } | |
401 | |
369 T_DIMSE_C_MoveRSP response; | 402 T_DIMSE_C_MoveRSP response; |
370 DcmDataset* statusDetail = NULL; | 403 DcmDataset* statusDetail = NULL; |
371 DcmDataset* responseIdentifiers = NULL; | 404 DcmDataset* responseIdentifiers = NULL; |
372 OFCondition cond = DIMSE_moveUser( | 405 OFCondition cond = DIMSE_moveUser( |
373 &association_->GetDcmtkAssociation(), presID, &request, dataset, NULL, NULL, | 406 &association_->GetDcmtkAssociation(), presID, &request, dataset, /*moveCallback*/ NULL, NULL, |
374 /*opt_blockMode*/ (parameters_.HasTimeout() ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), | 407 /*opt_blockMode*/ (parameters_.HasTimeout() ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
375 /*opt_dimse_timeout*/ parameters_.GetTimeout(), | 408 /*opt_dimse_timeout*/ parameters_.GetTimeout(), |
376 &association_->GetDcmtkNetwork(), NULL, NULL, | 409 &association_->GetDcmtkNetwork(), /*subOpCallback*/ NULL, NULL, |
377 &response, &statusDetail, &responseIdentifiers); | 410 &response, &statusDetail, &responseIdentifiers); |
378 | 411 |
379 if (statusDetail) | 412 if (statusDetail) |
380 { | 413 { |
381 delete statusDetail; | 414 delete statusDetail; |
386 delete responseIdentifiers; | 419 delete responseIdentifiers; |
387 } | 420 } |
388 | 421 |
389 DicomAssociation::CheckCondition(cond, parameters_, "C-MOVE"); | 422 DicomAssociation::CheckCondition(cond, parameters_, "C-MOVE"); |
390 | 423 |
424 { | |
425 OFString str; | |
426 CLOG(TRACE, DICOM) << "Received Final Move Response:" << std::endl | |
427 << DIMSE_dumpMessage(str, response, DIMSE_INCOMING); | |
428 } | |
391 | 429 |
392 /** | 430 /** |
393 * New in Orthanc 1.6.0: Deal with failures during C-MOVE. | 431 * New in Orthanc 1.6.0: Deal with failures during C-MOVE. |
394 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.2.html#table_C.4-2 | 432 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.2.html#table_C.4-2 |
395 **/ | 433 **/ |
470 query.reset(new ParsedDicomFile(originalFields, GetDefaultDicomEncoding(), | 508 query.reset(new ParsedDicomFile(originalFields, GetDefaultDicomEncoding(), |
471 false /* be strict */)); | 509 false /* be strict */)); |
472 } | 510 } |
473 | 511 |
474 DcmDataset* dataset = query->GetDcmtkObject().getDataset(); | 512 DcmDataset* dataset = query->GetDcmtkObject().getDataset(); |
513 assert(dataset != NULL); | |
475 | 514 |
476 const char* clevel = NULL; | 515 const char* clevel = NULL; |
477 const char* sopClass = NULL; | 516 const char* sopClass = NULL; |
478 | 517 |
479 switch (level) | 518 switch (level) |