blob: ef632054e814688869ba8cc6cd3454cea30ff993 [file] [log] [blame]
Jagpal Singh Gill15dde862024-10-16 09:42:54 -07001#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
11namespace leak
12{
13
14namespace config
15{
16enum class DetectorLevel;
17}
18
19using DetectorStateIntf =
20 sdbusplus::client::xyz::openbmc_project::state::leak::Detector<>;
21
22class 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