diff OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.cpp @ 4518:cb8fcecf1b02

new option "Timeout" in "DicomModalities" to set DICOM SCU timeout on a per-modality basis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Feb 2021 16:32:11 +0100
parents 522e13a60cfc
children 7053502fbf97
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.cpp	Mon Feb 22 15:27:25 2021 +0100
+++ b/OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.cpp	Mon Feb 22 16:32:11 2021 +0100
@@ -46,6 +46,7 @@
 static const char* KEY_PORT = "Port";
 static const char* KEY_USE_DICOM_TLS = "UseDicomTls";
 static const char* KEY_LOCAL_AET = "LocalAet";
+static const char* KEY_TIMEOUT = "Timeout";
 
 
 namespace Orthanc
@@ -66,6 +67,7 @@
     allowTranscoding_ = true;
     useDicomTls_ = false;
     localAet_.clear();
+    timeout_ = 0;
   }
 
 
@@ -293,6 +295,11 @@
     {
       localAet_ = SerializationToolbox::ReadString(serialized, KEY_LOCAL_AET);
     }
+
+    if (serialized.isMember(KEY_TIMEOUT))
+    {
+      timeout_ = SerializationToolbox::ReadUnsignedInteger(serialized, KEY_TIMEOUT);
+    }
   }
 
 
@@ -402,6 +409,7 @@
       target[KEY_ALLOW_TRANSCODING] = allowTranscoding_;
       target[KEY_USE_DICOM_TLS] = useDicomTls_;
       target[KEY_LOCAL_AET] = localAet_;
+      target[KEY_TIMEOUT] = timeout_;
     }
     else
     {
@@ -481,4 +489,19 @@
       localAet_ = aet;
     }
   }
+
+  void RemoteModalityParameters::SetTimeout(uint32_t seconds)
+  {
+    timeout_ = seconds;
+  }
+
+  uint32_t RemoteModalityParameters::GetTimeout() const
+  {
+    return timeout_;
+  }
+
+  bool RemoteModalityParameters::HasTimeout() const
+  {
+    return timeout_ != 0;
+  }
 }