diff options
author | Christian Linke <christian.linke@bmw.de> | 2015-10-06 19:19:15 +0100 |
---|---|---|
committer | Christian Linke <christian.linke@bmw.de> | 2015-10-06 19:28:39 +0100 |
commit | b8b2aa9fb51dcbc8a4c95de21ba1ac34c54c2043 (patch) | |
tree | 4ae2390e8e08ead6e5a0b69774a8b41e17997a18 | |
parent | 32f74d1bd670c3a7623fa5cd52d96a7646152ccd (diff) | |
download | audiomanager-b8b2aa9fb51dcbc8a4c95de21ba1ac34c54c2043.tar.gz |
make changes in utilities compile
Signed-off-by: Christian Linke <christian.linke@bmw.de>
-rw-r--r-- | AudioManagerUtilities/CMakeLists.txt | 14 | ||||
-rw-r--r-- | AudioManagerUtilities/include/CAmDltWrapper.h | 44 | ||||
-rw-r--r-- | AudioManagerUtilities/src/CAmDbusWrapper.cpp | 4 |
3 files changed, 29 insertions, 33 deletions
diff --git a/AudioManagerUtilities/CMakeLists.txt b/AudioManagerUtilities/CMakeLists.txt index 78967a6..7a0c5cc 100644 --- a/AudioManagerUtilities/CMakeLists.txt +++ b/AudioManagerUtilities/CMakeLists.txt @@ -26,8 +26,7 @@ INCLUDE_DIRECTORIES( ${INCLUDE_FOLDER} ${AUDIO_INCLUDE_FOLDER} ${AUDIOMANAGER_INCLUDE_FOLDER} - ${DBUS_INCLUDE_DIR} - ${DBUS_ARCH_INCLUDE_DIR} + ${DBUS_INCLUDE_DIRS} ${TCLAP_INCLUDE_DIR} ) @@ -43,18 +42,17 @@ SET(AUDIO_MANAGER_UTILITIES_SRCS_CXX src/CAmSocketHandler.cpp) IF (WITH_DBUS_WRAPPER) - FIND_PACKAGE(DBUS REQUIRED) + pkg_check_modules (DBUS "dbus-1 >= 1.4") ENDIF (WITH_DBUS_WRAPPER) IF (WITH_CAPI_WRAPPER) - FIND_PACKAGE(DBUS REQUIRED) FIND_PACKAGE(CommonAPI REQUIRED) ENDIF (WITH_CAPI_WRAPPER) IF (WITH_DBUS_WRAPPER) SET (AM_LINK_LIBS ${AM_LINK_LIBS} - ${DBUS_LIBRARY}) + ${DBUS_LIBRARIES}) SET(AUDIO_MANAGER_UTILITIES_SRCS_CXX ${AUDIO_MANAGER_UTILITIES_SRCS_CXX} src/CAmDbusWrapper.cpp) @@ -63,16 +61,14 @@ ENDIF (WITH_DBUS_WRAPPER) IF (WITH_CAPI_WRAPPER) SET(AM_LINK_LIBS ${AM_LINK_LIBS} - ${DBUS_LIBRARY} + ${DBUS_LIBRARIES} ${COMMON_API_LIBRARIES} ${COMMON_API_DBUS_LIBRARIES}) SET(AUDIO_MANAGER_UTILITIES_SRCS_CXX ${AUDIO_MANAGER_UTILITIES_SRCS_CXX} src/CAmCommonAPIWrapper.cpp) INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} - ${COMMON_API_INCLUDE_DIRS} - ${COMMON_API_DBUS_INCLUDE_DIRS} - ${COMMON_API_GEN_INCLUDE_DIR}) + ${COMMONAPI_INCLUDE_DIRS}) ENDIF (WITH_CAPI_WRAPPER) ADD_LIBRARY(AudioManagerUtilities ${LIBRARY_TYPE} ${AUDIO_MANAGER_UTILITIES_SRCS_CXX}) diff --git a/AudioManagerUtilities/include/CAmDltWrapper.h b/AudioManagerUtilities/include/CAmDltWrapper.h index 8dbd0bc..0c2b4d0 100644 --- a/AudioManagerUtilities/include/CAmDltWrapper.h +++ b/AudioManagerUtilities/include/CAmDltWrapper.h @@ -128,7 +128,7 @@ public: void append(const std::vector<uint8_t> & data); // specialization for const char* - template<typename T = const char*> void append(const char* value) + template<typename T = const char*&> void append(const char*& value) { #ifdef WITH_DLT dlt_user_log_write_string(&mDltContextData, value); @@ -138,7 +138,7 @@ public: } // specialization for const am_Error_e - template<typename T = const am_Error_e> void CAmDltWrapper::append(const am_Error_e value) + template<typename T = const am_Error_e> void append(const am_Error_e value) { const char* str_error[E_MAX] = { "E_OK", @@ -207,55 +207,55 @@ inline CAmDltWrapper* getWrapper() } /** - * logs given values with debuglevel with the default context + * logs given values with a given context (register first!) and given loglevel + * @param context + * @param loglevel * @param value * @param ... */ template<typename T, typename... TArgs> -void logDebug(T value, TArgs... args) +void log(DltContext* const context, DltLogLevelType loglevel, T value, TArgs... args) { - log(NULL, DLT_LOG_DEBUG, value, args...); + CAmDltWrapper* inst(getWrapper()); + + if (!inst->init(loglevel, context)) + return; + inst->append(value); + inst->append(args...); + inst->send(); } /** - * logs given values with infolevel with the default context + * logs given values with debuglevel with the default context * @param value * @param ... */ template<typename T, typename... TArgs> -void logInfo(T value, TArgs... args) +void logDebug(T value, TArgs... args) { - log(NULL, DLT_LOG_INFO, value, args...); + log(NULL, DLT_LOG_DEBUG, value, args...); } /** - * logs given values with errorlevel with the default context + * logs given values with infolevel with the default context * @param value * @param ... */ template<typename T, typename... TArgs> -void logError(T value, TArgs... args) +void logInfo(T value, TArgs... args) { - log(NULL, DLT_LOG_ERROR, value, args...); + log(NULL, DLT_LOG_INFO, value, args...); } /** - * logs given values with a given context (register first!) and given loglevel - * @param context - * @param loglevel + * logs given values with errorlevel with the default context * @param value * @param ... */ template<typename T, typename... TArgs> -void log(DltContext* const context, DltLogLevelType loglevel, T value, TArgs... args) +void logError(T value, TArgs... args) { - CAmDltWrapper* inst(getWrapper()); - - if (!inst->init(loglevel, context)) - return; - inst->append(value); - inst->append(args...); - inst->send(); + log(NULL, DLT_LOG_ERROR,value,args...); } } diff --git a/AudioManagerUtilities/src/CAmDbusWrapper.cpp b/AudioManagerUtilities/src/CAmDbusWrapper.cpp index fa41a2e..84ac4a3 100644 --- a/AudioManagerUtilities/src/CAmDbusWrapper.cpp +++ b/AudioManagerUtilities/src/CAmDbusWrapper.cpp @@ -108,8 +108,8 @@ CAmDbusWrapper::CAmDbusWrapper(CAmSocketHandler* socketHandler, DBusBusType type //register callback for Introspectio mObjectPathVTable.message_function = CAmDbusWrapper::cbRootIntrospection; - dbus_connection_register_object_path(mpDbusConnection, objectPath, &mObjectPathVTable, this); - int ret = dbus_bus_request_name(mpDbusConnection, prefix, DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError); + dbus_connection_register_object_path(mpDbusConnection, objectPath.c_str(), &mObjectPathVTable, this); + int ret = dbus_bus_request_name(mpDbusConnection, prefix.c_str(), DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError); if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER == ret) { logInfo("DBusWrapper::DBusWrapper We own", prefix); |