1 #pragma once 2 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 bool available; 17 bool unavailableAsFailed; 18 }; 19 20 class 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(const std::string& intf, 30 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. 37 * @param[out] prop - A pointer to a properties to fill out. 38 * 39 * @warning Throws exception on dbus failure. 40 */ 41 virtual void getProperties(const std::string& service, 42 const std::string& path, 43 SensorProperties* prop) = 0; 44 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 */ 51 virtual bool thresholdsAsserted(const std::string& service, 52 const std::string& path) = 0; 53 }; 54 55 } // namespace pid_control 56