diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-04-22 14:19:45 -0400 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-04-24 22:53:58 -0400 |
commit | 9df0e16e00338ea267c71a2bf3c314d39e8961be (patch) | |
tree | 56bd9da5f66fe259267001c2dc4b27773c6eeecb /presence/sensor_base.hpp | |
parent | e73446e30576ad6dc734398ad2ca709f2263ad51 (diff) | |
download | phosphor-fan-presence-9df0e16e00338ea267c71a2bf3c314d39e8961be.tar.gz phosphor-fan-presence-9df0e16e00338ea267c71a2bf3c314d39e8961be.zip |
build: Move presence to a subdirectory
Change-Id: I33b28922107b9b041de3699e4a6eebd3d05ebdef
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'presence/sensor_base.hpp')
-rw-r--r-- | presence/sensor_base.hpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/presence/sensor_base.hpp b/presence/sensor_base.hpp new file mode 100644 index 0000000..c206e70 --- /dev/null +++ b/presence/sensor_base.hpp @@ -0,0 +1,59 @@ +#pragma once + + +namespace phosphor +{ +namespace fan +{ +namespace presence +{ + +// Forward declare FanEnclosure +class FanEnclosure; +/** + * @class Sensor + * @brief Base sensor implementation to be extended + * @details A type of presence detection sensor would extend this to override + * how presences is determined by the fan enclosure containing that type + */ +class Sensor +{ + public: + Sensor() = delete; + Sensor(const Sensor&) = delete; + Sensor(Sensor&&) = delete; + Sensor& operator=(const Sensor&) = delete; + Sensor& operator=(Sensor&&) = delete; + virtual ~Sensor() = default; + + /** + * @brief Constructs Sensor Object + * + * @param[in] id - ID name of this sensor + * @param[in] fanEnc - Reference to the fan enclosure with this sensor + */ + Sensor(const std::string& id, + FanEnclosure& fanEnc) : + id(id), + fanEnc(fanEnc) + { + //Nothing to do here + } + + /** + * @brief Presence function that must be implemented within the derived + * type of sensor's implementation on how presence is determined + */ + virtual bool isPresent() = 0; + + protected: + /** @brief ID name of this sensor */ + const std::string id; + /** @brief Reference to the fan enclosure containing this sensor */ + FanEnclosure& fanEnc; + +}; + +} // namespace presence +} // namespace fan +} // namespace phosphor |