SunnySrivastava1984 | b59fd09 | 2020-02-03 09:58:56 -0600 | [diff] [blame] | 1 | #include "config.h" |
| 2 | |
| 3 | #include "manager.hpp" |
| 4 | |
Sunny Srivastava | 523af2e | 2022-02-14 07:30:10 -0600 | [diff] [blame] | 5 | #include <sdbusplus/asio/connection.hpp> |
SunnySrivastava1984 | b59fd09 | 2020-02-03 09:58:56 -0600 | [diff] [blame] | 6 | |
Priyanga Ramasamy | 9d14934 | 2020-07-16 23:41:26 +0530 | [diff] [blame] | 7 | int main(int /*argc*/, char** /*argv*/) |
SunnySrivastava1984 | b59fd09 | 2020-02-03 09:58:56 -0600 | [diff] [blame] | 8 | { |
| 9 | try |
| 10 | { |
Sunny Srivastava | 523af2e | 2022-02-14 07:30:10 -0600 | [diff] [blame] | 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 | |
SunnySrivastava1984 | b59fd09 | 2020-02-03 09:58:56 -0600 | [diff] [blame] | 28 | exit(EXIT_SUCCESS); |
| 29 | } |
| 30 | catch (const std::exception& e) |
| 31 | { |
| 32 | std::cerr << e.what() << "\n"; |
| 33 | } |
| 34 | exit(EXIT_FAILURE); |
| 35 | } |