comparison OrthancServer/ServerJobs/DicomMoveScuJob.cpp @ 3920:82e88ff003d7 c-get

merge default -> c-get
author Alain Mazy <alain@mazy.be>
date Tue, 12 May 2020 14:58:24 +0200
parents 4b4f387c6bb8
children
comparison
equal deleted inserted replaced
3918:dba48c162b7b 3920:82e88ff003d7
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 {
94 95
95 void DicomMoveScuJob::Retrieve(const DicomMap& findAnswer) 96 void DicomMoveScuJob::Retrieve(const DicomMap& findAnswer)
96 { 97 {
97 if (connection_.get() == NULL) 98 if (connection_.get() == NULL)
98 { 99 {
99 connection_.reset(new DicomControlUserConnection(localAet_, remote_)); 100 connection_.reset(new DicomControlUserConnection(parameters_));
100 } 101 }
101 102
102 connection_->Move(targetAet_, findAnswer); 103 connection_->Move(targetAet_, findAnswer);
103 } 104 }
104 105
150 { 151 {
151 throw OrthancException(ErrorCode_BadSequenceOfCalls); 152 throw OrthancException(ErrorCode_BadSequenceOfCalls);
152 } 153 }
153 else 154 else
154 { 155 {
155 localAet_ = aet; 156 parameters_.SetLocalApplicationEntityTitle(aet);
156 } 157 }
157 } 158 }
158 159
159 160
160 void DicomMoveScuJob::SetTargetAet(const std::string& aet) 161 void DicomMoveScuJob::SetTargetAet(const std::string& aet)
176 { 177 {
177 throw OrthancException(ErrorCode_BadSequenceOfCalls); 178 throw OrthancException(ErrorCode_BadSequenceOfCalls);
178 } 179 }
179 else 180 else
180 { 181 {
181 remote_ = remote; 182 parameters_.SetRemoteModality(remote);
183 }
184 }
185
186
187 void DicomMoveScuJob::SetTimeout(uint32_t seconds)
188 {
189 if (IsStarted())
190 {
191 throw OrthancException(ErrorCode_BadSequenceOfCalls);
192 }
193 else
194 {
195 parameters_.SetTimeout(seconds);
182 } 196 }
183 } 197 }
184 198
185 199
186 void DicomMoveScuJob::Stop(JobStopReason reason) 200 void DicomMoveScuJob::Stop(JobStopReason reason)
190 204
191 205
192 void DicomMoveScuJob::GetPublicContent(Json::Value& value) 206 void DicomMoveScuJob::GetPublicContent(Json::Value& value)
193 { 207 {
194 SetOfCommandsJob::GetPublicContent(value); 208 SetOfCommandsJob::GetPublicContent(value);
195 209
196 value["LocalAet"] = localAet_; 210 value["LocalAet"] = parameters_.GetLocalApplicationEntityTitle();
197 value["RemoteAet"] = remote_.GetApplicationEntityTitle(); 211 value["RemoteAet"] = parameters_.GetRemoteModality().GetApplicationEntityTitle();
198 value["Query"] = query_; 212 value["Query"] = query_;
199 } 213 }
200 214
201 215
202 DicomMoveScuJob::DicomMoveScuJob(ServerContext& context, 216 DicomMoveScuJob::DicomMoveScuJob(ServerContext& context,
203 const Json::Value& serialized) : 217 const Json::Value& serialized) :
204 SetOfCommandsJob(new Unserializer(*this), serialized), 218 SetOfCommandsJob(new Unserializer(*this), serialized),
205 context_(context), 219 context_(context),
206 query_(Json::arrayValue) 220 query_(Json::arrayValue)
207 { 221 {
208 localAet_ = SerializationToolbox::ReadString(serialized, LOCAL_AET); 222 parameters_ = DicomAssociationParameters::UnserializeJob(serialized);
209 targetAet_ = SerializationToolbox::ReadString(serialized, TARGET_AET); 223 targetAet_ = SerializationToolbox::ReadString(serialized, TARGET_AET);
210 remote_ = RemoteModalityParameters(serialized[REMOTE]);
211 224
212 if (serialized.isMember(QUERY) && 225 if (serialized.isMember(QUERY) &&
213 serialized[QUERY].type() == Json::arrayValue) 226 serialized[QUERY].type() == Json::arrayValue)
214 { 227 {
215 query_ = serialized[QUERY]; 228 query_ = serialized[QUERY];
223 { 236 {
224 return false; 237 return false;
225 } 238 }
226 else 239 else
227 { 240 {
228 target[LOCAL_AET] = localAet_; 241 parameters_.SerializeJob(target);
229 target[TARGET_AET] = targetAet_; 242 target[TARGET_AET] = targetAet_;
230 target[QUERY] = query_; 243 target[QUERY] = query_;
231 remote_.Serialize(target[REMOTE], true /* force advanced format */);
232 return true; 244 return true;
233 } 245 }
234 } 246 }
235 } 247 }