Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 3875:ea1d32861cfc transcoding
moving timeout from DicomAssocation to DicomAssociationParameters
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 May 2020 14:49:31 +0200 |
parents | 2effa961f67f |
children | 92ecaf877baf |
comparison
equal
deleted
inserted
replaced
3874:2effa961f67f | 3875:ea1d32861cfc |
---|---|
85 int timeout = Toolbox::GetJsonIntegerField(request, "Timeout", -1); | 85 int timeout = Toolbox::GetJsonIntegerField(request, "Timeout", -1); |
86 | 86 |
87 try | 87 try |
88 { | 88 { |
89 DicomAssociationParameters params(localAet, remote); | 89 DicomAssociationParameters params(localAet, remote); |
90 | |
91 // New in Orthanc 1.7.0 | |
92 if (timeout >= 0) | |
93 { | |
94 params.SetTimeout(static_cast<uint32_t>(timeout)); | |
95 } | |
96 | |
90 DicomControlUserConnection connection(params); | 97 DicomControlUserConnection connection(params); |
91 | |
92 // New in Orthanc 1.7.0 | |
93 if (timeout != -1) | |
94 { | |
95 connection.SetTimeout(timeout); | |
96 } | |
97 | 98 |
98 if (connection.Echo()) | 99 if (connection.Echo()) |
99 { | 100 { |
100 // Echo has succeeded | 101 // Echo has succeeded |
101 call.GetOutput().AnswerBuffer("{}", MimeType_Json); | 102 call.GetOutput().AnswerBuffer("{}", MimeType_Json); |
647 { | 648 { |
648 QueryAccessor query(call); | 649 QueryAccessor query(call); |
649 job->SetTargetAet(targetAet); | 650 job->SetTargetAet(targetAet); |
650 job->SetLocalAet(query.GetHandler().GetLocalAet()); | 651 job->SetLocalAet(query.GetHandler().GetLocalAet()); |
651 job->SetRemoteModality(query.GetHandler().GetRemoteModality()); | 652 job->SetRemoteModality(query.GetHandler().GetRemoteModality()); |
652 job->SetTimeout(timeout); | 653 |
654 if (timeout >= 0) | |
655 { | |
656 job->SetTimeout(static_cast<uint32_t>(timeout)); | |
657 } | |
653 | 658 |
654 LOG(WARNING) << "Driving C-Move SCU on remote modality " | 659 LOG(WARNING) << "Driving C-Move SCU on remote modality " |
655 << query.GetHandler().GetRemoteModality().GetApplicationEntityTitle() | 660 << query.GetHandler().GetRemoteModality().GetApplicationEntityTitle() |
656 << " to target modality " << targetAet; | 661 << " to target modality " << targetAet; |
657 | 662 |
995 { | 1000 { |
996 job->EnableStorageCommitment(true); | 1001 job->EnableStorageCommitment(true); |
997 } | 1002 } |
998 | 1003 |
999 // New in Orthanc 1.7.0 | 1004 // New in Orthanc 1.7.0 |
1000 job->SetTimeout(timeout); | 1005 if (timeout >= 0) |
1006 { | |
1007 job->SetTimeout(static_cast<uint32_t>(timeout)); | |
1008 } | |
1001 | 1009 |
1002 OrthancRestApi::GetApi(call).SubmitCommandsJob | 1010 OrthancRestApi::GetApi(call).SubmitCommandsJob |
1003 (call, job.release(), true /* synchronous by default */, request); | 1011 (call, job.release(), true /* synchronous by default */, request); |
1004 } | 1012 } |
1005 | 1013 |
1059 | 1067 |
1060 const RemoteModalityParameters source = | 1068 const RemoteModalityParameters source = |
1061 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); | 1069 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); |
1062 | 1070 |
1063 DicomAssociationParameters params(localAet, source); | 1071 DicomAssociationParameters params(localAet, source); |
1072 | |
1073 // New in Orthanc 1.7.0 | |
1074 if (timeout >= 0) | |
1075 { | |
1076 params.SetTimeout(static_cast<uint32_t>(timeout)); | |
1077 } | |
1078 | |
1064 DicomControlUserConnection connection(params); | 1079 DicomControlUserConnection connection(params); |
1065 | 1080 |
1066 if (timeout > -1) | |
1067 { | |
1068 connection.SetTimeout(timeout); | |
1069 } | |
1070 | |
1071 for (Json::Value::ArrayIndex i = 0; i < request[KEY_RESOURCES].size(); i++) | 1081 for (Json::Value::ArrayIndex i = 0; i < request[KEY_RESOURCES].size(); i++) |
1072 { | 1082 { |
1073 DicomMap resource; | 1083 DicomMap resource; |
1074 FromDcmtkBridge::FromJson(resource, request[KEY_RESOURCES][i]); | 1084 FromDcmtkBridge::FromJson(resource, request[KEY_RESOURCES][i]); |
1075 | 1085 |