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> |
| 9 | |
| 10 | namespace phosphor |
| 11 | { |
| 12 | namespace events |
| 13 | { |
| 14 | |
| 15 | /** @class Manager |
| 16 | * @brief OpenBMC Event manager implementation. |
| 17 | */ |
| 18 | class Manager |
| 19 | { |
| 20 | public: |
| 21 | Manager() = default; |
| 22 | Manager(const Manager&) = delete; |
| 23 | Manager& operator=(const Manager&) = delete; |
| 24 | Manager(Manager&&) = default; |
| 25 | Manager& operator=(Manager&&) = default; |
| 26 | virtual ~Manager() = default; |
| 27 | |
| 28 | /** @brief Create the D-Bus Event object. |
| 29 | * @detail Add the objectPath,propertyName, propertyValue |
| 30 | * as additional data of the event object. |
| 31 | * @param[in] eventName - Name of the event. |
Ratan Gupta | 3e84ec6 | 2017-10-06 21:37:01 +0530 | [diff] [blame^] | 32 | * @param[in] eventMessage - Message for the event. |
Ratan Gupta | cd22786 | 2017-10-06 21:27:13 +0530 | [diff] [blame] | 33 | * @param[in] objectPath - Path of the D-Bus object. |
| 34 | * @param[in] propertyName - Name of the property. |
| 35 | * @param[in] propertyValue - Value of the property. |
| 36 | */ |
| 37 | void create( |
| 38 | const std::string& eventName, |
Ratan Gupta | 3e84ec6 | 2017-10-06 21:37:01 +0530 | [diff] [blame^] | 39 | const std::string& eventMessage, |
Ratan Gupta | cd22786 | 2017-10-06 21:27:13 +0530 | [diff] [blame] | 40 | const std::string& objectPath, |
| 41 | const std::string& propertyName, |
| 42 | const std::string& propertyValue); |
| 43 | |
Ratan Gupta | 3e84ec6 | 2017-10-06 21:37:01 +0530 | [diff] [blame^] | 44 | private: |
| 45 | using EventName = std::string; |
| 46 | /** @brief Queue of events */ |
| 47 | using EventQueue = std::queue<std::unique_ptr<Entry>>; |
| 48 | |
| 49 | using EventMap = std::map<EventName, EventQueue>; |
| 50 | /** @brief Map of event name and the list of events **/ |
| 51 | EventMap eventMap; |
Ratan Gupta | cd22786 | 2017-10-06 21:27:13 +0530 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | Manager& getManager(); |
| 55 | |
| 56 | } // namespace events |
| 57 | } // namespace phosphor |