xref: /openbmc/phosphor-hwmon/interface.hpp (revision 5906173aec2a48f37d1356f1ade788c8d25530b2)
1  #pragma once
2  
3  #include <sdbusplus/server.hpp>
4  #include <xyz/openbmc_project/Control/FanPwm/server.hpp>
5  #include <xyz/openbmc_project/Control/FanSpeed/server.hpp>
6  #include <xyz/openbmc_project/Sensor/Threshold/Critical/server.hpp>
7  #include <xyz/openbmc_project/Sensor/Threshold/Warning/server.hpp>
8  #include <xyz/openbmc_project/Sensor/Value/server.hpp>
9  #include <xyz/openbmc_project/State/Decorator/OperationalStatus/server.hpp>
10  
11  template <typename... T>
12  using ServerObject = typename sdbusplus::server::object::object<T...>;
13  
14  using ValueInterface = sdbusplus::xyz::openbmc_project::Sensor::server::Value;
15  using ValueObject = ServerObject<ValueInterface>;
16  using WarningInterface =
17      sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Warning;
18  using WarningObject = ServerObject<WarningInterface>;
19  using CriticalInterface =
20      sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Critical;
21  using CriticalObject = ServerObject<CriticalInterface>;
22  using FanSpeedInterface =
23      sdbusplus::xyz::openbmc_project::Control::server::FanSpeed;
24  using FanSpeedObject = ServerObject<FanSpeedInterface>;
25  using FanPwmInterface =
26      sdbusplus::xyz::openbmc_project::Control::server::FanPwm;
27  using FanPwmObject = ServerObject<FanPwmInterface>;
28  using StatusInterface = sdbusplus::xyz::openbmc_project::State::Decorator::
29      server::OperationalStatus;
30  using StatusObject = ServerObject<StatusInterface>;
31  
32  // I understand this seems like magic, but since decltype doesn't evaluate you
33  // can call nullptr https://stackoverflow.com/a/5580411/2784885
34  using SensorValueType =
35      decltype((static_cast<ValueInterface*>(nullptr))->value());
36  
37  enum class InterfaceType
38  {
39      VALUE,
40      WARN,
41      CRIT,
42      FAN_SPEED,
43      FAN_PWM,
44      STATUS,
45  };
46  
47  // vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
48