Modify D-Bus to using asio server
DBus updates are now using the asio server way.
Tested:
Tested with unit tests and locally on a machine.
Signed-off-by: Kasun Athukorala <kasunath@google.com>
Change-Id: I77553bcc3baae70e5d684a62f2c19592ff844665
Signed-off-by: Brandon Kim <brandonkim@google.com>
diff --git a/src/rde/external_storer_file.cpp b/src/rde/external_storer_file.cpp
index 5cc14cf..1ffea44 100644
--- a/src/rde/external_storer_file.cpp
+++ b/src/rde/external_storer_file.cpp
@@ -46,10 +46,11 @@
}
ExternalStorerFileInterface::ExternalStorerFileInterface(
- sdbusplus::bus_t& bus, std::string_view rootPath,
+ const std::shared_ptr<sdbusplus::asio::connection>& conn,
+ std::string_view rootPath,
std::unique_ptr<FileHandlerInterface> fileHandler) :
rootPath(rootPath), fileHandler(std::move(fileHandler)), logServiceId(""),
- cperNotifier(std::make_unique<CperFileNotifierHandler>(bus))
+ cperNotifier(std::make_unique<CperFileNotifierHandler>(conn))
{}
bool ExternalStorerFileInterface::publishJson(std::string_view jsonStr)
diff --git a/src/rde/notifier_dbus_handler.cpp b/src/rde/notifier_dbus_handler.cpp
index 2151925..e6d5e4e 100644
--- a/src/rde/notifier_dbus_handler.cpp
+++ b/src/rde/notifier_dbus_handler.cpp
@@ -5,15 +5,17 @@
namespace rde
{
-CperFileNotifierHandler::CperFileNotifierHandler(sdbusplus::bus_t& bus) :
- bus(bus), objManager(bus, CperFileNotifier::cperBasePath)
+CperFileNotifierHandler::CperFileNotifierHandler(
+ const std::shared_ptr<sdbusplus::asio::connection>& conn) :
+ objManager(static_cast<sdbusplus::bus_t&>(*conn),
+ CperFileNotifier::cperBasePath),
+ objServer(conn)
{}
void CperFileNotifierHandler::createEntry(const std::string& filePath)
{
- auto obj = std::make_unique<CperFileNotifier>(bus, filePath, nextEntry);
- // Notify fault log monitor through InterfacesAdded signal.
- obj->emit_added();
+ auto obj =
+ std::make_unique<CperFileNotifier>(objServer, filePath, nextEntry);
notifierObjs.push_back(std::move(obj));
++nextEntry;
}