changeset 3843:138d0dde41b5

end of replacements of DicomUserConnection by DicomControlUserConnection
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 16 Apr 2020 17:24:24 +0200
parents bdbe12aba99f
children c9c34bb50f0a
files Core/DicomNetworking/DicomAssociation.cpp Core/DicomNetworking/DicomControlUserConnection.cpp Core/DicomNetworking/DicomControlUserConnection.h OrthancServer/QueryRetrieveHandler.cpp OrthancServer/ServerJobs/DicomModalityStoreJob.cpp OrthancServer/ServerJobs/DicomMoveScuJob.cpp OrthancServer/ServerJobs/DicomMoveScuJob.h OrthancServer/ServerJobs/StorageCommitmentScpJob.cpp
diffstat 8 files changed, 33 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomAssociation.cpp	Thu Apr 16 17:03:34 2020 +0200
+++ b/Core/DicomNetworking/DicomAssociation.cpp	Thu Apr 16 17:24:24 2020 +0200
@@ -178,9 +178,10 @@
     {
       Close();
     }
-    catch (OrthancException&)
+    catch (OrthancException& e)
     {
       // Don't throw exception in destructors
+      LOG(ERROR) << "Error while destroying a DICOM association: " << e.What();
     }
   }
 
@@ -515,7 +516,7 @@
       }
 
       throw OrthancException(ErrorCode_NetworkProtocol,
-                             "DicomUserConnection - " + command + " to AET \"" +
+                             "DicomAssociation - " + command + " to AET \"" +
                              parameters.GetRemoteApplicationEntityTitle() +
                              "\": " + info);
     }
