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