blob: c206e70151c44b55a9aab694771b002896c6f23a [file] [log] [blame]
Matthew Barth293477d2017-02-17 15:39:36 -06001#pragma once
2
3
4namespace phosphor
5{
6namespace fan
7{
8namespace presence
9{
10
Matthew Barth5c15b792017-03-01 11:17:00 -060011// Forward declare FanEnclosure
Matthew Barth293477d2017-02-17 15:39:36 -060012class FanEnclosure;
Matthew Barth5c15b792017-03-01 11:17:00 -060013/**
14 * @class Sensor
15 * @brief Base sensor implementation to be extended
16 * @details A type of presence detection sensor would extend this to override
17 * how presences is determined by the fan enclosure containing that type
18 */
Matthew Barth293477d2017-02-17 15:39:36 -060019class Sensor
20{
21 public:
22 Sensor() = delete;
23 Sensor(const Sensor&) = delete;
24 Sensor(Sensor&&) = delete;
25 Sensor& operator=(const Sensor&) = delete;
26 Sensor& operator=(Sensor&&) = delete;
27 virtual ~Sensor() = default;
28
Matthew Barth5c15b792017-03-01 11:17:00 -060029 /**
30 * @brief Constructs Sensor Object
31 *
32 * @param[in] id - ID name of this sensor
33 * @param[in] fanEnc - Reference to the fan enclosure with this sensor
34 */
Matthew Barthd6403822017-02-17 17:10:19 -060035 Sensor(const std::string& id,
36 FanEnclosure& fanEnc) :
37 id(id),
38 fanEnc(fanEnc)
39 {
40 //Nothing to do here
41 }
42
Matthew Barth5c15b792017-03-01 11:17:00 -060043 /**
44 * @brief Presence function that must be implemented within the derived
45 * type of sensor's implementation on how presence is determined
46 */
Matthew Barth293477d2017-02-17 15:39:36 -060047 virtual bool isPresent() = 0;
48
49 protected:
Matthew Barth5c15b792017-03-01 11:17:00 -060050 /** @brief ID name of this sensor */
Matthew Barthd6403822017-02-17 17:10:19 -060051 const std::string id;
Matthew Barth5c15b792017-03-01 11:17:00 -060052 /** @brief Reference to the fan enclosure containing this sensor */
Matthew Barthd6403822017-02-17 17:10:19 -060053 FanEnclosure& fanEnc;
Matthew Barth293477d2017-02-17 15:39:36 -060054
55};
56
57} // namespace presence
58} // namespace fan
59} // namespace phosphor