associations: explicitly pass deferSignal
Explicitly pass the deferSignal parameter to the dbus bindings to enable
creating associations 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 (createAssociations).
Change-Id: I6d55237d43c994442d10b899e725ea36c46dc834
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/association_manager.cpp b/association_manager.cpp
index 946bd74..91956ba 100644
--- a/association_manager.cpp
+++ b/association_manager.cpp
@@ -79,7 +79,8 @@
}
}
-void Manager::createAssociations(const std::string& objectPath)
+void Manager::createAssociations(const std::string& objectPath,
+ bool deferSignal)
{
auto endpoints = _associations.find(objectPath);
if (endpoints == _associations.end())
@@ -106,7 +107,7 @@
const auto& reverseType = std::get<reverseTypePos>(types);
createAssociation(objectPath, forwardType, endpointPath,
- reverseType);
+ reverseType, deferSignal);
}
}
}
@@ -114,7 +115,8 @@
void Manager::createAssociation(const std::string& forwardPath,
const std::string& forwardType,
const std::string& reversePath,
- const std::string& reverseType)
+ const std::string& reverseType,
+ bool deferSignal)
{
auto object = _associationIfaces.find(forwardPath);
if (object == _associationIfaces.end())
@@ -128,7 +130,10 @@
prop.emplace_back(forwardType, reverseType, reversePath);
a->associations(std::move(prop));
- a->emit_object_added();
+ if (!deferSignal)
+ {
+ a->emit_object_added();
+ }
_associationIfaces.emplace(forwardPath, std::move(a));
}
else
@@ -136,7 +141,7 @@
// Interface exists, just update the property
auto prop = object->second->associations();
prop.emplace_back(forwardType, reverseType, reversePath);
- object->second->associations(std::move(prop));
+ object->second->associations(std::move(prop), deferSignal);
}
}
} // namespace associations