xref: /openbmc/smbios-mdr/src/mdrv2_main.cpp (revision 027277a4)
1eecaf820SCheng C Yang /*
218a5ab91SZhikui Ren // Copyright (c) 2018 Intel Corporation
3eecaf820SCheng C Yang //
4eecaf820SCheng C Yang // Licensed under the Apache License, Version 2.0 (the "License");
5eecaf820SCheng C Yang // you may not use this file except in compliance with the License.
6eecaf820SCheng C Yang // You may obtain a copy of the License at
7eecaf820SCheng C Yang //
8eecaf820SCheng C Yang //      http://www.apache.org/licenses/LICENSE-2.0
9eecaf820SCheng C Yang //
10eecaf820SCheng C Yang // Unless required by applicable law or agreed to in writing, software
11eecaf820SCheng C Yang // distributed under the License is distributed on an "AS IS" BASIS,
12eecaf820SCheng C Yang // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13eecaf820SCheng C Yang // See the License for the specific language governing permissions and
14eecaf820SCheng C Yang // limitations under the License.
15eecaf820SCheng C Yang */
16eecaf820SCheng C Yang 
17eecaf820SCheng C Yang #include "mdrv2.hpp"
18eecaf820SCheng C Yang 
1918a5ab91SZhikui Ren #include <boost/asio/io_context.hpp>
20eecaf820SCheng C Yang #include <phosphor-logging/elog-errors.hpp>
21eecaf820SCheng C Yang #include <phosphor-logging/elog.hpp>
2218a5ab91SZhikui Ren #include <sdbusplus/asio/connection.hpp>
2318a5ab91SZhikui Ren #include <sdbusplus/asio/object_server.hpp>
2418a5ab91SZhikui Ren 
main()25*027277a4SJosh Lehan int main()
2618a5ab91SZhikui Ren {
27*027277a4SJosh Lehan     auto io = std::make_shared<boost::asio::io_context>();
28*027277a4SJosh Lehan     auto connection = std::make_shared<sdbusplus::asio::connection>(*io);
29*027277a4SJosh Lehan     auto objServer =
30*027277a4SJosh Lehan         std::make_shared<sdbusplus::asio::object_server>(connection);
31eecaf820SCheng C Yang 
32*027277a4SJosh Lehan     sdbusplus::server::manager_t objManager(*connection,
3377b9c478SPatrick Williams                                             "/xyz/openbmc_project/inventory");
3418a5ab91SZhikui Ren 
35*027277a4SJosh Lehan     connection->request_name("xyz.openbmc_project.Smbios.MDR_V2");
36eecaf820SCheng C Yang 
37*027277a4SJosh Lehan     auto mdrV2 = std::make_shared<phosphor::smbios::MDRV2>(
38*027277a4SJosh Lehan         io, connection, objServer, mdrDefaultFile,
39*027277a4SJosh Lehan         phosphor::smbios::defaultObjectPath,
40*027277a4SJosh Lehan         phosphor::smbios::defaultInventoryPath);
41eecaf820SCheng C Yang 
42*027277a4SJosh Lehan     io->run();
4318a5ab91SZhikui Ren 
44eecaf820SCheng C Yang     return 0;
45eecaf820SCheng C Yang }
46