blob: 978467b0bd3c3e8a7af7430d203c12bae8259d77 [file] [log] [blame]
Matthew Barth35819382018-04-18 14:53:01 -05001#pragma once
2
Matthew Barth9c431062018-05-07 13:55:29 -05003#include "types.hpp"
Matthew Barth35819382018-04-18 14:53:01 -05004#include "sensorset.hpp"
Matthew Barth9c431062018-05-07 13:55:29 -05005#include "hwmonio.hpp"
Matthew Barth35819382018-04-18 14:53:01 -05006
7namespace sensor
8{
9
Matthew Barth9c431062018-05-07 13:55:29 -050010/** @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 */
16class 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 Barth2e41b132018-05-07 14:15:45 -050030 * @param[in] ioAccess - Hwmon sysfs access
31 * @param[in] devPath - Device sysfs path
Matthew Barth9c431062018-05-07 13:55:29 -050032 */
Matthew Barth2e41b132018-05-07 14:15:45 -050033 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 Barth9c431062018-05-07 13:55:29 -050050
51 private:
52 /** @brief Sensor object's identifiers */
53 SensorSet::key_type sensor;
Matthew Barth9c431062018-05-07 13:55:29 -050054
Matthew Barth2e41b132018-05-07 14:15:45 -050055 /** @brief Hwmon sysfs access. */
56 const hwmonio::HwmonIO& ioAccess;
57
58 /** @brief Physical device sysfs path. */
59 const std::string& devPath;
60};
Matthew Barth35819382018-04-18 14:53:01 -050061
62} // namespace sensor