diff options
author | Lutz Bichler <Lutz.Bichler@bmw.de> | 2020-10-27 10:02:03 +0100 |
---|---|---|
committer | Lutz Bichler <Lutz.Bichler@bmw.de> | 2020-10-27 10:02:03 +0100 |
commit | 89720d3c63bbd22cbccc80cdc92c2f2dd20193ba (patch) | |
tree | 591c45dba85c98fdd8e141827bdb6e82aaad4f59 /src/CommonAPI/CallInfo.cpp | |
parent | 99ebf3461f51e4899f06457d6aafdaa4adecd278 (diff) | |
download | genivi-common-api-runtime-master.tar.gz |
Diffstat (limited to 'src/CommonAPI/CallInfo.cpp')
-rw-r--r-- | src/CommonAPI/CallInfo.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/CommonAPI/CallInfo.cpp b/src/CommonAPI/CallInfo.cpp new file mode 100644 index 0000000..189e9d8 --- /dev/null +++ b/src/CommonAPI/CallInfo.cpp @@ -0,0 +1,40 @@ +// Copyright (C) 2015-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <CommonAPI/CallInfo.hpp> +#include <CommonAPI/Runtime.hpp> + +namespace CommonAPI { + +CallInfo::CallInfo() + : CallInfo(DEFAULT_SEND_TIMEOUT_MS, 0) { +} + +CallInfo::CallInfo(Timeout_t _timeout) + : CallInfo(_timeout, 0) { +} + +CallInfo::CallInfo(const CallInfo &_other) + : CallInfo(_other.timeout_, _other.sender_) { +} + +CallInfo::CallInfo(Timeout_t _timeout, Sender_t _sender) + : timeout_(_timeout), sender_(_sender) { + + Timeout_t defaultCallTimeout = Runtime::get()->getDefaultCallTimeout(); + const char *env = std::getenv("COMMONAPI_OVERRIDE_GLOBAL_CALL_TIMEOUT"); + + if ((_timeout == DEFAULT_SEND_TIMEOUT_MS) && defaultCallTimeout) { + timeout_ = defaultCallTimeout; + } + if (env) { + Timeout_t globalCallTimeout = std::stoi(env); + if (0 <= globalCallTimeout || globalCallTimeout == -1) { + timeout_ = globalCallTimeout; + } + } +} + +} // namespace CommonAPI
\ No newline at end of file |