blob: 6d7e506cc0cd8420300d318fbac17d261e94a5fb [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;
Alex.Song8f73ad72021-10-07 00:18:27 +080016 bool available;
17 bool unavailableAsFailed;
Patrick Ventureaadb30d2020-08-10 09:17:11 -070018};
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 */
Patrick Venture9b936922020-08-10 11:28:39 -070029 virtual std::string getService(const std::string& intf,
Patrick Ventureaadb30d2020-08-10 09:17:11 -070030 const std::string& path) = 0;
31
32 /** @brief Get all Sensor.Value properties for a service and path.
33 *
34 * @param[in] bus - A bus to use for the call.
35 * @param[in] service - The service providing the interface.
36 * @param[in] path - The dbus path.
Patrick Venture1df9e872020-10-08 15:35:01 -070037 * @param[out] prop - A pointer to a properties to fill out.
Patrick Ventureaadb30d2020-08-10 09:17:11 -070038 *
39 * @warning Throws exception on dbus failure.
40 */
Patrick Venture9b936922020-08-10 11:28:39 -070041 virtual void getProperties(const std::string& service,
Patrick Ventureaadb30d2020-08-10 09:17:11 -070042 const std::string& path,
Patrick Venture1df9e872020-10-08 15:35:01 -070043 SensorProperties* prop) = 0;
Patrick Ventureaadb30d2020-08-10 09:17:11 -070044
45 /** @brief Get Critical Threshold current assert status
46 *
47 * @param[in] bus - A bus to use for the call.
48 * @param[in] service - The service providing the interface.
49 * @param[in] path - The dbus path.
50 */
Patrick Venture9b936922020-08-10 11:28:39 -070051 virtual bool thresholdsAsserted(const std::string& service,
Patrick Ventureaadb30d2020-08-10 09:17:11 -070052 const std::string& path) = 0;
53};
54
55} // namespace pid_control