Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 1 | #pragma once |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame^] | 2 | #include "device.hpp" |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 3 | |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame^] | 4 | namespace witherspoon |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 5 | { |
| 6 | namespace power |
| 7 | { |
| 8 | namespace psu |
| 9 | { |
| 10 | |
| 11 | /** |
| 12 | * @class PowerSupply |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame^] | 13 | * Represents a PMBus power supply device. |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 14 | */ |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame^] | 15 | class PowerSupply : public Device |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 16 | { |
| 17 | public: |
| 18 | PowerSupply() = delete; |
| 19 | PowerSupply(const PowerSupply&) = delete; |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 20 | PowerSupply(PowerSupply&&) = default; |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame^] | 21 | PowerSupply& operator=(const PowerSupply&) = default; |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 22 | PowerSupply& operator=(PowerSupply&&) = default; |
| 23 | ~PowerSupply() = default; |
| 24 | |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame^] | 25 | /** |
| 26 | * Constructor |
| 27 | * |
| 28 | * @param[in] name - the device name |
| 29 | * @param[in] inst - the device instance |
| 30 | * @param[in] objpath - the path to monitor |
| 31 | * @param[in] invpath - the inventory path to use |
| 32 | */ |
| 33 | PowerSupply(const std::string& name, size_t inst, |
| 34 | const std::string& objpath, const std::string& invpath) |
| 35 | : Device(name, inst), monitorPath(objpath), inventoryPath(invpath) |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Power supply specific function to analyze for faults/errors. |
| 41 | * |
| 42 | * Various PMBus status bits will be checked for fault conditions. |
| 43 | * If a certain fault bits are on, the appropriate error will be |
| 44 | * committed. |
| 45 | */ |
| 46 | void analyze() override; |
| 47 | |
| 48 | /** |
| 49 | * Write PMBus CLEAR_FAULTS |
| 50 | * |
| 51 | * This function will be called in various situations in order to clear |
| 52 | * any fault status bits that may have been set, in order to start over |
| 53 | * with a clean state. Presence changes and power state changes will |
| 54 | * want to clear any faults logged. |
| 55 | */ |
| 56 | void clearFaults() override; |
| 57 | |
| 58 | private: |
| 59 | /** |
| 60 | * The path to use for reading various PMBus bits/words. |
| 61 | */ |
| 62 | std::string monitorPath; |
| 63 | |
| 64 | /** |
| 65 | * The D-Bus path to use for this power supply's inventory status. |
| 66 | */ |
| 67 | std::string inventoryPath; |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | } |
| 71 | } |
| 72 | } |