From a840b130c718aab155e81e46d009f4c85f8d9f41 Mon Sep 17 00:00:00 2001 From: Mateusz Malicki Date: Mon, 11 May 2015 10:57:29 +0200 Subject: [PATCH] Removed unnecessary debug messages logging [Bug] Unnecessary debug messages [Cause] Listening to signals from all the dbus buses [Solution] Listen on only one dbus interface [Verification] Build with DEBUG, run on odroid. There shouldn't be debug messages about received signals from external services Change-Id: I9096b581d970da5a6bd18beca5fa8d13688ab875 --- libs/dbus/connection.cpp | 11 +++++++---- libs/dbus/connection.hpp | 6 +++++- server/host-dbus-connection.cpp | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/dbus/connection.cpp b/libs/dbus/connection.cpp index 441174b..3485ea5 100644 --- a/libs/dbus/connection.cpp +++ b/libs/dbus/connection.cpp @@ -213,13 +213,16 @@ void DbusConnection::emitSignal(const std::string& objectPath, } DbusConnection::SubscriptionId DbusConnection::signalSubscribe(const SignalCallback& callback, - const std::string& senderBusName) + const std::string& senderBusName, + const std::string& interface, + const std::string& objectPath, + const std::string& member) { return g_dbus_connection_signal_subscribe(mConnection, senderBusName.empty() ? NULL : senderBusName.c_str(), - NULL, - NULL, - NULL, + interface.empty() ? NULL : interface.c_str(), + objectPath.empty() ? NULL : objectPath.c_str(), + member.empty() ? NULL : member.c_str(), NULL, G_DBUS_SIGNAL_FLAGS_NONE, &DbusConnection::onSignal, diff --git a/libs/dbus/connection.hpp b/libs/dbus/connection.hpp index 6603c9d..faf737c 100644 --- a/libs/dbus/connection.hpp +++ b/libs/dbus/connection.hpp @@ -125,7 +125,11 @@ public: * Empty sender means subscribe to all signals * Returns a subscription identifier that can be used to unsubscribe signal */ - SubscriptionId signalSubscribe(const SignalCallback& callback, const std::string& senderBusName); + SubscriptionId signalSubscribe(const SignalCallback& callback, + const std::string& senderBusName = "", + const std::string& interface = "", + const std::string& objectPath ="", + const std::string& member = ""); /** * Unsubscribes from a signal. diff --git a/server/host-dbus-connection.cpp b/server/host-dbus-connection.cpp index 98325ac..ad0ba0d 100644 --- a/server/host-dbus-connection.cpp +++ b/server/host-dbus-connection.cpp @@ -71,7 +71,8 @@ HostDbusConnection::HostDbusConnection() mSubscriptionId = mDbusConnection->signalSubscribe(std::bind(&HostDbusConnection::onSignalCall, this, _1, _2, _3, _4, _5), - std::string()); + std::string(), + api::dbus::INTERFACE); LOGD("Connected"); } -- 2.7.4