Mercurial > hg > orthanc
changeset 3877:4b4f387c6bb8 transcoding
making DicomMoveScuJob more consistent with DicomModalityStoreJob
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 May 2020 16:00:38 +0200 |
parents | 92ecaf877baf |
children | 661c931f22ad |
files | OrthancServer/ServerJobs/DicomMoveScuJob.cpp OrthancServer/ServerJobs/DicomMoveScuJob.h |
diffstat | 2 files changed, 34 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/ServerJobs/DicomMoveScuJob.cpp Mon May 04 15:37:45 2020 +0200 +++ b/OrthancServer/ServerJobs/DicomMoveScuJob.cpp Mon May 04 16:00:38 2020 +0200 @@ -97,14 +97,7 @@ { if (connection_.get() == NULL) { - DicomAssociationParameters params(localAet_, remote_); - - if (timeout_ >= 0) - { - params.SetTimeout(static_cast<uint32_t>(timeout_)); - } - - connection_.reset(new DicomControlUserConnection(params)); + connection_.reset(new DicomControlUserConnection(parameters_)); } connection_->Move(targetAet_, findAnswer); @@ -160,7 +153,7 @@ } else { - localAet_ = aet; + parameters_.SetLocalApplicationEntityTitle(aet); } } @@ -186,7 +179,20 @@ } else { - remote_ = remote; + parameters_.SetRemoteModality(remote); + } + } + + + void DicomMoveScuJob::SetTimeout(uint32_t seconds) + { + if (IsStarted()) + { + throw OrthancException(ErrorCode_BadSequenceOfCalls); + } + else + { + parameters_.SetTimeout(seconds); } } @@ -200,9 +206,9 @@ void DicomMoveScuJob::GetPublicContent(Json::Value& value) { SetOfCommandsJob::GetPublicContent(value); - - value["LocalAet"] = localAet_; - value["RemoteAet"] = remote_.GetApplicationEntityTitle(); + + value["LocalAet"] = parameters_.GetLocalApplicationEntityTitle(); + value["RemoteAet"] = parameters_.GetRemoteModality().GetApplicationEntityTitle(); value["Query"] = query_; } @@ -213,18 +219,14 @@ context_(context), query_(Json::arrayValue) { - localAet_ = SerializationToolbox::ReadString(serialized, LOCAL_AET); + parameters_ = DicomAssociationParameters::UnserializeJob(serialized); targetAet_ = SerializationToolbox::ReadString(serialized, TARGET_AET); - remote_ = RemoteModalityParameters(serialized[REMOTE]); if (serialized.isMember(QUERY) && serialized[QUERY].type() == Json::arrayValue) { query_ = serialized[QUERY]; } - - // New in Orthanc in 1.7.0 - timeout_ = SerializationToolbox::ReadInteger(serialized, TIMEOUT, -1); } @@ -236,11 +238,9 @@ } else { - target[LOCAL_AET] = localAet_; + parameters_.SerializeJob(target); target[TARGET_AET] = targetAet_; target[QUERY] = query_; - target[TIMEOUT] = timeout_; - remote_.Serialize(target[REMOTE], true /* force advanced format */); return true; } }
--- a/OrthancServer/ServerJobs/DicomMoveScuJob.h Mon May 04 15:37:45 2020 +0200 +++ b/OrthancServer/ServerJobs/DicomMoveScuJob.h Mon May 04 16:00:38 2020 +0200 @@ -49,12 +49,10 @@ class Command; class Unserializer; - ServerContext& context_; - std::string localAet_; - std::string targetAet_; - RemoteModalityParameters remote_; - int timeout_; - Json::Value query_; + ServerContext& context_; + DicomAssociationParameters parameters_; + std::string targetAet_; + Json::Value query_; std::unique_ptr<DicomControlUserConnection> connection_; @@ -74,39 +72,25 @@ void AddFindAnswer(QueryRetrieveHandler& query, size_t i); - - const std::string& GetLocalAet() const + + const DicomAssociationParameters& GetParameters() const { - return localAet_; + return parameters_; } + + void SetLocalAet(const std::string& aet); - void SetLocalAet(const std::string& aet); + void SetRemoteModality(const RemoteModalityParameters& remote); + + void SetTimeout(uint32_t timeout); const std::string& GetTargetAet() const { return targetAet_; } - + void SetTargetAet(const std::string& aet); - const RemoteModalityParameters& GetRemoteModality() const - { - return remote_; - } - - void SetRemoteModality(const RemoteModalityParameters& remote); - - void SetTimeout(int timeout) - { - timeout_ = timeout; - } - - int GetTimeout() const - { - return timeout_; - } - - virtual void Stop(JobStopReason reason); virtual void GetJobType(std::string& target)