Jagpal Singh Gill | 15dde86 | 2024-10-16 09:42:54 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <sdbusplus/async.hpp> |
| 4 | #include <sdbusplus/message/native_types.hpp> |
| 5 | #include <xyz/openbmc_project/State/Leak/Detector/client.hpp> |
| 6 | |
| 7 | #include <map> |
| 8 | #include <string> |
| 9 | #include <tuple> |
| 10 | |
| 11 | namespace leak |
| 12 | { |
| 13 | |
| 14 | namespace config |
| 15 | { |
| 16 | enum class DetectorLevel; |
| 17 | } |
| 18 | |
| 19 | using DetectorStateIntf = |
| 20 | sdbusplus::client::xyz::openbmc_project::state::leak::Detector<>; |
| 21 | |
| 22 | class Events |
| 23 | { |
| 24 | public: |
| 25 | Events() = delete; |
| 26 | |
| 27 | explicit Events(sdbusplus::async::context& ctx) : ctx(ctx) {} |
| 28 | |
| 29 | auto generateLeakEvent(sdbusplus::message::object_path detectorPath, |
| 30 | DetectorStateIntf::DetectorState state, |
| 31 | config::DetectorLevel level) |
| 32 | -> sdbusplus::async::task<>; |
| 33 | |
| 34 | private: |
| 35 | /** @brief Map type for event name to log event object path */ |
| 36 | using event_key_t = std::tuple<std::string, config::DetectorLevel>; |
| 37 | using event_map_t = std::map<event_key_t, sdbusplus::message::object_path>; |
| 38 | |
| 39 | sdbusplus::async::context& ctx; |
| 40 | event_map_t pendingEvents; |
| 41 | }; |
| 42 | |
| 43 | } // namespace leak |