entity-manager: attach DBus matches to EM class
Attach nameOwnerChangedMatch, interfacesAddedMatch,
interfacesRemovedMatch to the EntityManager instance.
They are added as unique_ptr to preserve the original control flow and
initialization point.
Since EntityManager instance goes out of scope only at the end of the
main function, their lifetime should be similar to their previous static
lifetime duration, from the perspective of the rest of the code.
Tested: On Tyan S8030
```
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: Supermicro PWS 920P SQ 0
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: Supermicro PWS 920P SQ 1
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: chassis
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: MBX 1.57 Chassis
```
busctl tree output as before
Change-Id: Icc9bad2cc0cd3e9001f38cd94cff87b65b4b6b5d
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/entity_manager.hpp b/src/entity_manager/entity_manager.hpp
index f499320..a6095f0 100644
--- a/src/entity_manager/entity_manager.hpp
+++ b/src/entity_manager/entity_manager.hpp
@@ -59,6 +59,11 @@
void initFilters(const std::set<std::string>& probeInterfaces);
void handleCurrentConfigurationJson();
+
+ private:
+ std::unique_ptr<sdbusplus::bus::match_t> nameOwnerChangedMatch = nullptr;
+ std::unique_ptr<sdbusplus::bus::match_t> interfacesAddedMatch = nullptr;
+ std::unique_ptr<sdbusplus::bus::match_t> interfacesRemovedMatch = nullptr;
};
inline void logDeviceAdded(const nlohmann::json& record)