manager: explicitly pass deferSignal
Explicitly pass the deferSignal parameter to the dbus bindings to enable
creating objects without emitting signals.
The patch does not introduce any functional change - only future
capability; the dbus binding argument is defaulted to emit a signal
(deferSignal = false) and that logic is preserved - moved from the
binding call site to higher up the call stack (updateInterfaces).
A careful observer may notice this patch highlights that interfaces are
constructed with the map-of-properties constructor with signals enabled.
This is arguably a bug in the bindings - it would never make sense to
construct an interface in this fashion and send PropertiesChanged
signals while the interface is in the process of being constructed.
This patch retains the current broken behavior, with a fix to be
provided in a later patch.
Change-Id: I0d9ef93651595b751e96cae07d9f1095770c05a6
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/interface_ops.hpp b/interface_ops.hpp
index 96a2422..b16fa57 100644
--- a/interface_ops.hpp
+++ b/interface_ops.hpp
@@ -48,7 +48,7 @@
struct MakeInterface
{
static std::any op(sdbusplus::bus::bus& bus, const char* path,
- const Interface&)
+ const Interface&, bool)
{
return std::any(std::make_shared<T>(bus, path));
}
@@ -58,7 +58,7 @@
struct MakeInterface<T, std::enable_if_t<HasProperties<T>::value>>
{
static std::any op(sdbusplus::bus::bus& bus, const char* path,
- const Interface& props)
+ const Interface& props, bool deferSignal)
{
using InterfaceVariant =
std::map<std::string, typename T::PropertiesVariant>;
@@ -70,28 +70,29 @@
convertVariant<typename T::PropertiesVariant>(p.second));
}
- return std::any(std::make_shared<T>(bus, path, v));
+ return std::any(std::make_shared<T>(bus, path, v, deferSignal));
}
};
template <typename T, typename Enable = void>
struct AssignInterface
{
- static void op(const Interface&, std::any&)
+ static void op(const Interface&, std::any&, bool)
{}
};
template <typename T>
struct AssignInterface<T, std::enable_if_t<HasProperties<T>::value>>
{
- static void op(const Interface& props, std::any& holder)
+ static void op(const Interface& props, std::any& holder, bool deferSignal)
{
auto& iface = *std::any_cast<std::shared_ptr<T>&>(holder);
for (const auto& p : props)
{
iface.setPropertyByName(
p.first,
- convertVariant<typename T::PropertiesVariant>(p.second));
+ convertVariant<typename T::PropertiesVariant>(p.second),
+ deferSignal);
}
}
};