1 #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 
11 int 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
30     sdbusplus::server::manager_t objManager(bus, objGroupName.c_str());
31 
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 }
46