blob: c7c2c90611d1c03c2e30e659431008da4d24341a [file] [log] [blame]
Patrick Ventureaadb30d2020-08-10 09:17:11 -07001#pragma once
2
3#include <sdbusplus/bus.hpp>
4
5#include <cstdint>
6#include <string>
7
8namespace pid_control
9{
10
11struct SensorProperties
12{
13 int64_t scale;
14 double value;
15 double min;
16 double max;
17 std::string unit;
18};
19
20class DbusHelperInterface
21{
22 public:
23 virtual ~DbusHelperInterface() = default;
24
25 /** @brief Get the service providing the interface for the path.
26 *
27 * @warning Throws exception on dbus failure.
28 */
29 virtual std::string getService(sdbusplus::bus::bus& bus,
30 const std::string& intf,
31 const std::string& path) = 0;
32
33 /** @brief Get all Sensor.Value properties for a service and path.
34 *
35 * @param[in] bus - A bus to use for the call.
36 * @param[in] service - The service providing the interface.
37 * @param[in] path - The dbus path.
38 * @param[out] prop - A pointer to a properties struct to fill out.
39 *
40 * @warning Throws exception on dbus failure.
41 */
42 virtual void getProperties(sdbusplus::bus::bus& bus,
43 const std::string& service,
44 const std::string& path,
45 struct SensorProperties* prop) = 0;
46
47 /** @brief Get Critical Threshold current assert status
48 *
49 * @param[in] bus - A bus to use for the call.
50 * @param[in] service - The service providing the interface.
51 * @param[in] path - The dbus path.
52 */
53 virtual bool thresholdsAsserted(sdbusplus::bus::bus& bus,
54 const std::string& service,
55 const std::string& path) = 0;
56};
57
58} // namespace pid_control