Matthew Barth | 048ac87 | 2017-03-09 14:36:08 -0600 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include "interface.hpp" |
| 4 | |
| 5 | namespace hwmon |
| 6 | { |
| 7 | |
| 8 | /** |
| 9 | * @class FanSpeed |
| 10 | * @brief Target fan speed control implementation |
| 11 | * @details Derived FanSpeedObject type that writes the target value to sysfs |
| 12 | * which in turn sets the fan speed to that target value |
| 13 | */ |
| 14 | class FanSpeed : public FanSpeedObject |
| 15 | { |
| 16 | public: |
| 17 | |
| 18 | /** |
| 19 | * @brief Constructs FanSpeed Object |
| 20 | * |
| 21 | * @param[in] sysfsRoot - The hwmon class root |
| 22 | * @param[in] instance - The hwmon instance (ex. hwmon1) |
| 23 | * @param[in] id - The hwmon id |
| 24 | * @param[in] bus - Dbus bus object |
| 25 | * @param[in] objPath - Dbus object path |
| 26 | * @param[in] defer - Dbus object registration defer |
| 27 | */ |
| 28 | FanSpeed(const std::string& sysfsRoot, |
| 29 | const std::string& instance, |
| 30 | const std::string& id, |
| 31 | sdbusplus::bus::bus& bus, |
| 32 | const char* objPath, |
| 33 | bool defer) : FanSpeedObject(bus, objPath, defer), |
| 34 | sysfsRoot(sysfsRoot), |
| 35 | instance(instance), |
| 36 | id(id) |
| 37 | { |
| 38 | // Nothing to do here |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @brief Set the value of target |
| 43 | * |
| 44 | * @return Value of target |
| 45 | */ |
| 46 | uint64_t target(uint64_t value) override; |
| 47 | |
| 48 | private: |
| 49 | /** @brief hwmon class root */ |
| 50 | std::string sysfsRoot; |
| 51 | /** @brief hwmon instance */ |
| 52 | std::string instance; |
| 53 | /** @brief hwmon type */ |
| 54 | static constexpr auto type = "fan"; |
| 55 | /** @brief hwmon id */ |
| 56 | std::string id; |
| 57 | }; |
| 58 | |
| 59 | } // namespace hwmon |