Add ability to configure from dbus
This allows configuration of PID control from dbus using
entity manager. Sample configuration will be pushed to
entity-manager repo shortly.
Tested-by: Used yaml configuration and dbus / entity-manager
based configuration and pid seemed to work the same.
Verified printout of configuration matched generated
cpp files.
Change-Id: Ia7b016e53262791ffcccdb9b21c1ccddae2926bc
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/dbus/util.hpp b/dbus/util.hpp
index 44e137c..72cf4e3 100644
--- a/dbus/util.hpp
+++ b/dbus/util.hpp
@@ -59,3 +59,20 @@
std::string GetSensorPath(const std::string& type, const std::string& id);
std::string GetMatch(const std::string& type, const std::string& id);
bool ValidType(const std::string& type);
+
+struct VariantToFloatVisitor
+{
+ template <typename T>
+ std::enable_if_t<std::is_arithmetic<T>::value, float>
+ operator()(const T &t) const
+ {
+ return static_cast<float>(t);
+ }
+
+ template <typename T>
+ std::enable_if_t<!std::is_arithmetic<T>::value, float>
+ operator()(const T &t) const
+ {
+ throw std::invalid_argument("Cannot translate type to float");
+ }
+};