comparison 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
comparison
equal deleted inserted replaced
4517:c494ee5d0101 4518:cb8fcecf1b02
44 static const char* KEY_HOST = "Host"; 44 static const char* KEY_HOST = "Host";
45 static const char* KEY_MANUFACTURER = "Manufacturer"; 45 static const char* KEY_MANUFACTURER = "Manufacturer";
46 static const char* KEY_PORT = "Port"; 46 static const char* KEY_PORT = "Port";
47 static const char* KEY_USE_DICOM_TLS = "UseDicomTls"; 47 static const char* KEY_USE_DICOM_TLS = "UseDicomTls";
48 static const char* KEY_LOCAL_AET = "LocalAet"; 48 static const char* KEY_LOCAL_AET = "LocalAet";
49 static const char* KEY_TIMEOUT = "Timeout";
49 50
50 51
51 namespace Orthanc 52 namespace Orthanc
52 { 53 {
53 void RemoteModalityParameters::Clear() 54 void RemoteModalityParameters::Clear()
64 allowNAction_ = true; // For storage commitment 65 allowNAction_ = true; // For storage commitment
65 allowNEventReport_ = true; // For storage commitment 66 allowNEventReport_ = true; // For storage commitment
66 allowTranscoding_ = true; 67 allowTranscoding_ = true;
67 useDicomTls_ = false; 68 useDicomTls_ = false;
68 localAet_.clear(); 69 localAet_.clear();
70 timeout_ = 0;
69 } 71 }
70 72
71 73
72 RemoteModalityParameters::RemoteModalityParameters() 74 RemoteModalityParameters::RemoteModalityParameters()
73 { 75 {
290 } 292 }
291 293
292 if (serialized.isMember(KEY_LOCAL_AET)) 294 if (serialized.isMember(KEY_LOCAL_AET))
293 { 295 {
294 localAet_ = SerializationToolbox::ReadString(serialized, KEY_LOCAL_AET); 296 localAet_ = SerializationToolbox::ReadString(serialized, KEY_LOCAL_AET);
297 }
298
299 if (serialized.isMember(KEY_TIMEOUT))
300 {
301 timeout_ = SerializationToolbox::ReadUnsignedInteger(serialized, KEY_TIMEOUT);
295 } 302 }
296 } 303 }
297 304
298 305
299 bool RemoteModalityParameters::IsRequestAllowed(DicomRequestType type) const 306 bool RemoteModalityParameters::IsRequestAllowed(DicomRequestType type) const
400 target[KEY_ALLOW_N_ACTION] = allowNAction_; 407 target[KEY_ALLOW_N_ACTION] = allowNAction_;
401 target[KEY_ALLOW_N_EVENT_REPORT] = allowNEventReport_; 408 target[KEY_ALLOW_N_EVENT_REPORT] = allowNEventReport_;
402 target[KEY_ALLOW_TRANSCODING] = allowTranscoding_; 409 target[KEY_ALLOW_TRANSCODING] = allowTranscoding_;
403 target[KEY_USE_DICOM_TLS] = useDicomTls_; 410 target[KEY_USE_DICOM_TLS] = useDicomTls_;
404 target[KEY_LOCAL_AET] = localAet_; 411 target[KEY_LOCAL_AET] = localAet_;
412 target[KEY_TIMEOUT] = timeout_;
405 } 413 }
406 else 414 else
407 { 415 {
408 target = Json::arrayValue; 416 target = Json::arrayValue;
409 target.append(GetApplicationEntityTitle()); 417 target.append(GetApplicationEntityTitle());
479 else 487 else
480 { 488 {
481 localAet_ = aet; 489 localAet_ = aet;
482 } 490 }
483 } 491 }
492
493 void RemoteModalityParameters::SetTimeout(uint32_t seconds)
494 {
495 timeout_ = seconds;
496 }
497
498 uint32_t RemoteModalityParameters::GetTimeout() const
499 {
500 return timeout_;
501 }
502
503 bool RemoteModalityParameters::HasTimeout() const
504 {
505 return timeout_ != 0;
506 }
484 } 507 }