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/HwmonTempSensor.hpp b/src/HwmonTempSensor.hpp
new file mode 100644
index 0000000..27ffccd
--- /dev/null
+++ b/src/HwmonTempSensor.hpp
@@ -0,0 +1,65 @@
+#pragma once
+
+#include "DeviceMgmt.hpp"
+#include "Thresholds.hpp"
+#include "sensor.hpp"
+
+#include <boost/asio/random_access_file.hpp>
+#include <sdbusplus/asio/object_server.hpp>
+
+#include <string>
+#include <vector>
+
+struct SensorParams
+{
+    double minValue;
+    double maxValue;
+    double offsetValue;
+    double scaleValue;
+    std::string units;
+    std::string typeName;
+};
+
+class HwmonTempSensor :
+    public Sensor,
+    public std::enable_shared_from_this<HwmonTempSensor>
+{
+  public:
+    HwmonTempSensor(const std::string& path, const std::string& objectType,
+                    sdbusplus::asio::object_server& objectServer,
+                    std::shared_ptr<sdbusplus::asio::connection>& conn,
+                    boost::asio::io_service& io, const std::string& sensorName,
+                    std::vector<thresholds::Threshold>&& thresholds,
+                    const struct SensorParams& thisSensorParameters,
+                    float pollRate, const std::string& sensorConfiguration,
+                    PowerState powerState,
+                    const std::shared_ptr<I2CDevice>& i2cDevice);
+    ~HwmonTempSensor() override;
+    void setupRead(void);
+    void activate(const std::string& newPath,
+                  const std::shared_ptr<I2CDevice>& newI2CDevice);
+    void deactivate(void);
+    bool isActive(void);
+
+    std::shared_ptr<I2CDevice> getI2CDevice() const
+    {
+        return i2cDevice;
+    }
+
+  private:
+    // Ordering is important here; readBuf is first so that it's not destroyed
+    // while async operations from other member fields might still be using it.
+    std::array<char, 128> readBuf{};
+    std::shared_ptr<I2CDevice> i2cDevice;
+    sdbusplus::asio::object_server& objServer;
+    boost::asio::random_access_file inputDev;
+    boost::asio::steady_timer waitTimer;
+    std::string path;
+    double offsetValue;
+    double scaleValue;
+    unsigned int sensorPollMs;
+
+    void handleResponse(const boost::system::error_code& err, size_t bytesRead);
+    void restartRead();
+    void checkThresholds(void) override;
+};