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