Patrick Venture | aadb30d | 2020-08-10 09:17:11 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | aadb30d | 2020-08-10 09:17:11 -0700 | [diff] [blame] | 3 | #include <cstdint> |
| 4 | #include <string> |
| 5 | |
| 6 | namespace pid_control |
| 7 | { |
| 8 | |
| 9 | struct SensorProperties |
| 10 | { |
| 11 | int64_t scale; |
| 12 | double value; |
| 13 | double min; |
| 14 | double max; |
| 15 | std::string unit; |
| 16 | }; |
| 17 | |
| 18 | class 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 Venture | 9b93692 | 2020-08-10 11:28:39 -0700 | [diff] [blame] | 27 | virtual std::string getService(const std::string& intf, |
Patrick Venture | aadb30d | 2020-08-10 09:17:11 -0700 | [diff] [blame] | 28 | 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 Venture | 9b93692 | 2020-08-10 11:28:39 -0700 | [diff] [blame] | 39 | virtual void getProperties(const std::string& service, |
Patrick Venture | aadb30d | 2020-08-10 09:17:11 -0700 | [diff] [blame] | 40 | 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 Venture | 9b93692 | 2020-08-10 11:28:39 -0700 | [diff] [blame] | 49 | virtual bool thresholdsAsserted(const std::string& service, |
Patrick Venture | aadb30d | 2020-08-10 09:17:11 -0700 | [diff] [blame] | 50 | const std::string& path) = 0; |
| 51 | }; |
| 52 | |
| 53 | } // namespace pid_control |