--- a/Core/DicomNetworking/DicomControlUserConnection.cpp	Thu Apr 16 17:03:34 2020 +0200
+++ b/Core/DicomNetworking/DicomControlUserConnection.cpp	Thu Apr 16 17:24:24 2020 +0200
@@ -226,6 +226,7 @@
 
   void DicomControlUserConnection::SetupPresentationContexts()
   {
+    assert(association_.get() != NULL);
     association_->ProposeGenericPresentationContext(UID_VerificationSOPClass);
     association_->ProposeGenericPresentationContext(UID_FINDPatientRootQueryRetrieveInformationModel);
     association_->ProposeGenericPresentationContext(UID_FINDStudyRootQueryRetrieveInformationModel);
@@ -241,6 +242,7 @@
                                                 const char* level)
   {
     assert(isWorklist ^ (level != NULL));
+    assert(association_.get() != NULL);
 
     association_->Open(parameters_);
 
@@ -325,6 +327,7 @@
                                                 ResourceType level,
                                                 const DicomMap& fields)
   {
+    assert(association_.get() != NULL);
     association_->Open(parameters_);
 
     std::unique_ptr<ParsedDicomFile> query(
@@ -440,8 +443,16 @@
   }
     
 
+  void DicomControlUserConnection::Close()
+  {
+    assert(association_.get() != NULL);
+    association_->Close();
+  }
+
+
   bool DicomControlUserConnection::Echo()
   {
+    assert(association_.get() != NULL);
     association_->Open(parameters_);
 
     DIC_US status;
--- a/Core/DicomNetworking/DicomControlUserConnection.h	Thu Apr 16 17:03:34 2020 +0200
+++ b/Core/DicomNetworking/DicomControlUserConnection.h	Thu Apr 16 17:24:24 2020 +0200
@@ -75,6 +75,8 @@
       return parameters_;
     }
 
+    void Close();
+
     bool Echo();
 
     void Find(DicomFindAnswers& result,
--- a/OrthancServer/QueryRetrieveHandler.cpp	Thu Apr 16 17:03:34 2020 +0200
+++ b/OrthancServer/QueryRetrieveHandler.cpp	Thu Apr 16 17:24:24 2020 +0200
@@ -36,6 +36,7 @@
 
 #include "OrthancConfiguration.h"
 
+#include "../Core/DicomNetworking/DicomControlUserConnection.h"
 #include "../Core/DicomParsing/FromDcmtkBridge.h"
 #include "../Core/Logging.h"
 #include "LuaScripting.h"
@@ -81,8 +82,7 @@
       FixQueryLua(fixed, context_, modality_.GetApplicationEntityTitle()); 
 
       {
-        DicomUserConnection connection(localAet_, modality_);
-        connection.Open();
+        DicomControlUserConnection connection(localAet_, modality_);
         connection.Find(answers_, level_, fixed, findNormalized_);
       }
 
--- a/OrthancServer/ServerJobs/DicomModalityStoreJob.cpp	Thu Apr 16 17:03:34 2020 +0200
+++ b/OrthancServer/ServerJobs/DicomModalityStoreJob.cpp	Thu Apr 16 17:24:24 2020 +0200
@@ -47,9 +47,7 @@
   {
     if (connection_.get() == NULL)
     {
-      connection_.reset(new DicomUserConnection);
-      connection_->SetLocalApplicationEntityTitle(localAet_);
-      connection_->SetRemoteModality(remote_);
+      connection_.reset(new DicomUserConnection(localAet_, remote_));
     }
   }
 
--- a/OrthancServer/ServerJobs/DicomMoveScuJob.cpp	Thu Apr 16 17:03:34 2020 +0200
+++ b/OrthancServer/ServerJobs/DicomMoveScuJob.cpp	Thu Apr 16 17:24:24 2020 +0200
@@ -96,8 +96,7 @@
   {
     if (connection_.get() == NULL)
     {
-      connection_.reset(new DicomUserConnection(localAet_, remote_));
-      connection_->Open();
+      connection_.reset(new DicomControlUserConnection(localAet_, remote_));
     }
     
     connection_->Move(targetAet_, findAnswer);
--- a/OrthancServer/ServerJobs/DicomMoveScuJob.h	Thu Apr 16 17:03:34 2020 +0200
+++ b/OrthancServer/ServerJobs/DicomMoveScuJob.h	Thu Apr 16 17:24:24 2020 +0200
@@ -34,8 +34,8 @@
 #pragma once
 
 #include "../../Core/Compatibility.h"
+#include "../../Core/DicomNetworking/DicomControlUserConnection.h"
 #include "../../Core/JobsEngine/SetOfCommandsJob.h"
-#include "../../Core/DicomNetworking/DicomUserConnection.h"
 
 #include "../QueryRetrieveHandler.h"
 
@@ -49,13 +49,14 @@
     class Command;
     class Unserializer;
     
-    ServerContext&                        context_;
-    std::string                           localAet_;
-    std::string                           targetAet_;
-    RemoteModalityParameters              remote_;
-    std::unique_ptr<DicomUserConnection>  connection_;
-    Json::Value                           query_;
+    ServerContext&            context_;
+    std::string               localAet_;
+    std::string               targetAet_;
+    RemoteModalityParameters  remote_;
+    Json::Value               query_;
 
+    std::unique_ptr<DicomControlUserConnection>  connection_;
+    
     void Retrieve(const DicomMap& findAnswer);
     
   public:
--- a/OrthancServer/ServerJobs/StorageCommitmentScpJob.cpp	Thu Apr 16 17:03:34 2020 +0200
+++ b/OrthancServer/ServerJobs/StorageCommitmentScpJob.cpp	Thu Apr 16 17:24:24 2020 +0200
@@ -34,7 +34,7 @@
 #include "../PrecompiledHeadersServer.h"
 #include "StorageCommitmentScpJob.h"
 
-#include "../../Core/DicomNetworking/DicomUserConnection.h"
+#include "../../Core/DicomNetworking/DicomAssociation.h"
 #include "../../Core/Logging.h"
 #include "../../Core/OrthancException.h"
 #include "../../Core/SerializationToolbox.h"
@@ -347,9 +347,10 @@
     {
       throw OrthancException(ErrorCode_InternalError);
     }
-      
-    DicomUserConnection scu(calledAet_, remoteModality_);
-    scu.ReportStorageCommitment(transactionUid_, sopClassUids_, sopInstanceUids_, failureReasons);
+
+    DicomAssociationParameters parameters(calledAet_, remoteModality_);
+    DicomAssociation::ReportStorageCommitment(
+      parameters, transactionUid_, sopClassUids_, sopInstanceUids_, failureReasons);
   }