| Jagpal Singh Gill | 7184805 | 2025-10-16 00:28:58 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <sdbusplus/async.hpp> |
| 4 | #include <xyz/openbmc_project/Sensor/Value/client.hpp> |
| 5 | |
| 6 | namespace phosphor::modbus::events |
| 7 | { |
| 8 | |
| 9 | using SensorValueIntf = |
| 10 | sdbusplus::client::xyz::openbmc_project::sensor::Value<>; |
| 11 | |
| 12 | enum class EventLevel |
| 13 | { |
| 14 | critical, |
| 15 | warning |
| 16 | }; |
| 17 | |
| 18 | class Events |
| 19 | { |
| 20 | public: |
| 21 | Events() = delete; |
| 22 | |
| 23 | explicit Events(sdbusplus::async::context& ctx) : ctx(ctx) {} |
| 24 | |
| 25 | auto generateSensorReadingEvent(sdbusplus::message::object_path objectPath, |
| 26 | EventLevel level, double value, |
| 27 | SensorValueIntf::Unit unit, bool asserted) |
| 28 | -> sdbusplus::async::task<>; |
| 29 | |
| 30 | auto generateSensorFailureEvent(sdbusplus::message::object_path objectPath, |
| 31 | bool asserted) -> sdbusplus::async::task<>; |
| 32 | |
| 33 | auto generateControllerFailureEvent( |
| 34 | sdbusplus::message::object_path objectPath, std::string additionalInfo, |
| 35 | bool asserted) -> sdbusplus::async::task<>; |
| 36 | |
| 37 | auto generatePowerFaultEvent(sdbusplus::message::object_path objectPath, |
| 38 | std::string additionalInfo, bool asserted) |
| 39 | -> sdbusplus::async::task<>; |
| 40 | |
| 41 | auto generateFilterFailureEvent(sdbusplus::message::object_path objectPath, |
| 42 | bool asserted) -> sdbusplus::async::task<>; |
| 43 | |
| 44 | auto generatePumpFailureEvent(sdbusplus::message::object_path objectPath, |
| 45 | bool asserted) -> sdbusplus::async::task<>; |
| 46 | |
| 47 | auto generateFanFailureEvent(sdbusplus::message::object_path objectPath, |
| 48 | bool asserted) -> sdbusplus::async::task<>; |
| 49 | |
| 50 | auto generateLeakDetectedEvent(sdbusplus::message::object_path objectPath, |
| 51 | EventLevel level, bool asserted) |
| 52 | -> sdbusplus::async::task<>; |
| 53 | |
| 54 | // Button Pressed |
| 55 | |
| 56 | private: |
| 57 | /** @brief Map type for event name to log event object path */ |
| 58 | using event_map_t = std::map<std::string, sdbusplus::message::object_path>; |
| 59 | |
| 60 | sdbusplus::async::context& ctx; |
| 61 | event_map_t pendingEvents; |
| 62 | }; |
| 63 | |
| 64 | } // namespace phosphor::modbus::events |