Jim Wright | 7945dd2 | 2021-04-06 16:55:15 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Jim Wright | 930458c | 2022-01-24 14:37:27 -0600 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> |
| 4 | |
| 5 | #include <map> |
| 6 | #include <string> |
| 7 | |
Jim Wright | 7945dd2 | 2021-04-06 16:55:15 -0500 | [diff] [blame] | 8 | namespace phosphor::power::sequencer |
| 9 | { |
| 10 | |
| 11 | /** |
| 12 | * @class PowerSequencerMonitor |
| 13 | * Define a base class for monitoring a power sequencer device. |
| 14 | */ |
| 15 | class PowerSequencerMonitor |
| 16 | { |
| 17 | public: |
Jim Wright | 930458c | 2022-01-24 14:37:27 -0600 | [diff] [blame] | 18 | PowerSequencerMonitor() = delete; |
Jim Wright | 7945dd2 | 2021-04-06 16:55:15 -0500 | [diff] [blame] | 19 | PowerSequencerMonitor(const PowerSequencerMonitor&) = delete; |
| 20 | PowerSequencerMonitor& operator=(const PowerSequencerMonitor&) = delete; |
| 21 | PowerSequencerMonitor(PowerSequencerMonitor&&) = delete; |
| 22 | PowerSequencerMonitor& operator=(PowerSequencerMonitor&&) = delete; |
| 23 | virtual ~PowerSequencerMonitor() = default; |
Jim Wright | 930458c | 2022-01-24 14:37:27 -0600 | [diff] [blame] | 24 | |
| 25 | /** |
| 26 | * Create a base device object for power sequence monitoring. |
Jim Wright | 213ffe9 | 2022-06-03 08:54:30 -0500 | [diff] [blame] | 27 | * @param bus D-Bus bus object |
Jim Wright | 930458c | 2022-01-24 14:37:27 -0600 | [diff] [blame] | 28 | */ |
Patrick Williams | 7354ce6 | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 29 | explicit PowerSequencerMonitor(sdbusplus::bus_t& bus); |
Jim Wright | 930458c | 2022-01-24 14:37:27 -0600 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Logs an error using the D-Bus Create method. |
Jim Wright | 213ffe9 | 2022-06-03 08:54:30 -0500 | [diff] [blame] | 33 | * @param message Message property of the error log entry |
| 34 | * @param additionalData AdditionalData property of the error log entry |
Jim Wright | 930458c | 2022-01-24 14:37:27 -0600 | [diff] [blame] | 35 | */ |
| 36 | void logError(const std::string& message, |
| 37 | std::map<std::string, std::string>& additionalData); |
| 38 | |
| 39 | /** |
| 40 | * Analyzes the device for errors when the device is |
| 41 | * known to be in an error state. A log will be created. |
Jim Wright | 213ffe9 | 2022-06-03 08:54:30 -0500 | [diff] [blame] | 42 | * @param timeout if the failure state was determined by timing out |
| 43 | * @param powerSupplyError The power supply error to log. A default |
Jim Wright | 71a1413 | 2022-01-28 09:46:46 -0600 | [diff] [blame] | 44 | * std:string, i.e. empty string (""), is passed when there is no power |
Jim Wright | 930458c | 2022-01-24 14:37:27 -0600 | [diff] [blame] | 45 | * supply error to log. |
| 46 | */ |
| 47 | virtual void onFailure(bool timeout, const std::string& powerSupplyError); |
| 48 | |
| 49 | protected: |
| 50 | /** |
| 51 | * The D-Bus bus object |
| 52 | */ |
Patrick Williams | 7354ce6 | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 53 | sdbusplus::bus_t& bus; |
Jim Wright | 213ffe9 | 2022-06-03 08:54:30 -0500 | [diff] [blame] | 54 | |
| 55 | /* |
| 56 | * Create a BMC Dump |
| 57 | */ |
| 58 | void createBmcDump(); |
Jim Wright | 7945dd2 | 2021-04-06 16:55:15 -0500 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | } // namespace phosphor::power::sequencer |