James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Andrew Jeffery | e73bd0a | 2023-01-25 10:39:57 +1030 | [diff] [blame] | 3 | #include "sensor.hpp" |
| 4 | |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 5 | #include <sdbusplus/asio/object_server.hpp> |
James Feist | 38fb598 | 2020-05-28 10:09:54 -0700 | [diff] [blame] | 6 | |
| 7 | #include <memory> |
Patrick Venture | fd6ba73 | 2019-10-31 14:27:39 -0700 | [diff] [blame] | 8 | #include <string> |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 9 | |
| 10 | class PwmSensor |
| 11 | { |
| 12 | public: |
Delphine CC Chiu | b0dff22 | 2023-09-28 10:19:00 +0800 | [diff] [blame] | 13 | PwmSensor(const std::string& pwmname, const std::string& sysPath, |
AppaRao Puli | d9d8caf | 2020-02-27 20:56:59 +0530 | [diff] [blame] | 14 | std::shared_ptr<sdbusplus::asio::connection>& conn, |
James Feist | 82bac4c | 2019-03-11 11:16:53 -0700 | [diff] [blame] | 15 | sdbusplus::asio::object_server& objectServer, |
AppaRao Puli | d9d8caf | 2020-02-27 20:56:59 +0530 | [diff] [blame] | 16 | const std::string& sensorConfiguration, |
Jie Yang | 3291b9c | 2021-07-29 14:46:51 -0700 | [diff] [blame] | 17 | const std::string& sensorType, bool isValueMutable = false); |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 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; |
James Feist | 82bac4c | 2019-03-11 11:16:53 -0700 | [diff] [blame] | 26 | std::shared_ptr<sdbusplus::asio::dbus_interface> association; |
Jie Yang | 3291b9c | 2021-07-29 14:46:51 -0700 | [diff] [blame] | 27 | std::shared_ptr<sdbusplus::asio::dbus_interface> valueMutabilityInterface; |
Josh Lehan | 6e6ac0f | 2020-12-30 22:32:57 -0800 | [diff] [blame] | 28 | double pwmMax; |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 29 | void setValue(uint32_t value); |
| 30 | uint32_t getValue(bool errThrow = true); |
Jae Hyun Yoo | 9ced0a3 | 2018-10-25 10:42:39 -0700 | [diff] [blame] | 31 | }; |