From 8fe18d28856d7cd632e39f05e734e978d1539cfd Mon Sep 17 00:00:00 2001 From: Matej Drobnic Date: Mon, 16 Nov 2020 07:28:53 +0100 Subject: [PATCH] make MAX_TRIES configurable --- config/options.xml | 3 +++ cpp/src/Msg.cpp | 7 +++++++ cpp/src/Options.cpp | 1 + 3 files changed, 11 insertions(+) diff --git a/config/options.xml b/config/options.xml index 6707030ff0..ea1a130886 100644 --- a/config/options.xml +++ b/config/options.xml @@ -35,6 +35,9 @@ This is unlikely to fix any timeout issues you may have --> + + + diff --git a/cpp/src/Msg.cpp b/cpp/src/Msg.cpp index 9a4c9c3ff5..0f683d417e 100644 --- a/cpp/src/Msg.cpp +++ b/cpp/src/Msg.cpp @@ -35,6 +35,7 @@ #include "command_classes/MultiInstance.h" #include "command_classes/Security.h" #include "aes/aescpp.h" +#include "Options.h" namespace OpenZWave { @@ -67,6 +68,12 @@ namespace OpenZWave m_buffer[1] = 0; // Length of the following data, filled in during Finalize. m_buffer[2] = _msgType; m_buffer[3] = _function; + + int maxTries = MAX_TRIES; + if (Options::Get()->GetOptionAsInt("MaxTries", &maxTries)) + { + m_maxSendAttempts = maxTries; + } } //----------------------------------------------------------------------------- diff --git a/cpp/src/Options.cpp b/cpp/src/Options.cpp index 9137f0e7cc..df55bcbdb3 100644 --- a/cpp/src/Options.cpp +++ b/cpp/src/Options.cpp @@ -122,6 +122,7 @@ Options* Options::Create(string const& _configPath, string const& _userPath, str s_instance->AddOptionString("NetworkKey", string(""), false); s_instance->AddOptionBool("RefreshAllUserCodes", false); // if true, during startup, we refresh all the UserCodes the device reports it supports. If False, we stop after we get the first "Available" slot (Some devices have 250+ usercode slots! - That makes our Session Stage Very Long ) s_instance->AddOptionInt("RetryTimeout", RETRY_TIMEOUT); // How long do we wait to timeout messages sent + s_instance->AddOptionInt("MaxTries", MAX_TRIES); // How many time do we retry a message before giving up s_instance->AddOptionBool("EnableSIS", true); // Automatically become a SUC if there is no SUC on the network. s_instance->AddOptionBool("AssumeAwake", true); // Assume Devices that Support the Wakeup CC are awake when we first query them.... s_instance->AddOptionBool("NotifyOnDriverUnload", false); // Should we send the Node/Value Notifications on Driver Unloading - Read comments in Driver::~Driver() method about possible race conditions