blob: 38a444a7335ac449e04d9087e3aca3e9f0735c06 [file] [log] [blame]
Thang Tranba2241c2021-10-26 17:47:09 +07001#include "config.h"
2
3#include "host_condition.hpp"
4
Thang Tranba2241c2021-10-26 17:47:09 +07005#include <sdbusplus/bus.hpp>
6
7#include <cstdlib>
8#include <iostream>
9
10int 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;
Patrick Williamscadaab72024-04-18 21:29:26 -050026 std::string busName = HOST_GPIOS_BUSNAME + hostId;
Thang Tranba2241c2021-10-26 17:47:09 +070027
28 // Add sdbusplus ObjectManager
Patrick Williamsf053e6f2022-07-22 19:26:54 -050029 sdbusplus::server::manager_t objManager(bus, objGroupName.c_str());
Thang Tranba2241c2021-10-26 17:47:09 +070030
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}