1 #pragma once 2 3 #include "types.hpp" 4 #include "sensorset.hpp" 5 #include "hwmonio.hpp" 6 7 namespace sensor 8 { 9 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 30 */ 31 explicit Sensor(const SensorSet::key_type& sensor); 32 33 private: 34 /** @brief Sensor object's identifiers */ 35 SensorSet::key_type sensor; 36 }; 37 38 /** 39 * @brief Add status interface and functional property for sensor 40 * @details When a sensor has an associated fault file, the OperationalStatus 41 * interface is added along with setting the Functional property to the 42 * corresponding value found in the fault file. 43 * 44 * @param[in] sensor - Sensor identification data 45 * @param[in] ioAccess - I/O access to sysfs 46 * @param[in] devPath - Device path 47 * @param[in] info - Sensor object information 48 * 49 * @return - Shared pointer to the status object 50 */ 51 std::shared_ptr<StatusObject> addStatus( 52 const SensorSet::key_type& sensor, 53 const hwmonio::HwmonIO& ioAccess, 54 const std::string& devPath, 55 ObjectInfo& info); 56 57 } // namespace sensor 58