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