Matthew Barth | 293477d | 2017-02-17 15:39:36 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | |
| 4 | namespace phosphor |
| 5 | { |
| 6 | namespace fan |
| 7 | { |
| 8 | namespace presence |
| 9 | { |
| 10 | |
Matthew Barth | 5c15b79 | 2017-03-01 11:17:00 -0600 | [diff] [blame] | 11 | // Forward declare FanEnclosure |
Matthew Barth | 293477d | 2017-02-17 15:39:36 -0600 | [diff] [blame] | 12 | class FanEnclosure; |
Matthew Barth | 5c15b79 | 2017-03-01 11:17:00 -0600 | [diff] [blame] | 13 | /** |
| 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 Barth | 293477d | 2017-02-17 15:39:36 -0600 | [diff] [blame] | 19 | class 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 Barth | 5c15b79 | 2017-03-01 11:17:00 -0600 | [diff] [blame] | 29 | /** |
| 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 Barth | d640382 | 2017-02-17 17:10:19 -0600 | [diff] [blame] | 35 | Sensor(const std::string& id, |
| 36 | FanEnclosure& fanEnc) : |
| 37 | id(id), |
| 38 | fanEnc(fanEnc) |
| 39 | { |
| 40 | //Nothing to do here |
| 41 | } |
| 42 | |
Matthew Barth | 5c15b79 | 2017-03-01 11:17:00 -0600 | [diff] [blame] | 43 | /** |
| 44 | * @brief Presence function that must be implemented within the derived |
| 45 | * type of sensor's implementation on how presence is determined |
| 46 | */ |
Matthew Barth | 293477d | 2017-02-17 15:39:36 -0600 | [diff] [blame] | 47 | virtual bool isPresent() = 0; |
| 48 | |
| 49 | protected: |
Matthew Barth | 5c15b79 | 2017-03-01 11:17:00 -0600 | [diff] [blame] | 50 | /** @brief ID name of this sensor */ |
Matthew Barth | d640382 | 2017-02-17 17:10:19 -0600 | [diff] [blame] | 51 | const std::string id; |
Matthew Barth | 5c15b79 | 2017-03-01 11:17:00 -0600 | [diff] [blame] | 52 | /** @brief Reference to the fan enclosure containing this sensor */ |
Matthew Barth | d640382 | 2017-02-17 17:10:19 -0600 | [diff] [blame] | 53 | FanEnclosure& fanEnc; |
Matthew Barth | 293477d | 2017-02-17 15:39:36 -0600 | [diff] [blame] | 54 | |
| 55 | }; |
| 56 | |
| 57 | } // namespace presence |
| 58 | } // namespace fan |
| 59 | } // namespace phosphor |