Remove use of sdbusplus::object::object
Cannot use this interface wrapper with property import
constructors at the moment, so just use the interface
classes directly.
Emit interfaces added/removed signals manually.
Change-Id: I688e1b774756d48beac7511dda0387b627e57c1f
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/manager.cpp b/manager.cpp
index bb94c21..7d0e7d3 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -179,10 +179,14 @@
void Manager::destroyObjects(
const std::vector<const char*>& paths)
{
+ std::string p;
+
for (const auto& path : paths)
{
- std::string p{path};
- _refs.erase(_root + p);
+ p.assign(_root);
+ p.append(path);
+ _bus.emit_object_removed(p.c_str());
+ _refs.erase(p);
}
}
@@ -211,13 +215,9 @@
// a container.
InterfaceComposite ref;
- auto i = ifaces.size();
for (auto& iface : ifaces)
{
auto& props = iface.second;
-
- // Defer sending any signals until the last interface.
- auto deferSignals = --i != 0;
auto pMakers = _makers.find(iface.first.c_str());
if (pMakers == _makers.end())
@@ -233,8 +233,7 @@
maker(
_bus,
absPath.c_str(),
- props,
- deferSignals));
+ props));
}
if (!ref.empty())
@@ -244,6 +243,7 @@
// to it if needed.
_refs.emplace(
absPath, std::move(ref));
+ _bus.emit_object_added(absPath.c_str());
}
}
}
diff --git a/manager.hpp b/manager.hpp
index 8b59c1b..c1137a4 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -20,7 +20,7 @@
{
template <typename T>
-using ServerObject = typename sdbusplus::server::object::object<T>;
+using ServerObject = T;
using ManagerIface =
sdbusplus::xyz::openbmc_project::Inventory::server::Manager;
@@ -39,8 +39,7 @@
static std::unique_ptr<details::holder::Base> make(
sdbusplus::bus::bus& bus,
const char* path,
- const Interface& props,
- bool deferSignals)
+ const Interface& props)
{
// TODO: pass props to import constructor...
using HolderType = holder::Holder<std::unique_ptr<T>>;
@@ -48,8 +47,7 @@
std::forward<std::unique_ptr<T>>(
std::make_unique<T>(
std::forward<decltype(bus)>(bus),
- std::forward<decltype(path)>(path),
- std::forward<decltype(deferSignals)>(deferSignals))));
+ std::forward<decltype(path)>(path))));
}
};
} // namespace details