blob: 4b157dc119fbcb8116fb79fa314cf6db3f8b55f8 [file] [log] [blame]
Brad Bishop8e068d92016-12-23 23:41:22 -05001#pragma once
2
Brad Bishop8e068d92016-12-23 23:41:22 -05003#include <sdbusplus/server.hpp>
Patrick Venture043d3232018-08-31 10:10:53 -07004#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>
Brad Bishop8e068d92016-12-23 23:41:22 -050010
Brad Bishopd9f06ab2017-01-17 14:53:30 -050011template <typename... T>
12using ServerObject = typename sdbusplus::server::object::object<T...>;
Brad Bishop8e068d92016-12-23 23:41:22 -050013
14using ValueInterface = sdbusplus::xyz::openbmc_project::Sensor::server::Value;
15using ValueObject = ServerObject<ValueInterface>;
Brad Bishopcad57db2017-01-06 14:55:16 -050016using WarningInterface =
17 sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Warning;
18using WarningObject = ServerObject<WarningInterface>;
19using CriticalInterface =
20 sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Critical;
21using CriticalObject = ServerObject<CriticalInterface>;
Matthew Barthbf7b7b12017-03-07 15:46:59 -060022using FanSpeedInterface =
23 sdbusplus::xyz::openbmc_project::Control::server::FanSpeed;
24using FanSpeedObject = ServerObject<FanSpeedInterface>;
Patrick Venture9331ab72018-01-29 09:48:47 -080025using FanPwmInterface =
26 sdbusplus::xyz::openbmc_project::Control::server::FanPwm;
27using FanPwmObject = ServerObject<FanPwmInterface>;
Patrick Venture043d3232018-08-31 10:10:53 -070028using StatusInterface = sdbusplus::xyz::openbmc_project::State::Decorator::
29 server::OperationalStatus;
Matthew Barth35819382018-04-18 14:53:01 -050030using StatusObject = ServerObject<StatusInterface>;
Brad Bishop8e068d92016-12-23 23:41:22 -050031
James Feistee73f5b2018-08-01 16:31:42 -070032// I understand this seems like magic, but since decltype doesn't evaluate you
33// can call nullptr https://stackoverflow.com/a/5580411/2784885
34using SensorValueType =
35 decltype((static_cast<ValueInterface*>(nullptr))->value());
36
Brad Bishop075f7a22017-01-06 09:45:08 -050037enum class InterfaceType
38{
39 VALUE,
Brad Bishopcad57db2017-01-06 14:55:16 -050040 WARN,
41 CRIT,
Matthew Barthbf7b7b12017-03-07 15:46:59 -060042 FAN_SPEED,
Patrick Venture9331ab72018-01-29 09:48:47 -080043 FAN_PWM,
Matthew Barth35819382018-04-18 14:53:01 -050044 STATUS,
Brad Bishop075f7a22017-01-06 09:45:08 -050045};
46
Brad Bishop8e068d92016-12-23 23:41:22 -050047// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4