xref: /openbmc/smbios-mdr/src/mdrv2_main.cpp (revision 18a5ab91)
1eecaf820SCheng C Yang /*
2*18a5ab91SZhikui 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 
19*18a5ab91SZhikui Ren #include <boost/asio/io_context.hpp>
20eecaf820SCheng C Yang #include <phosphor-logging/elog-errors.hpp>
21eecaf820SCheng C Yang #include <phosphor-logging/elog.hpp>
22*18a5ab91SZhikui Ren #include <sdbusplus/asio/connection.hpp>
23*18a5ab91SZhikui Ren #include <sdbusplus/asio/object_server.hpp>
24*18a5ab91SZhikui Ren 
25*18a5ab91SZhikui Ren boost::asio::io_context io;
26*18a5ab91SZhikui Ren auto connection = std::make_shared<sdbusplus::asio::connection>(io);
27*18a5ab91SZhikui Ren auto objServer = sdbusplus::asio::object_server(connection);
28*18a5ab91SZhikui Ren 
29*18a5ab91SZhikui Ren sdbusplus::asio::object_server& getObjectServer(void)
30*18a5ab91SZhikui Ren {
31*18a5ab91SZhikui Ren     return objServer;
32*18a5ab91SZhikui Ren }
33eecaf820SCheng C Yang 
34eecaf820SCheng C Yang int main(void)
35eecaf820SCheng C Yang {
36*18a5ab91SZhikui Ren     sdbusplus::bus::bus& bus = static_cast<sdbusplus::bus::bus&>(*connection);
37eecaf820SCheng C Yang     sdbusplus::server::manager::manager objManager(
38eecaf820SCheng C Yang         bus, "/xyz/openbmc_project/inventory");
39*18a5ab91SZhikui Ren 
40eecaf820SCheng C Yang     bus.request_name("xyz.openbmc_project.Smbios.MDR_V2");
41eecaf820SCheng C Yang 
42*18a5ab91SZhikui Ren     phosphor::smbios::MDR_V2 mdrV2(bus, phosphor::smbios::mdrV2Path, io);
43eecaf820SCheng C Yang 
44*18a5ab91SZhikui Ren     io.run();
45*18a5ab91SZhikui Ren 
46eecaf820SCheng C Yang     return 0;
47eecaf820SCheng C Yang }
48