xref: /openbmc/openpower-vpd-parser/vpd-manager/manager_main.cpp (revision 6a1bd39b2aae6e97b6d804a2f71667cd9aee4532)
1 #include "config.h"
2 
3 #include "manager.hpp"
4 
5 #include <sdbusplus/asio/connection.hpp>
6 
7 int main(int /*argc*/, char** /*argv*/)
8 {
9     try
10     {
11         auto io_con = std::make_shared<boost::asio::io_context>();
12         auto connection =
13             std::make_shared<sdbusplus::asio::connection>(*io_con);
14         connection->request_name(BUSNAME);
15 
16         auto server = sdbusplus::asio::object_server(connection);
17 
18         std::shared_ptr<sdbusplus::asio::dbus_interface> interface =
19             server.add_interface(OBJPATH, IFACE);
20 
21         auto vpdManager = std::make_shared<openpower::vpd::manager::Manager>(
22             io_con, interface, connection);
23         interface->initialize();
24 
25         // Start event loop.
26         io_con->run();
27 
28         exit(EXIT_SUCCESS);
29     }
30     catch (const std::exception& e)
31     {
32         std::cerr << e.what() << "\n";
33     }
34     exit(EXIT_FAILURE);
35 }
36