xref: /openbmc/dbus-sensors/src/PwmSensor.hpp (revision b0dff227)
1 #pragma once
2 
3 #include "sensor.hpp"
4 
5 #include <sdbusplus/asio/object_server.hpp>
6 
7 #include <memory>
8 #include <string>
9 
10 class PwmSensor
11 {
12   public:
13     PwmSensor(const std::string& pwmname, const std::string& sysPath,
14               std::shared_ptr<sdbusplus::asio::connection>& conn,
15               sdbusplus::asio::object_server& objectServer,
16               const std::string& sensorConfiguration,
17               const std::string& sensorType, bool isValueMutable = false);
18     ~PwmSensor();
19 
20   private:
21     std::string sysPath;
22     sdbusplus::asio::object_server& objectServer;
23     std::string name;
24     std::shared_ptr<sdbusplus::asio::dbus_interface> sensorInterface;
25     std::shared_ptr<sdbusplus::asio::dbus_interface> controlInterface;
26     std::shared_ptr<sdbusplus::asio::dbus_interface> association;
27     std::shared_ptr<sdbusplus::asio::dbus_interface> valueMutabilityInterface;
28     double pwmMax;
29     void setValue(uint32_t value);
30     uint32_t getValue(bool errThrow = true);
31 };
32