summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLutz Bichler <Lutz.Bichler@bmw.de>2020-10-27 10:02:03 +0100
committerLutz Bichler <Lutz.Bichler@bmw.de>2020-10-27 10:02:03 +0100
commit89720d3c63bbd22cbccc80cdc92c2f2dd20193ba (patch)
tree591c45dba85c98fdd8e141827bdb6e82aaad4f59 /src
parent99ebf3461f51e4899f06457d6aafdaa4adecd278 (diff)
downloadgenivi-common-api-runtime-master.tar.gz
capicxx-core-runtime 3.2.0HEAD3.2.0master
Diffstat (limited to 'src')
-rw-r--r--src/CommonAPI/Address.cpp11
-rw-r--r--src/CommonAPI/CallInfo.cpp40
-rw-r--r--src/CommonAPI/ContainerUtils.cpp25
-rw-r--r--src/CommonAPI/IniFileReader.cpp7
-rw-r--r--src/CommonAPI/Logger.cpp193
-rw-r--r--src/CommonAPI/LoggerImpl.cpp200
-rw-r--r--src/CommonAPI/MainLoopContext.cpp2
-rw-r--r--src/CommonAPI/Proxy.cpp2
-rw-r--r--src/CommonAPI/ProxyManager.cpp2
-rw-r--r--src/CommonAPI/Runtime.cpp25
-rw-r--r--src/CommonAPI/Utils.cpp2
11 files changed, 281 insertions, 228 deletions
diff --git a/src/CommonAPI/Address.cpp b/src/CommonAPI/Address.cpp
index a80b2cf..db9418c 100644
--- a/src/CommonAPI/Address.cpp
+++ b/src/CommonAPI/Address.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -12,7 +12,6 @@
namespace CommonAPI {
Address::Address() {
-
}
Address::Address(const std::string &_address) {
@@ -32,7 +31,13 @@ Address::Address(const Address &_source)
instance_(_source.instance_) {
}
-Address::~Address() {
+Address &
+Address::operator=(const Address &_other) {
+ domain_ = _other.domain_;
+ interface_ = _other.interface_;
+ instance_ = _other.instance_;
+
+ return (*this);
}
bool
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
diff --git a/src/CommonAPI/ContainerUtils.cpp b/src/CommonAPI/ContainerUtils.cpp
index 71876bd..201e251 100644
--- a/src/CommonAPI/ContainerUtils.cpp
+++ b/src/CommonAPI/ContainerUtils.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2014-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/.
@@ -8,20 +8,23 @@
namespace CommonAPI {
-size_t SharedPointerClientIdContentHash::operator()(const std::shared_ptr<ClientId>& t) const {
- if (t) {
- return t->hashCode();
- } else {
- return 0;
+size_t
+SharedPointerClientIdContentHash::operator()(const std::shared_ptr<ClientId> &_t) const {
+ if (_t) {
+ return _t->hashCode();
}
+
+ return (0);
}
-bool SharedPointerClientIdContentEqual::operator()(const std::shared_ptr<ClientId>& a, const std::shared_ptr<ClientId>& b) const {
- if (a && b) {
- return *a==*b;
- } else {
- return false;
+bool
+SharedPointerClientIdContentEqual::operator()(
+ const std::shared_ptr<ClientId> &_lhs, const std::shared_ptr<ClientId> &_rhs) const {
+ if (_lhs && _rhs) {
+ return (*_lhs==*_rhs);
}
+
+ return (false);
}
} // namespace std
diff --git a/src/CommonAPI/IniFileReader.cpp b/src/CommonAPI/IniFileReader.cpp
index 94057e0..28b5013 100644
--- a/src/CommonAPI/IniFileReader.cpp
+++ b/src/CommonAPI/IniFileReader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -45,6 +45,11 @@ IniFileReader::load(const std::string &_path) {
trim(line);
+ // Handle comments
+ std::size_t comment = line.find(';');
+ if (comment == 0)
+ continue;
+
std::size_t start = line.find('[');
if (start == 0) {
std::size_t end = line.find(']');
diff --git a/src/CommonAPI/Logger.cpp b/src/CommonAPI/Logger.cpp
index 268be6f..f5804c8 100644
--- a/src/CommonAPI/Logger.cpp
+++ b/src/CommonAPI/Logger.cpp
@@ -1,15 +1,198 @@
-// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/Logger.hpp>
#include <CommonAPI/Runtime.hpp>
+#include <CommonAPI/Logger.hpp>
+
+#ifdef USE_DLT
+#include <dlt/dlt.h>
+#endif
+
+#include <cstdint>
+#include <fstream>
+#include <memory>
+#include <mutex>
+#include <iostream>
namespace CommonAPI {
-void
- Logger::init(bool _useConsole, const std::string &_fileName, bool _useDlt, const std::string &_level) {
- LoggerImpl::init(_useConsole, _fileName, _useDlt, _level);
+
+class Logger::LoggerImpl {
+public:
+ LoggerImpl() :
+ maximumLogLevel_(Logger::Level::CAPI_LOG_INFO),
+ useConsole_(true),
+ useDlt_(false)
+#ifdef USE_DLT
+ , ownAppID_(false)
+#endif
+ {
+ }
+
+ void init(bool _useConsole, const std::string &_fileName, bool _useDlt,
+ const std::string& _level) {
+ useConsole_ = _useConsole;
+ maximumLogLevel_ = stringAsLevel(_level);
+ useDlt_ = _useDlt;
+
+ if (!_fileName.empty()) {
+ file_ = std::make_shared<std::ofstream>();
+ if (file_) {
+ file_->open(_fileName.c_str(),
+ std::ofstream::out | std::ofstream::app);
+ }
+ }
+#ifdef USE_DLT
+ if (useDlt_) {
+ std::string app = Runtime::getProperty("LogApplication");
+ if (!app.empty()) {
+ ownAppID_ = true;
+ DLT_REGISTER_APP(app.c_str(), "CommonAPI Application");
+ }
+
+ std::string context = Runtime::getProperty("LogContext");
+ if (context == "")
+ context = "CAPI";
+ DLT_REGISTER_CONTEXT(dlt_, context.c_str(), "CAPI");
+ }
+#endif
+ }
+
+ ~LoggerImpl() {
+#ifdef USE_DLT
+ if (useDlt_) {
+ DLT_UNREGISTER_CONTEXT(dlt_);
+ if (ownAppID_) {
+ DLT_UNREGISTER_APP()
+ ;
+ }
+ }
+#endif
+ }
+
+ bool isLogged(Logger::Level _level) {
+ return (_level <= maximumLogLevel_) ? true : false;
+ }
+
+ void doLog(Logger::Level _level, const std::string &_message) {
+ if (useConsole_) {
+ std::lock_guard<std::mutex> itsLock(mutex_);
+ std::cerr << "[CAPI][" << levelAsString(_level) << "] " << _message
+ << std::endl;
+ }
+ if (file_ && file_->is_open()) {
+ std::lock_guard<std::mutex> itsLock(mutex_);
+ (*(file_.get())) << "[CAPI][" << levelAsString(_level) << "] "
+ << _message << std::endl;
+ }
+
+#ifdef USE_DLT
+ if (useDlt_) {
+ DLT_LOG_STRING(dlt_, levelAsDlt(_level), _message.c_str());
+ }
+#endif
+
+ }
+
+ static Logger::Level stringAsLevel(const std::string &_level) {
+ Logger::Level level(Logger::Level::CAPI_LOG_INFO);
+ if (_level == "none") {
+ level = Logger::Level::CAPI_LOG_NONE;
+ } else if (_level == "fatal") {
+ level = Logger::Level::CAPI_LOG_FATAL;
+ } else if (_level == "error") {
+ level = Logger::Level::CAPI_LOG_ERROR;
+ } else if (_level == "warning") {
+ level = Logger::Level::CAPI_LOG_WARNING;
+ } else if (_level == "info") {
+ level = Logger::Level::CAPI_LOG_INFO;
+ } else if (_level == "debug") {
+ level = Logger::Level::CAPI_LOG_DEBUG;
+ } else if (_level == "verbose") {
+ level = Logger::Level::CAPI_LOG_VERBOSE;
+ }
+ return level;
+ }
+
+private:
+ static std::string levelAsString(Logger::Level _level) {
+ switch (_level) {
+ case Logger::Level::CAPI_LOG_NONE:
+ return "NONE";
+ case Logger::Level::CAPI_LOG_FATAL:
+ return "FATAL";
+ case Logger::Level::CAPI_LOG_ERROR:
+ return "ERROR";
+ case Logger::Level::CAPI_LOG_WARNING:
+ return "WARNING";
+ case Logger::Level::CAPI_LOG_INFO:
+ return "INFO";
+ case Logger::Level::CAPI_LOG_DEBUG:
+ return "DEBUG";
+ case Logger::Level::CAPI_LOG_VERBOSE:
+ return "VERBOSE";
+ default:
+ return "";
+ }
+ }
+
+#ifdef USE_DLT
+ static DltLogLevelType levelAsDlt(Logger::Level _level) {
+ switch (_level) {
+ case Logger::Level::CAPI_LOG_NONE:
+ return DLT_LOG_OFF;
+ case Logger::Level::CAPI_LOG_FATAL:
+ return DLT_LOG_FATAL;
+ case Logger::Level::CAPI_LOG_ERROR:
+ return DLT_LOG_ERROR;
+ case Logger::Level::CAPI_LOG_WARNING:
+ return DLT_LOG_WARN;
+ case Logger::Level::CAPI_LOG_INFO:
+ return DLT_LOG_INFO;
+ case Logger::Level::CAPI_LOG_DEBUG:
+ return DLT_LOG_DEBUG;
+ case Logger::Level::CAPI_LOG_VERBOSE:
+ return DLT_LOG_VERBOSE;
+ default:
+ return DLT_LOG_DEFAULT;
+ }
+ }
+#endif
+
+private:
+ std::mutex mutex_;
+
+ Logger::Level maximumLogLevel_;
+
+ bool useConsole_;
+
+ std::shared_ptr<std::ofstream> file_;
+
+ bool useDlt_;
+#ifdef USE_DLT
+ DLT_DECLARE_CONTEXT(dlt_)
+ bool ownAppID_;
+#endif
+};
+
+std::unique_ptr<Logger::LoggerImpl> Logger::loggerImpl_ =
+ std::unique_ptr<Logger::LoggerImpl>(new Logger::LoggerImpl());
+
+Logger::Logger() = default;
+Logger::~Logger() = default;
+
+void Logger::init(bool _useConsole, const std::string &_fileName, bool _useDlt,
+ const std::string& _level) {
+ loggerImpl_->init(_useConsole, _fileName, _useDlt, _level);
+}
+
+bool Logger::isLogged(Level _level) {
+ return loggerImpl_->isLogged(_level);
+}
+
+void Logger::doLog(Level _level, const std::string& _message) {
+ loggerImpl_->doLog(_level, _message);
}
} //namespace CommonAPI
diff --git a/src/CommonAPI/LoggerImpl.cpp b/src/CommonAPI/LoggerImpl.cpp
deleted file mode 100644
index fabb109..0000000
--- a/src/CommonAPI/LoggerImpl.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright (C) 2015-2017 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 <iostream>
-
-#include <CommonAPI/LoggerImpl.hpp>
-#ifdef USE_DLT
-#include <CommonAPI/Runtime.hpp>
-#endif
-
-namespace CommonAPI {
-
-#if defined(USE_CONSOLE) || defined(USE_FILE)
-std::mutex LoggerImpl::mutex_;
-#endif
-
-#ifdef USE_CONSOLE
-bool LoggerImpl::useConsole_(true);
-#endif
-
-#ifdef USE_FILE
-std::shared_ptr<std::ofstream> LoggerImpl::file_;
-#endif
-
-#ifdef USE_DLT
-bool LoggerImpl::useDlt_(false);
-#endif
-
-#if defined(USE_CONSOLE) || defined(USE_FILE) || defined(USE_DLT)
-LoggerImpl::Level LoggerImpl::maximumLogLevel_(LoggerImpl::Level::LL_INFO);
-#endif
-
-LoggerImpl::LoggerImpl() {
-#ifdef USE_DLT
- if (useDlt_) {
- std::string app = Runtime::getProperty("LogApplication");
- if (!app.empty()) {
- ownAppID_ = true;
- DLT_REGISTER_APP(app.c_str(), "CommonAPI Application");
- }
-
- std::string context = Runtime::getProperty("LogContext");
- if (context == "") context = "CAPI";
- DLT_REGISTER_CONTEXT(dlt_, context.c_str(), "CAPI");
- }
-#endif
-}
-
-LoggerImpl::~LoggerImpl() {
-#ifdef USE_DLT
- if (useDlt_) {
- DLT_UNREGISTER_CONTEXT(dlt_);
- if (ownAppID_) {
- DLT_UNREGISTER_APP();
- }
- }
-#endif
-}
-
-LoggerImpl* LoggerImpl::get() {
- static LoggerImpl theLoggerImpl;
- return &theLoggerImpl;
-}
-
-
-void
-LoggerImpl::init(bool _useConsole, const std::string &_fileName, bool _useDlt, const std::string &_level) {
-#ifdef USE_CONSOLE
- useConsole_ = _useConsole;
-#else
- (void)_useConsole;
-#endif
-#ifdef USE_FILE
- if (_fileName != "") {
- file_ = std::make_shared<std::ofstream>();
- if (file_)
- file_->open(_fileName.c_str(), std::ofstream::out | std::ofstream::app);
- }
-#else
- (void)_fileName;
-#endif
-#ifdef USE_DLT
- useDlt_ = _useDlt;
-#else
- (void)_useDlt;
-#endif
-#if defined(USE_CONSOLE) || defined(USE_FILE) || defined(USE_DLT)
- maximumLogLevel_ = stringAsLevel(_level);
-#else
- (void)_level;
-#endif
-}
-
-void
-LoggerImpl::doLog(Level _level, const std::string &_message) {
-#ifdef USE_CONSOLE
- if (useConsole_) {
- std::lock_guard<std::mutex> itsLock(mutex_);
- std::cerr << "[CAPI][" << levelAsString(_level) << "] " << _message << std::endl;
- }
-#endif
-#ifdef USE_FILE
- if (file_ && file_->is_open()) {
- std::lock_guard<std::mutex> itsLock(mutex_);
- (*(file_.get())) << "[CAPI][" << levelAsString(_level) << "] " << _message << std::endl;
- }
-#endif
-#ifdef USE_DLT
- if (useDlt_) {
- DLT_LOG_STRING(dlt_, levelAsDlt(_level), _message.c_str());
- }
-#endif
-#if !defined(USE_CONSOLE) && !defined(USE_FILE) && !defined(USE_DLT)
- (void)_level;
- (void)_message;
-#endif
-}
-
-#if defined(USE_CONSOLE) || defined(USE_FILE) || defined(USE_DLT)
-LoggerImpl::Level
-LoggerImpl::stringAsLevel(const std::string &_level) {
- if (_level == "fatal")
- return Level::LL_FATAL;
-
- if (_level == "error")
- return Level::LL_ERROR;
-
- if (_level == "warning")
- return Level::LL_WARNING;
-
- if (_level == "info")
- return Level::LL_INFO;
-
- if (_level == "debug")
- return Level::LL_DEBUG;
-
- if (_level == "verbose")
- return Level::LL_VERBOSE;
-
- return Level::LL_INFO;
-}
-#endif
-
-#if defined(USE_CONSOLE) || defined(USE_FILE)
-std::string
-LoggerImpl::levelAsString(LoggerImpl::Level _level) {
- switch (_level) {
- case Level::LL_FATAL:
- return "FATAL";
- case Level::LL_ERROR:
- return "ERROR";
- case Level::LL_WARNING:
- return "WARNING";
- case Level::LL_INFO:
- return "INFO";
- case Level::LL_DEBUG:
- return "DEBUG";
- case Level::LL_VERBOSE:
- return "VERBOSE";
- default:
- return "";
- }
-}
-#endif
-
-#ifdef USE_DLT
-DltLogLevelType
-LoggerImpl::levelAsDlt(LoggerImpl::Level _level) {
- switch (_level) {
- case Level::LL_FATAL:
- return DLT_LOG_FATAL;
- case Level::LL_ERROR:
- return DLT_LOG_ERROR;
- case Level::LL_WARNING:
- return DLT_LOG_WARN;
- case Level::LL_INFO:
- return DLT_LOG_INFO;
- case Level::LL_DEBUG:
- return DLT_LOG_DEBUG;
- case Level::LL_VERBOSE:
- return DLT_LOG_VERBOSE;
- default:
- return DLT_LOG_DEFAULT;
- }
-}
-#endif
-
-bool
-LoggerImpl::isLogged(LoggerImpl::Level _level) {
-#if defined(USE_CONSOLE) || defined(USE_FILE) || defined(USE_DLT)
- return (_level <= maximumLogLevel_) ? true : false;
-#else
- (void)_level;
- return false;
-#endif
-}
-
-} // namespace CommonAPI
diff --git a/src/CommonAPI/MainLoopContext.cpp b/src/CommonAPI/MainLoopContext.cpp
index a097ce7..871d099 100644
--- a/src/CommonAPI/MainLoopContext.cpp
+++ b/src/CommonAPI/MainLoopContext.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2013-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/.
diff --git a/src/CommonAPI/Proxy.cpp b/src/CommonAPI/Proxy.cpp
index 6e22f5e..0c28618 100644
--- a/src/CommonAPI/Proxy.cpp
+++ b/src/CommonAPI/Proxy.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2013-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/.
diff --git a/src/CommonAPI/ProxyManager.cpp b/src/CommonAPI/ProxyManager.cpp
index e5183b0..dfc2e57 100644
--- a/src/CommonAPI/ProxyManager.cpp
+++ b/src/CommonAPI/ProxyManager.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2013-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/.
diff --git a/src/CommonAPI/Runtime.cpp b/src/CommonAPI/Runtime.cpp
index 9bae2e2..1f531a0 100644
--- a/src/CommonAPI/Runtime.cpp
+++ b/src/CommonAPI/Runtime.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2013-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/.
@@ -220,12 +220,17 @@ Runtime::readConfiguration() {
section = reader.getSection("default");
if (section) {
std::string binding = section->getValue("binding");
- if ("" != binding)
+ if ("" != binding) {
defaultBinding_ = binding;
-
+ }
std::string folder = section->getValue("folder");
- if ("" != folder)
+ if ("" != folder) {
defaultFolder_ = folder;
+ }
+ std::string callTimeout = section->getValue("callTimeout");
+ if ("" != callTimeout) {
+ defaultCallTimeout_ = std::stoi(callTimeout);
+ }
}
section = reader.getSection("proxy");
@@ -293,6 +298,10 @@ Runtime::createProxy(
bool
Runtime::registerStub(const std::string &_domain, const std::string &_interface, const std::string &_instance,
std::shared_ptr<StubBase> _stub, const ConnectionId_t &_connectionId) {
+ if (!_stub) {
+ return false;
+ }
+
if (!isInitialized_) {
initFactories();
}
@@ -311,6 +320,10 @@ Runtime::registerStub(const std::string &_domain, const std::string &_interface,
bool
Runtime::registerStub(const std::string &_domain, const std::string &_interface, const std::string &_instance,
std::shared_ptr<StubBase> _stub, std::shared_ptr<MainLoopContext> _context) {
+ if (!_stub) {
+ return false;
+ }
+
if (!isInitialized_) {
initFactories();
}
@@ -492,4 +505,8 @@ Runtime::registerStubHelper(const std::string &_domain, const std::string &_inte
false);
}
+Timeout_t Runtime::getDefaultCallTimeout() const {
+ return defaultCallTimeout_;
+}
+
} //Namespace CommonAPI
diff --git a/src/CommonAPI/Utils.cpp b/src/CommonAPI/Utils.cpp
index a2058c0..8f7f6e7 100644
--- a/src/CommonAPI/Utils.cpp
+++ b/src/CommonAPI/Utils.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2014-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/.