Cheng C Yang | eecaf82 | 2019-12-19 00:34:23 +0800 | [diff] [blame] | 1 | /* |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 2 | // Copyright (c) 2018 Intel Corporation |
Cheng C Yang | eecaf82 | 2019-12-19 00:34:23 +0800 | [diff] [blame] | 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "mdrv2.hpp" |
| 18 | |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 19 | #include <boost/asio/io_context.hpp> |
Cheng C Yang | eecaf82 | 2019-12-19 00:34:23 +0800 | [diff] [blame] | 20 | #include <phosphor-logging/elog-errors.hpp> |
| 21 | #include <phosphor-logging/elog.hpp> |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 22 | #include <sdbusplus/asio/connection.hpp> |
| 23 | #include <sdbusplus/asio/object_server.hpp> |
| 24 | |
Josh Lehan | 027277a | 2023-09-11 05:28:19 -0700 | [diff] [blame^] | 25 | int main() |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 26 | { |
Josh Lehan | 027277a | 2023-09-11 05:28:19 -0700 | [diff] [blame^] | 27 | auto io = std::make_shared<boost::asio::io_context>(); |
| 28 | auto connection = std::make_shared<sdbusplus::asio::connection>(*io); |
| 29 | auto objServer = |
| 30 | std::make_shared<sdbusplus::asio::object_server>(connection); |
Cheng C Yang | eecaf82 | 2019-12-19 00:34:23 +0800 | [diff] [blame] | 31 | |
Josh Lehan | 027277a | 2023-09-11 05:28:19 -0700 | [diff] [blame^] | 32 | sdbusplus::server::manager_t objManager(*connection, |
Patrick Williams | 77b9c47 | 2022-07-22 19:26:57 -0500 | [diff] [blame] | 33 | "/xyz/openbmc_project/inventory"); |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 34 | |
Josh Lehan | 027277a | 2023-09-11 05:28:19 -0700 | [diff] [blame^] | 35 | connection->request_name("xyz.openbmc_project.Smbios.MDR_V2"); |
Cheng C Yang | eecaf82 | 2019-12-19 00:34:23 +0800 | [diff] [blame] | 36 | |
Josh Lehan | 027277a | 2023-09-11 05:28:19 -0700 | [diff] [blame^] | 37 | auto mdrV2 = std::make_shared<phosphor::smbios::MDRV2>( |
| 38 | io, connection, objServer, mdrDefaultFile, |
| 39 | phosphor::smbios::defaultObjectPath, |
| 40 | phosphor::smbios::defaultInventoryPath); |
Cheng C Yang | eecaf82 | 2019-12-19 00:34:23 +0800 | [diff] [blame] | 41 | |
Josh Lehan | 027277a | 2023-09-11 05:28:19 -0700 | [diff] [blame^] | 42 | io->run(); |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 43 | |
Cheng C Yang | eecaf82 | 2019-12-19 00:34:23 +0800 | [diff] [blame] | 44 | return 0; |
| 45 | } |