xref: /openbmc/phosphor-pid-control/ipmi/dbus_mode.hpp (revision 92110f8ddbc5e73ccdccdf4016fc0be8a40048c1)
1 #pragma once
2 
3 #include "control.hpp"
4 
5 #include <cstdint>
6 #include <string>
7 
8 namespace pid_control::ipmi
9 {
10 
11 class DbusZoneControl : public ZoneControlInterface
12 {
13   public:
14     DbusZoneControl() = default;
15     ~DbusZoneControl() override = default;
16 
17     /*
18      * busctl call xyz.openbmc_project.State.FanCtrl \
19      *     /xyz/openbmc_project/settings/fanctrl/zone1 \
20      *     org.freedesktop.DBus.Properties \
21      *     GetAll \
22      *     s \
23      *     xyz.openbmc_project.Control.Mode
24      * a{sv} 2 "Manual" b false "FailSafe" b false
25      *
26      * This returns an IPMI code as a uint8_t (which will always be sufficient
27      * to hold the result). NOTE: This does not return the typedef value to
28      * avoid including a header with conflicting types.
29      */
30     uint8_t getFanCtrlProperty(uint8_t zoneId, bool* value,
31                                const std::string& property) override;
32 
33     uint8_t setFanCtrlProperty(uint8_t zoneId, bool value,
34                                const std::string& property) override;
35 };
36 
37 } // namespace pid_control::ipmi
38