diff options
Diffstat (limited to 'AudioManagerUtilities/include')
-rw-r--r-- | AudioManagerUtilities/include/CAmDltWrapper.h | 7 | ||||
-rw-r--r-- | AudioManagerUtilities/include/CAmSerializer.h | 1 | ||||
-rw-r--r-- | AudioManagerUtilities/include/TAmPluginTemplate.h | 40 |
3 files changed, 45 insertions, 3 deletions
diff --git a/AudioManagerUtilities/include/CAmDltWrapper.h b/AudioManagerUtilities/include/CAmDltWrapper.h index 8c5678e..79df911 100644 --- a/AudioManagerUtilities/include/CAmDltWrapper.h +++ b/AudioManagerUtilities/include/CAmDltWrapper.h @@ -162,11 +162,14 @@ public: { #ifdef WITH_DLT #ifdef DLT_IS_LOG_LEVEL_ENABLED - return (dlt_user_is_logLevel_enabled(&mDltContext, logLevel) == DLT_RETURN_TRUE); + if (mlogDestination == logDestination::DAEMON) + { + return (dlt_user_is_logLevel_enabled(&mDltContext, logLevel) == DLT_RETURN_TRUE); + } #else (void)logLevel; - return true; #endif + return true; #else return (logLevel <= mDltContext.log_level_user); #endif diff --git a/AudioManagerUtilities/include/CAmSerializer.h b/AudioManagerUtilities/include/CAmSerializer.h index 6bd6143..8abdf90 100644 --- a/AudioManagerUtilities/include/CAmSerializer.h +++ b/AudioManagerUtilities/include/CAmSerializer.h @@ -18,7 +18,6 @@ #ifndef CAMSERIALIZER_H_ #define CAMSERIALIZER_H_ -#include <pthread.h> #include <deque> #include <cassert> #include <memory> diff --git a/AudioManagerUtilities/include/TAmPluginTemplate.h b/AudioManagerUtilities/include/TAmPluginTemplate.h index f000fbe..95523f1 100644 --- a/AudioManagerUtilities/include/TAmPluginTemplate.h +++ b/AudioManagerUtilities/include/TAmPluginTemplate.h @@ -86,6 +86,46 @@ template<class T> T* getCreateFunction(const std::string& libname, void*& librar return (createFunction); } +/** + * * This template tries to destroy + * @param libname the full path to the library to be loaded + * + */ +template<class T> T* getDestroyFunction(const std::string& libname,void* libraryHandle) +{ + logInfo("destroy : Trying to destroy : ",libname); + + // cut off directories + char* fileWithPath = const_cast<char*>(libname.c_str()); + std::string libFileName = basename(fileWithPath); + + // cut off "lib" in front and cut off .so end" + std::string destroyFunctionName = "destroy" + libFileName.substr(3, libFileName.length() - 6); + + // get entry point from shared lib + dlerror(); // Clear any existing error + union + { + void* voidPointer; + T* typedPointer; + } functionPointer; + + functionPointer.voidPointer = dlsym(libraryHandle, destroyFunctionName.c_str()); + T* destroyFunction = functionPointer.typedPointer; + + const char* dlsym_error = dlerror(); + if (!destroyFunction || dlsym_error) + { + logError("getDestroyFunction: Failed to load shared lib entry point function name=", + destroyFunctionName, "error=",dlsym_error); + } + else + { + logInfo("getDestroyFunction: loaded successfully plugin", destroyFunctionName); + } + return (destroyFunction); +} + } #endif /* PLUGINTEMPLATE_H_ */ |