xref: /openbmc/dbus-sensors/src/EntityManagerInterface.hpp (revision 15dde8641baa1cb902d17f9857effb081e384944)
1 #pragma once
2 
3 #include <sdbusplus/async.hpp>
4 #include <sdbusplus/message/native_types.hpp>
5 
6 #include <functional>
7 #include <string>
8 #include <vector>
9 
10 namespace entity_manager
11 {
12 
13 class EntityManagerInterface
14 {
15   public:
16     using Callback_t = std::function<void(
17         const sdbusplus::message::object_path&, const std::string&)>;
18     using interface_list_t = std::vector<std::string>;
19     static constexpr auto serviceName = "xyz.openbmc_project.EntityManager";
20 
21     EntityManagerInterface() = delete;
22 
23     EntityManagerInterface(sdbusplus::async::context& ctx,
24                            const interface_list_t& interfaceNames,
25                            Callback_t addedCallback,
26                            Callback_t removedCallback);
27 
28     /** Get the inventory info from Entity Manager */
29     auto handleInventoryGet() -> sdbusplus::async::task<>;
30 
31   private:
32     /** @brief Handle async inventory add from Entity Manager */
33     auto handleInventoryAdded() -> sdbusplus::async::task<>;
34 
35     /** @brief Handle async inventory remove from Entity Manager */
36     auto handleInventoryRemoved() -> sdbusplus::async::task<>;
37 
38     sdbusplus::async::context& ctx;
39     interface_list_t interfaceNames;
40     Callback_t addedCallback;
41     Callback_t removedCallback;
42 };
43 
44 } // namespace entity_manager
45