xref: /openbmc/entity-manager/src/entity_manager/power_status_monitor.hpp (revision 0ab32b3ff6a89e752350befe1821b36e6edc7d04)
1 #pragma once
2 
3 #include <sdbusplus/asio/connection.hpp>
4 #include <sdbusplus/bus/match.hpp>
5 
6 namespace power
7 {
8 
9 const static constexpr char* busname = "xyz.openbmc_project.State.Host";
10 const static constexpr char* interface = "xyz.openbmc_project.State.Host";
11 const static constexpr char* path = "/xyz/openbmc_project/state/host0";
12 const static constexpr char* property = "CurrentHostState";
13 
14 class PowerStatusMonitor
15 {
16   public:
17     bool isPowerOn();
18     void setupPowerMatch(
19         const std::shared_ptr<sdbusplus::asio::connection>& conn);
20 
21   private:
22     bool powerStatusOn = false;
23     std::unique_ptr<sdbusplus::bus::match_t> powerMatch = nullptr;
24 };
25 
26 } // namespace power
27