blob: 90cfff1164ba97677d8c5665d6a34cab5a6ab4eb [file] [log] [blame]
Alexander Hansen1e833b42025-03-04 10:20:33 +01001#pragma once
2
3#include <sdbusplus/async/context.hpp>
4#include <sdbusplus/async/match.hpp>
5#include <xyz/openbmc_project/State/Host/client.hpp>
6
7namespace phosphor::software::host_power
8{
9
10const auto stateOn =
11 sdbusplus::client::xyz::openbmc_project::state::Host<>::HostState::Running;
12const auto stateOff =
13 sdbusplus::client::xyz::openbmc_project::state::Host<>::HostState::Off;
14
15using HostState =
16 sdbusplus::client::xyz::openbmc_project::state::Host<>::HostState;
17
18class HostPower
19{
20 public:
21 HostPower(sdbusplus::async::context& ctx);
22
23 // @param state desired powerstate
24 // @returns true on success
25 static sdbusplus::async::task<bool> setState(sdbusplus::async::context& ctx,
26 HostState state);
27
28 // @returns host powerstate
29 static sdbusplus::async::task<HostState> getState(
30 sdbusplus::async::context& ctx);
31
32 sdbusplus::async::match stateChangedMatch;
33};
34
35}; // namespace phosphor::software::host_power