xref: /openbmc/phosphor-pid-control/dbus/dbushelper_interface.hpp (revision 1b3b7304d6cd78f44f39a5d54c1dc0ab3e1cf93d)
1aadb30ddSPatrick Venture #pragma once
2aadb30ddSPatrick Venture 
3aadb30ddSPatrick Venture #include <cstdint>
4aadb30ddSPatrick Venture #include <string>
5aadb30ddSPatrick Venture 
6aadb30ddSPatrick Venture namespace pid_control
7aadb30ddSPatrick Venture {
8aadb30ddSPatrick Venture 
9aadb30ddSPatrick Venture struct SensorProperties
10aadb30ddSPatrick Venture {
11*1b3b7304SHarvey Wu     int64_t scale = 0;
12*1b3b7304SHarvey Wu     double value = 0.0;
13*1b3b7304SHarvey Wu     double min = 0.0;
14*1b3b7304SHarvey Wu     double max = 0.0;
15aadb30ddSPatrick Venture     std::string unit;
16*1b3b7304SHarvey Wu     bool available = false;
17*1b3b7304SHarvey Wu     bool unavailableAsFailed = false;
18aadb30ddSPatrick Venture };
19aadb30ddSPatrick Venture 
20aadb30ddSPatrick Venture class DbusHelperInterface
21aadb30ddSPatrick Venture {
22aadb30ddSPatrick Venture   public:
23aadb30ddSPatrick Venture     virtual ~DbusHelperInterface() = default;
24aadb30ddSPatrick Venture 
25aadb30ddSPatrick Venture     /** @brief Get the service providing the interface for the path.
26aadb30ddSPatrick Venture      *
27aadb30ddSPatrick Venture      * @warning Throws exception on dbus failure.
28aadb30ddSPatrick Venture      */
299b93692dSPatrick Venture     virtual std::string getService(const std::string& intf,
30aadb30ddSPatrick Venture                                    const std::string& path) = 0;
31aadb30ddSPatrick Venture 
32aadb30ddSPatrick Venture     /** @brief Get all Sensor.Value properties for a service and path.
33aadb30ddSPatrick Venture      *
34aadb30ddSPatrick Venture      * @param[in] bus - A bus to use for the call.
35aadb30ddSPatrick Venture      * @param[in] service - The service providing the interface.
36aadb30ddSPatrick Venture      * @param[in] path - The dbus path.
371df9e879SPatrick Venture      * @param[out] prop - A pointer to a properties to fill out.
38aadb30ddSPatrick Venture      *
39aadb30ddSPatrick Venture      * @warning Throws exception on dbus failure.
40aadb30ddSPatrick Venture      */
419b93692dSPatrick Venture     virtual void getProperties(const std::string& service,
42aadb30ddSPatrick Venture                                const std::string& path,
431df9e879SPatrick Venture                                SensorProperties* prop) = 0;
44aadb30ddSPatrick Venture 
45aadb30ddSPatrick Venture     /** @brief Get Critical Threshold current assert status
46aadb30ddSPatrick Venture      *
47aadb30ddSPatrick Venture      * @param[in] bus - A bus to use for the call.
48aadb30ddSPatrick Venture      * @param[in] service - The service providing the interface.
49aadb30ddSPatrick Venture      * @param[in] path - The dbus path.
50aadb30ddSPatrick Venture      */
519b93692dSPatrick Venture     virtual bool thresholdsAsserted(const std::string& service,
52aadb30ddSPatrick Venture                                     const std::string& path) = 0;
53aadb30ddSPatrick Venture };
54aadb30ddSPatrick Venture 
55aadb30ddSPatrick Venture } // namespace pid_control
56