Matthew Barth | 3581938 | 2018-04-18 14:53:01 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Matthew Barth | 9c43106 | 2018-05-07 13:55:29 -0500 | [diff] [blame] | 3 | #include "types.hpp" |
Matthew Barth | 3581938 | 2018-04-18 14:53:01 -0500 | [diff] [blame] | 4 | #include "sensorset.hpp" |
Matthew Barth | 9c43106 | 2018-05-07 13:55:29 -0500 | [diff] [blame] | 5 | #include "hwmonio.hpp" |
Matthew Barth | 3581938 | 2018-04-18 14:53:01 -0500 | [diff] [blame] | 6 | |
| 7 | namespace sensor |
| 8 | { |
| 9 | |
Matthew Barth | 9c43106 | 2018-05-07 13:55:29 -0500 | [diff] [blame] | 10 | /** @class Sensor |
| 11 | * @brief Sensor object based on a SensorSet container's key type |
| 12 | * @details Sensor object to create and modify an associated device's sensor |
| 13 | * attributes based on the key type of each sensor in the set provided by the |
| 14 | * device. |
| 15 | */ |
| 16 | class Sensor |
| 17 | { |
| 18 | public: |
| 19 | Sensor() = delete; |
| 20 | Sensor(const Sensor&) = delete; |
| 21 | Sensor(Sensor&&) = default; |
| 22 | Sensor& operator=(const Sensor&) = delete; |
| 23 | Sensor& operator=(Sensor&&) = default; |
| 24 | ~Sensor() = default; |
| 25 | |
| 26 | /** |
| 27 | * @brief Constructs Sensor object |
| 28 | * |
| 29 | * @param[in] sensor - A pair of sensor indentifiers |
Matthew Barth | 2e41b13 | 2018-05-07 14:15:45 -0500 | [diff] [blame^] | 30 | * @param[in] ioAccess - Hwmon sysfs access |
| 31 | * @param[in] devPath - Device sysfs path |
Matthew Barth | 9c43106 | 2018-05-07 13:55:29 -0500 | [diff] [blame] | 32 | */ |
Matthew Barth | 2e41b13 | 2018-05-07 14:15:45 -0500 | [diff] [blame^] | 33 | explicit Sensor(const SensorSet::key_type& sensor, |
| 34 | const hwmonio::HwmonIO& ioAccess, |
| 35 | const std::string& devPath); |
| 36 | |
| 37 | /** |
| 38 | * @brief Add status interface and functional property for sensor |
| 39 | * @details When a sensor has an associated fault file, the |
| 40 | * OperationalStatus interface is added along with setting the |
| 41 | * Functional property to the corresponding value found in the |
| 42 | * fault file. |
| 43 | * |
| 44 | * @param[in] info - Sensor object information |
| 45 | * |
| 46 | * @return - Shared pointer to the status object |
| 47 | */ |
| 48 | std::shared_ptr<StatusObject> addStatus( |
| 49 | ObjectInfo& info); |
Matthew Barth | 9c43106 | 2018-05-07 13:55:29 -0500 | [diff] [blame] | 50 | |
| 51 | private: |
| 52 | /** @brief Sensor object's identifiers */ |
| 53 | SensorSet::key_type sensor; |
Matthew Barth | 9c43106 | 2018-05-07 13:55:29 -0500 | [diff] [blame] | 54 | |
Matthew Barth | 2e41b13 | 2018-05-07 14:15:45 -0500 | [diff] [blame^] | 55 | /** @brief Hwmon sysfs access. */ |
| 56 | const hwmonio::HwmonIO& ioAccess; |
| 57 | |
| 58 | /** @brief Physical device sysfs path. */ |
| 59 | const std::string& devPath; |
| 60 | }; |
Matthew Barth | 3581938 | 2018-04-18 14:53:01 -0500 | [diff] [blame] | 61 | |
| 62 | } // namespace sensor |