blob: b6fd27241ee7ad9a94049ee11c87503e3362e883 [file] [log] [blame]
Alexander Hansen0ab32b32025-06-27 14:50:33 +02001#pragma once
2
3#include <sdbusplus/asio/connection.hpp>
4#include <sdbusplus/bus/match.hpp>
5
6namespace power
7{
8
Alexander Hansen0ab32b32025-06-27 14:50:33 +02009class PowerStatusMonitor
10{
11 public:
Alexander Hansene1646272025-07-25 11:47:17 +020012 explicit PowerStatusMonitor(sdbusplus::asio::connection& conn);
13
14 bool isPowerOn() const;
Alexander Hansen0ab32b32025-06-27 14:50:33 +020015
16 private:
Alexander Hansen0a4bb2a2025-07-25 11:34:48 +020017 void handlePowerMatch(sdbusplus::message_t& message);
Alexander Hansene1646272025-07-25 11:47:17 +020018 void getInitialPowerStatus(sdbusplus::asio::connection& conn);
Alexander Hansen0a4bb2a2025-07-25 11:34:48 +020019
Alexander Hansen0ab32b32025-06-27 14:50:33 +020020 bool powerStatusOn = false;
Alexander Hansene1646272025-07-25 11:47:17 +020021 sdbusplus::bus::match_t powerMatch;
Alexander Hansen0ab32b32025-06-27 14:50:33 +020022};
23
24} // namespace power