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