Ratan Gupta | cd22786 | 2017-10-06 21:27:13 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ratan Gupta | 3e84ec6 | 2017-10-06 21:37:01 +0530 | [diff] [blame] | 3 | #include "event_entry.hpp" |
| 4 | |
| 5 | #include <map> |
| 6 | #include <memory> |
| 7 | #include <queue> |
Ratan Gupta | cd22786 | 2017-10-06 21:27:13 +0530 | [diff] [blame] | 8 | #include <sdbusplus/bus.hpp> |
Andrew Geissler | ae4c95c | 2020-05-16 13:58:53 -0500 | [diff] [blame] | 9 | #include <string> |
Ratan Gupta | cd22786 | 2017-10-06 21:27:13 +0530 | [diff] [blame] | 10 | |
| 11 | namespace phosphor |
| 12 | { |
| 13 | namespace events |
| 14 | { |
| 15 | |
| 16 | /** @class Manager |
| 17 | * @brief OpenBMC Event manager implementation. |
| 18 | */ |
| 19 | class Manager |
| 20 | { |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 21 | public: |
| 22 | Manager() = default; |
| 23 | Manager(const Manager&) = delete; |
| 24 | Manager& operator=(const Manager&) = delete; |
| 25 | Manager(Manager&&) = default; |
| 26 | Manager& operator=(Manager&&) = default; |
| 27 | virtual ~Manager() = default; |
Ratan Gupta | cd22786 | 2017-10-06 21:27:13 +0530 | [diff] [blame] | 28 | |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 29 | /** @brief Create the D-Bus Event object. |
| 30 | * @detail Add the objectPath,propertyName, propertyValue |
| 31 | * as additional data of the event object. |
| 32 | * @param[in] eventName - Name of the event. |
| 33 | * @param[in] eventMessage - Message for the event. |
| 34 | * @param[in] objectPath - Path of the D-Bus object. |
| 35 | * @param[in] propertyName - Name of the property. |
| 36 | * @param[in] propertyValue - Value of the property. |
| 37 | */ |
| 38 | void create(const std::string& eventName, const std::string& eventMessage, |
| 39 | const std::string& objectPath, const std::string& propertyName, |
| 40 | const std::string& propertyValue); |
Ratan Gupta | cd22786 | 2017-10-06 21:27:13 +0530 | [diff] [blame] | 41 | |
Dhruvaraj Subhashchandran | 6524b9d | 2017-10-18 01:41:51 -0500 | [diff] [blame] | 42 | /** @brief Construct event d-bus objects from their persisted |
| 43 | * representations. |
| 44 | */ |
| 45 | void restore(); |
| 46 | |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 47 | private: |
| 48 | using EventName = std::string; |
| 49 | /** @brief Queue of events */ |
| 50 | using EventQueue = std::queue<std::unique_ptr<Entry>>; |
Ratan Gupta | 3e84ec6 | 2017-10-06 21:37:01 +0530 | [diff] [blame] | 51 | |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 52 | using EventMap = std::map<EventName, EventQueue>; |
| 53 | /** @brief Map of event name and the list of events **/ |
| 54 | EventMap eventMap; |
Ratan Gupta | cd22786 | 2017-10-06 21:27:13 +0530 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | Manager& getManager(); |
| 58 | |
| 59 | } // namespace events |
| 60 | } // namespace phosphor |