blob: 63970cad681c3e91009fed70b3b97a174f060eec [file] [log] [blame]
James Feist6714a252018-09-10 15:26:18 -07001#pragma once
2
Andrew Jefferye73bd0a2023-01-25 10:39:57 +10303#include "sensor.hpp"
4
James Feist6714a252018-09-10 15:26:18 -07005#include <sdbusplus/asio/object_server.hpp>
James Feist38fb5982020-05-28 10:09:54 -07006
7#include <memory>
Patrick Venturefd6ba732019-10-31 14:27:39 -07008#include <string>
James Feist6714a252018-09-10 15:26:18 -07009
10class PwmSensor
11{
12 public:
Delphine CC Chiub0dff222023-09-28 10:19:00 +080013 PwmSensor(const std::string& pwmname, const std::string& sysPath,
AppaRao Pulid9d8caf2020-02-27 20:56:59 +053014 std::shared_ptr<sdbusplus::asio::connection>& conn,
James Feist82bac4c2019-03-11 11:16:53 -070015 sdbusplus::asio::object_server& objectServer,
AppaRao Pulid9d8caf2020-02-27 20:56:59 +053016 const std::string& sensorConfiguration,
Jie Yang3291b9c2021-07-29 14:46:51 -070017 const std::string& sensorType, bool isValueMutable = false);
James Feist6714a252018-09-10 15:26:18 -070018 ~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;
James Feist82bac4c2019-03-11 11:16:53 -070026 std::shared_ptr<sdbusplus::asio::dbus_interface> association;
Jie Yang3291b9c2021-07-29 14:46:51 -070027 std::shared_ptr<sdbusplus::asio::dbus_interface> valueMutabilityInterface;
Josh Lehan6e6ac0f2020-12-30 22:32:57 -080028 double pwmMax;
James Feist6714a252018-09-10 15:26:18 -070029 void setValue(uint32_t value);
30 uint32_t getValue(bool errThrow = true);
Jae Hyun Yoo9ced0a32018-10-25 10:42:39 -070031};