Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 1 | #include "config.h" |
Andrew Geissler | e426b58 | 2020-05-28 12:40:55 -0500 | [diff] [blame] | 2 | |
Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 3 | #include "bmc_state_manager.hpp" |
| 4 | |
Andrew Geissler | e426b58 | 2020-05-28 12:40:55 -0500 | [diff] [blame] | 5 | #include <sdbusplus/bus.hpp> |
| 6 | |
Amithash Prasasd | f566c96 | 2024-07-22 20:28:42 -0700 | [diff] [blame] | 7 | using BMCState = sdbusplus::server::xyz::openbmc_project::state::BMC; |
| 8 | |
Andrew Geissler | 769a62f | 2019-12-06 13:36:08 -0600 | [diff] [blame] | 9 | int main() |
Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 10 | { |
| 11 | auto bus = sdbusplus::bus::new_default(); |
| 12 | |
| 13 | // For now, we only have one instance of the BMC |
| 14 | // 0 is for the current instance |
Amithash Prasasd | f566c96 | 2024-07-22 20:28:42 -0700 | [diff] [blame] | 15 | const auto* BMCName = BMCState::namespace_path::bmc; |
| 16 | const auto* objPath = BMCState::namespace_path::value; |
| 17 | std::string objPathInst = |
| 18 | sdbusplus::message::object_path(objPath) / BMCName; |
Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 19 | |
| 20 | // Add sdbusplus ObjectManager. |
Amithash Prasasd | 2eb6029 | 2024-08-13 19:19:07 -0700 | [diff] [blame] | 21 | sdbusplus::server::manager_t objManager(bus, objPath); |
Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 22 | |
Andrew Geissler | 58a1801 | 2018-01-19 19:36:05 -0800 | [diff] [blame] | 23 | phosphor::state::manager::BMC manager(bus, objPathInst.c_str()); |
Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 24 | |
Amithash Prasasd | f566c96 | 2024-07-22 20:28:42 -0700 | [diff] [blame] | 25 | bus.request_name(BMCState::interface); |
Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 26 | |
Andrew Geissler | 58a1801 | 2018-01-19 19:36:05 -0800 | [diff] [blame] | 27 | while (true) |
Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 28 | { |
| 29 | bus.process_discard(); |
| 30 | bus.wait(); |
| 31 | } |
| 32 | |
| 33 | exit(EXIT_SUCCESS); |
Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 34 | } |