Set properties when constructing interfaces.
Make use of new sdbusplus support for passing a map
of properties and their values to the interface
constructor.
Change-Id: Ib0dd406fd80c89acb723e3a376af26ba57b53d27
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/manager.hpp b/manager.hpp
index 5e0930b..806a9a4 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -39,8 +39,20 @@
const char* path,
const Interface& props)
{
- // TODO: pass props to import constructor...
- return any_ns::any(std::make_shared<T>(bus, path));
+ using PropertiesVariant = typename T::PropertiesVariant;
+ using InterfaceVariant =
+ std::map<std::string, PropertiesVariant>;
+
+ InterfaceVariant v;
+
+ for (const auto& p : props)
+ {
+ v.emplace(
+ p.first,
+ convertVariant<PropertiesVariant>(p.second));
+ }
+
+ return any_ns::any(std::make_shared<T>(bus, path, v));
}
};