Thang Tran | ba2241c | 2021-10-26 17:47:09 +0700 | [diff] [blame] | 1 | #include "config.h" |
| 2 | |
| 3 | #include "host_condition.hpp" |
| 4 | |
Thang Tran | ba2241c | 2021-10-26 17:47:09 +0700 | [diff] [blame] | 5 | #include <sdbusplus/bus.hpp> |
| 6 | |
| 7 | #include <cstdlib> |
| 8 | #include <iostream> |
| 9 | |
| 10 | int main(int argc, char** argv) |
| 11 | { |
| 12 | std::string hostId; |
| 13 | |
| 14 | if (argc == 2) |
| 15 | { |
| 16 | hostId = std::string(argv[1]); |
| 17 | } |
| 18 | else |
| 19 | { |
| 20 | return 0; |
| 21 | } |
| 22 | |
| 23 | auto bus = sdbusplus::bus::new_default(); |
| 24 | std::string objGroupName = HOST_GPIOS_OBJPATH; |
| 25 | std::string objPathInst = objGroupName + "/host" + hostId; |
| 26 | std::string busName = HOST_GPIOS_BUSNAME; |
| 27 | |
| 28 | // Add sdbusplus ObjectManager |
Patrick Williams | f053e6f | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 29 | sdbusplus::server::manager_t objManager(bus, objGroupName.c_str()); |
Thang Tran | ba2241c | 2021-10-26 17:47:09 +0700 | [diff] [blame] | 30 | |
| 31 | // For now, we only support checking Host0 status |
| 32 | auto host = std::make_unique<phosphor::condition::Host>( |
| 33 | bus, objPathInst.c_str(), hostId); |
| 34 | |
| 35 | bus.request_name(busName.c_str()); |
| 36 | |
| 37 | while (true) |
| 38 | { |
| 39 | bus.process_discard(); |
| 40 | bus.wait(); |
| 41 | } |
| 42 | |
| 43 | return 0; |
| 44 | } |