Shift to boost asio library
This commit shifts vpd manager from sdbusplus event loop to
boost io_context event loop.
The shift was done to have a more flexible way to perform
async Dbus calls.
For example read/write of vpd data can be performed
asynchronously.
It also removes dependency of Manager class on the interface
class created as a part of Phosphor-Dbus-Interface repo.
Test:
- Introspect com.ibm.VPD.Manager /com/ibm/VPD/Manager to ensure
that all the methods exposed under com.ibm.VPD.Manager interface
matches to the ones documented under PDI repo.
- Make DBus call to each of the exposed api to ensure that the
funcation calls are working fine.
-To ensure bios handler call back is working.
Stop vpd-manager service.
Stop pldm service.
Start vpd-manager service
Start pldm service.
Should recieve callback.
-To ensure gpio call back
std::cout were added to callback function being trigerred on
timer expiration and the same were verified in journal.
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: I00640f64de487d5244e8be2e7a3f3d63a013644e
diff --git a/vpd-manager/manager_main.cpp b/vpd-manager/manager_main.cpp
index fce02b4..bf8c0d9 100644
--- a/vpd-manager/manager_main.cpp
+++ b/vpd-manager/manager_main.cpp
@@ -2,18 +2,29 @@
#include "manager.hpp"
-#include <cstdlib>
-#include <exception>
-#include <iostream>
-#include <sdbusplus/bus.hpp>
+#include <sdbusplus/asio/connection.hpp>
int main(int /*argc*/, char** /*argv*/)
{
try
{
- openpower::vpd::manager::Manager vpdManager(
- sdbusplus::bus::new_system(), BUSNAME, OBJPATH, IFACE);
- vpdManager.run();
+ auto io_con = std::make_shared<boost::asio::io_context>();
+ auto connection =
+ std::make_shared<sdbusplus::asio::connection>(*io_con);
+ connection->request_name(BUSNAME);
+
+ auto server = sdbusplus::asio::object_server(connection);
+
+ std::shared_ptr<sdbusplus::asio::dbus_interface> interface =
+ server.add_interface(OBJPATH, IFACE);
+
+ auto vpdManager = std::make_shared<openpower::vpd::manager::Manager>(
+ io_con, interface, connection);
+ interface->initialize();
+
+ // Start event loop.
+ io_con->run();
+
exit(EXIT_SUCCESS);
}
catch (const std::exception& e)