blob: 2c8ebe6e084f5e8e71f2848999149b4ce18dd1ad [file] [log] [blame]
James Feist6714a252018-09-10 15:26:18 -07001#pragma once
2
3#include <sdbusplus/asio/object_server.hpp>
Zev Weiss6b6891c2021-04-22 02:46:21 -05004#include <sensor.hpp>
James Feist38fb5982020-05-28 10:09:54 -07005
6#include <memory>
Patrick Venturefd6ba732019-10-31 14:27:39 -07007#include <string>
James Feist6714a252018-09-10 15:26:18 -07008
9class PwmSensor
10{
11 public:
Cheng C Yang916360b2019-05-07 18:47:16 +080012 PwmSensor(const std::string& name, const std::string& sysPath,
AppaRao Pulid9d8caf2020-02-27 20:56:59 +053013 std::shared_ptr<sdbusplus::asio::connection>& conn,
James Feist82bac4c2019-03-11 11:16:53 -070014 sdbusplus::asio::object_server& objectServer,
AppaRao Pulid9d8caf2020-02-27 20:56:59 +053015 const std::string& sensorConfiguration,
Jie Yang3291b9c2021-07-29 14:46:51 -070016 const std::string& sensorType, bool isValueMutable = false);
James Feist6714a252018-09-10 15:26:18 -070017 ~PwmSensor();
18
19 private:
20 std::string sysPath;
21 sdbusplus::asio::object_server& objectServer;
22 std::string name;
23 std::shared_ptr<sdbusplus::asio::dbus_interface> sensorInterface;
24 std::shared_ptr<sdbusplus::asio::dbus_interface> controlInterface;
James Feist82bac4c2019-03-11 11:16:53 -070025 std::shared_ptr<sdbusplus::asio::dbus_interface> association;
Jie Yang3291b9c2021-07-29 14:46:51 -070026 std::shared_ptr<sdbusplus::asio::dbus_interface> valueMutabilityInterface;
Josh Lehan6e6ac0f2020-12-30 22:32:57 -080027 double pwmMax;
James Feist6714a252018-09-10 15:26:18 -070028 void setValue(uint32_t value);
29 uint32_t getValue(bool errThrow = true);
Jae Hyun Yoo9ced0a32018-10-25 10:42:39 -070030};