1 #pragma once
2 
3 #include "types.hpp"
4 
5 #include <sdbusplus/bus/match.hpp>
6 
7 #include <bitset>
8 
9 namespace phosphor::power::psu
10 {
11 
12 /**
13  * @class UtilBase
14  * A base class to allow for mocking certain utility functions.
15  */
16 class UtilBase
17 {
18   public:
19     virtual ~UtilBase() = default;
20 
21     virtual bool getPresence(sdbusplus::bus::bus& bus,
22                              const std::string& invpath) const = 0;
23 
24     virtual void setPresence(sdbusplus::bus::bus& bus,
25                              const std::string& invpath, bool present,
26                              const std::string& name) const = 0;
27 };
28 
29 const UtilBase& getUtils();
30 
31 inline bool getPresence(sdbusplus::bus::bus& bus, const std::string& invpath)
32 {
33     return getUtils().getPresence(bus, invpath);
34 }
35 
36 inline void setPresence(sdbusplus::bus::bus& bus, const std::string& invpath,
37                         bool present, const std::string& name)
38 {
39     return getUtils().setPresence(bus, invpath, present, name);
40 }
41 
42 class GPIOInterfaceBase
43 {
44   public:
45     virtual ~GPIOInterfaceBase() = default;
46 
47     virtual int read() = 0;
48     virtual void write(int value, std::bitset<32> flags) = 0;
49     virtual std::string getName() const = 0;
50 };
51 
52 } // namespace phosphor::power::psu
53