summaryrefslogtreecommitdiffstats
path: root/presence/sensor_base.hpp
blob: c206e70151c44b55a9aab694771b002896c6f23a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
OpenPOWER on IntegriCloud