comparison OrthancServer/ServerJobs/DicomMoveScuJob.cpp @ 3870:09798f2b985f transcoding

added a Timeout argument to every DICOM command + 'TargetAet' not mandatory anymore in /retrieve
author Alain Mazy <alain@mazy.be>
date Wed, 29 Apr 2020 12:26:51 +0200
parents 138d0dde41b5
children 2effa961f67f
comparison
equal deleted inserted replaced
3869:c23ef85c7d9c 3870:09798f2b985f
38 38
39 static const char* const LOCAL_AET = "LocalAet"; 39 static const char* const LOCAL_AET = "LocalAet";
40 static const char* const TARGET_AET = "TargetAet"; 40 static const char* const TARGET_AET = "TargetAet";
41 static const char* const REMOTE = "Remote"; 41 static const char* const REMOTE = "Remote";
42 static const char* const QUERY = "Query"; 42 static const char* const QUERY = "Query";
43 static const char* const TIMEOUT = "Timeout";
43 44
44 namespace Orthanc 45 namespace Orthanc
45 { 46 {
46 class DicomMoveScuJob::Command : public SetOfCommandsJob::ICommand 47 class DicomMoveScuJob::Command : public SetOfCommandsJob::ICommand
47 { 48 {
97 if (connection_.get() == NULL) 98 if (connection_.get() == NULL)
98 { 99 {
99 connection_.reset(new DicomControlUserConnection(localAet_, remote_)); 100 connection_.reset(new DicomControlUserConnection(localAet_, remote_));
100 } 101 }
101 102
103 if (timeout_ > -1)
104 {
105 connection_->SetTimeout(timeout_);
106 }
107
102 connection_->Move(targetAet_, findAnswer); 108 connection_->Move(targetAet_, findAnswer);
103 } 109 }
104 110
105 111
106 static void AddTagIfString(Json::Value& target, 112 static void AddTagIfString(Json::Value& target,
212 if (serialized.isMember(QUERY) && 218 if (serialized.isMember(QUERY) &&
213 serialized[QUERY].type() == Json::arrayValue) 219 serialized[QUERY].type() == Json::arrayValue)
214 { 220 {
215 query_ = serialized[QUERY]; 221 query_ = serialized[QUERY];
216 } 222 }
223
224 // New in Orthanc in 1.7.0
225 timeout_ = SerializationToolbox::ReadInteger(serialized, TIMEOUT, -1);
217 } 226 }
218 227
219 228
220 bool DicomMoveScuJob::Serialize(Json::Value& target) 229 bool DicomMoveScuJob::Serialize(Json::Value& target)
221 { 230 {
226 else 235 else
227 { 236 {
228 target[LOCAL_AET] = localAet_; 237 target[LOCAL_AET] = localAet_;
229 target[TARGET_AET] = targetAet_; 238 target[TARGET_AET] = targetAet_;
230 target[QUERY] = query_; 239 target[QUERY] = query_;
240 target[TIMEOUT] = timeout_;
231 remote_.Serialize(target[REMOTE], true /* force advanced format */); 241 remote_.Serialize(target[REMOTE], true /* force advanced format */);
232 return true; 242 return true;
233 } 243 }
234 } 244 }
235 } 245 }