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