diff options
Diffstat (limited to 'AudioManagerDaemon/src/DBusWrapper.cpp')
-rw-r--r-- | AudioManagerDaemon/src/DBusWrapper.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/AudioManagerDaemon/src/DBusWrapper.cpp b/AudioManagerDaemon/src/DBusWrapper.cpp index a34b6e8..66a135a 100644 --- a/AudioManagerDaemon/src/DBusWrapper.cpp +++ b/AudioManagerDaemon/src/DBusWrapper.cpp @@ -34,7 +34,7 @@ using namespace am; -DLT_IMPORT_CONTEXT(DLT_CONTEXT) +DLT_IMPORT_CONTEXT(AudioManager) #define ROOT_INTROSPECT_XML \ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ @@ -58,16 +58,16 @@ DBusWrapper::DBusWrapper() mListTimerhandlePointer() { dbus_error_init(&mDBusError); - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::DBusWrapper Opening DBus connection")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::DBusWrapper Opening DBus connection")); mDbusConnection=dbus_bus_get(DBUS_BUS_SESSION, &mDBusError); if (dbus_error_is_set(&mDBusError)) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Error while getting the DBus")); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Error while getting the DBus")); dbus_error_free(&mDBusError); } if (NULL == mDbusConnection) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper DBus Connection is null")); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper DBus Connection is null")); } //first, we are old enought to live longer then the connection: @@ -78,12 +78,12 @@ DBusWrapper::DBusWrapper() int ret = dbus_bus_request_name(mDbusConnection,DBUS_SERVICE_PREFIX,DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError); if (dbus_error_is_set(&mDBusError)) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Name Error"),DLT_STRING(mDBusError.message)); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Name Error"),DLT_STRING(mDBusError.message)); dbus_error_free(&mDBusError); } if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Wrapper is not the Primary Owner"), DLT_INT(ret)); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Wrapper is not the Primary Owner"), DLT_INT(ret)); exit(1); } } @@ -102,16 +102,16 @@ DBusWrapper::DBusWrapper(SocketHandler* socketHandler) assert(mSocketHandler!=0); dbus_error_init(&mDBusError); - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::DBusWrapper Opening DBus connection")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::DBusWrapper Opening DBus connection")); mDbusConnection=dbus_bus_get(DBUS_BUS_SESSION, &mDBusError); if (dbus_error_is_set(&mDBusError)) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Error while getting the DBus")); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Error while getting the DBus")); dbus_error_free(&mDBusError); } if (NULL == mDbusConnection) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper DBus Connection is null")); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper DBus Connection is null")); } //then we need to adopt the dbus to our mainloop: @@ -125,14 +125,14 @@ DBusWrapper::DBusWrapper(SocketHandler* socketHandler) dbus_bool_t watch=dbus_connection_set_watch_functions(mDbusConnection, addWatch, removeWatch, toogleWatch , this, NULL); if (!watch) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Registering of watch functions failed")); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Registering of watch functions failed")); } //add timer functions: dbus_bool_t timer=dbus_connection_set_timeout_functions(mDbusConnection, addTimeout, removeTimeout, toggleTimeout, this, NULL); if(!timer) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Registering of timer functions failed")); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Registering of timer functions failed")); } //register callback for Introspectio @@ -141,12 +141,12 @@ DBusWrapper::DBusWrapper(SocketHandler* socketHandler) int ret = dbus_bus_request_name(mDbusConnection,DBUS_SERVICE_PREFIX,DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError); if (dbus_error_is_set(&mDBusError)) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Name Error"),DLT_STRING(mDBusError.message)); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Name Error"),DLT_STRING(mDBusError.message)); dbus_error_free(&mDBusError); } if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Wrapper is not the Primary Owner"), DLT_INT(ret)); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Wrapper is not the Primary Owner"), DLT_INT(ret)); exit(1); } } @@ -154,7 +154,7 @@ DBusWrapper::DBusWrapper(SocketHandler* socketHandler) DBusWrapper::~DBusWrapper() { //close the connection again - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::~DBusWrapper Closing DBus connection")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::~DBusWrapper Closing DBus connection")); dbus_connection_unref(mDbusConnection); //clean up all timerhandles we created but did not delete before @@ -167,7 +167,7 @@ DBusWrapper::~DBusWrapper() void DBusWrapper::registerCallback(const DBusObjectPathVTable* vtable, const std::string& path, void* userdata) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::~registerCallback register callback:"),DLT_STRING(path.c_str())); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::~registerCallback register callback:"),DLT_STRING(path.c_str())); std::string completePath=std::string(DBUS_SERVICE_OBJECT_PATH)+"/"+path; dbus_error_init(&mDBusError); @@ -175,7 +175,7 @@ void DBusWrapper::registerCallback(const DBusObjectPathVTable* vtable, const std dbus_connection_register_object_path(mDbusConnection,completePath.c_str(), vtable, userdata); if (dbus_error_is_set(&mDBusError)) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::registerCallack error: "),DLT_STRING(mDBusError.message)); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::registerCallack error: "),DLT_STRING(mDBusError.message)); dbus_error_free(&mDBusError); } mNodesList.push_back(path); @@ -183,7 +183,7 @@ void DBusWrapper::registerCallback(const DBusObjectPathVTable* vtable, const std DBusHandlerResult DBusWrapper::cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::~cbRootIntrospection called:")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::~cbRootIntrospection called:")); mReference=(DBusWrapper*)reference; std::list<std::string>nodesList=mReference->mNodesList; @@ -210,13 +210,13 @@ DBusHandlerResult DBusWrapper::cbRootIntrospection(DBusConnection *conn, DBusMes dbus_message_iter_init_append(reply, &args); if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &string)) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::~cbRootIntrospection DBUS Out Of Memory!")); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::~cbRootIntrospection DBUS Out Of Memory!")); } // send the reply && flush the connection if (!dbus_connection_send(conn, reply, &serial)) { - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::~cbRootIntrospection DBUS Out Of Memory!")); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::~cbRootIntrospection DBUS Out Of Memory!")); } dbus_connection_flush(conn); // free the reply @@ -232,7 +232,7 @@ DBusHandlerResult DBusWrapper::cbRootIntrospection(DBusConnection *conn, DBusMes void DBusWrapper::dbusMainLoop() { - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusMainLoop Entering MainLoop")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusMainLoop Entering MainLoop")); while (dbus_connection_read_write_dispatch(mDbusConnection, -1)) { @@ -265,7 +265,7 @@ dbus_bool_t DBusWrapper::addWatchDelegate(DBusWatch * watch, void* userData) if (flags & DBUS_WATCH_WRITABLE) event |= POLLOUT; } - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::addWatchDelegate entered new watch, fd="),DLT_INT(dbus_watch_get_unix_fd(watch)),DLT_STRING("event flag="),DLT_INT(event)); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::addWatchDelegate entered new watch, fd="),DLT_INT(dbus_watch_get_unix_fd(watch)),DLT_STRING("event flag="),DLT_INT(event)); am_Error_e error=mSocketHandler->addFDPoll(dbus_watch_get_unix_fd(watch),event,NULL,&pDbusFireCallback,&pDbusCheckCallback,&pDbusDispatchCallback,watch,handle); //if everything is alright, add the watch and the handle to our map so we know this relationship @@ -274,7 +274,7 @@ dbus_bool_t DBusWrapper::addWatchDelegate(DBusWatch * watch, void* userData) mMapHandleWatch.insert(std::make_pair(watch,handle)); return true; } - DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::addWatchDelegate entering watch failed")); + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::addWatchDelegate entering watch failed")); } void DBusWrapper::removeWatch(DBusWatch *watch, void *userData) @@ -289,7 +289,7 @@ void DBusWrapper::removeWatchDelegate(DBusWatch *watch, void *userData) std::map<DBusWatch*,sh_pollHandle_t>::iterator iterator=mMapHandleWatch.begin(); iterator=mMapHandleWatch.find(watch); if (iterator!=mMapHandleWatch.end()) mSocketHandler->removeFDPoll(iterator->second); - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::removeWatch removed watch with handle"),DLT_INT(iterator->second)); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::removeWatch removed watch with handle"),DLT_INT(iterator->second)); mMapHandleWatch.erase(iterator); } @@ -314,7 +314,7 @@ void DBusWrapper::toogleWatchDelegate(DBusWatch *watch, void *userData) std::map<DBusWatch*,sh_pollHandle_t>::iterator iterator=mMapHandleWatch.begin(); iterator=mMapHandleWatch.find(watch); if (iterator!=mMapHandleWatch.end()) mSocketHandler->updateEventFlags(iterator->second,event); - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::toogleWatchDelegate watch was toggeled")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::toogleWatchDelegate watch was toggeled")); } dbus_bool_t DBusWrapper::addTimeout(DBusTimeout *timeout, void* userData) @@ -347,7 +347,7 @@ dbus_bool_t DBusWrapper::addTimeoutDelegate(DBusTimeout *timeout,void* userData) //save timeout in Socket context userData=timeout; - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::addTimeoutDelegate a timeout was added")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::addTimeoutDelegate a timeout was added")); return true; } @@ -375,7 +375,7 @@ void DBusWrapper::removeTimeoutDelegate(DBusTimeout *timeout, void* userData) } } delete handle; - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::removeTimeoutDelegate a timeout was removed")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::removeTimeoutDelegate a timeout was removed")); } void DBusWrapper::toggleTimeout(DBusTimeout *timeout, void* userData) @@ -391,7 +391,7 @@ bool am::DBusWrapper::dbusDispatchCallback(const sh_pollHandle_t handle, void *u dbus_connection_ref(mDbusConnection); if (dbus_connection_dispatch(mDbusConnection)==DBUS_DISPATCH_COMPLETE) returnVal=false; dbus_connection_unref(mDbusConnection); - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusDispatchCallback was called")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusDispatchCallback was called")); return returnVal; } @@ -401,7 +401,7 @@ bool am::DBusWrapper::dbusCheckCallback(const sh_pollHandle_t handle, void *user dbus_connection_ref(mDbusConnection); if (dbus_connection_get_dispatch_status(mDbusConnection) == DBUS_DISPATCH_DATA_REMAINS) returnVal=true; dbus_connection_unref(mDbusConnection); - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusCheckCallback was called")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusCheckCallback was called")); return returnVal; } @@ -420,7 +420,7 @@ void am::DBusWrapper::dbusFireCallback(const pollfd pollfd, const sh_pollHandle_ dbus_connection_ref(mDbusConnection); bool ok=dbus_watch_handle(watch, flags); dbus_connection_unref(mDbusConnection); - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusFireCallback was called")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusFireCallback was called")); } void DBusWrapper::toggleTimeoutDelegate(DBusTimeout *timeout, void* userData) @@ -442,7 +442,7 @@ void DBusWrapper::toggleTimeoutDelegate(DBusTimeout *timeout, void* userData) { mSocketHandler->stopTimer(*handle); } - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::toggleTimeoutDelegate was called")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::toggleTimeoutDelegate was called")); } void DBusWrapper::dbusTimerCallback(sh_timerHandle_t handle, void *userData) @@ -456,7 +456,7 @@ void DBusWrapper::dbusTimerCallback(sh_timerHandle_t handle, void *userData) mSocketHandler->restartTimer(handle,ts); } dbus_timeout_handle((DBusTimeout*)userData); - DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusTimerCallback was called")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusTimerCallback was called")); } |