sensors: Align source structure away from anti-patterns
The anti-patterns document comments on source structure, specifically
on placing internal headers in a parallel subtree[1]. dbus-sensors is an
example of violating this anti-pattern, so fix it.
[1]: https://github.com/openbmc/docs/blob/master/anti-patterns.md#placing-internal-headers-in-a-parallel-subtree
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I50ecaddd53fa9c9b7a0441af9de5e60bd94e47c6
diff --git a/src/PwmSensor.hpp b/src/PwmSensor.hpp
new file mode 100644
index 0000000..f70079b
--- /dev/null
+++ b/src/PwmSensor.hpp
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "sensor.hpp"
+
+#include <sdbusplus/asio/object_server.hpp>
+
+#include <memory>
+#include <string>
+
+class PwmSensor
+{
+ public:
+ PwmSensor(const std::string& name, const std::string& sysPath,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ sdbusplus::asio::object_server& objectServer,
+ const std::string& sensorConfiguration,
+ const std::string& sensorType, bool isValueMutable = false);
+ ~PwmSensor();
+
+ private:
+ std::string sysPath;
+ sdbusplus::asio::object_server& objectServer;
+ std::string name;
+ std::shared_ptr<sdbusplus::asio::dbus_interface> sensorInterface;
+ std::shared_ptr<sdbusplus::asio::dbus_interface> controlInterface;
+ std::shared_ptr<sdbusplus::asio::dbus_interface> association;
+ std::shared_ptr<sdbusplus::asio::dbus_interface> valueMutabilityInterface;
+ double pwmMax;
+ void setValue(uint32_t value);
+ uint32_t getValue(bool errThrow = true);
+};