Patrick Venture | 26a1726 | 2019-05-20 11:03:35 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "status.hpp" |
| 4 | #include "verify.hpp" |
| 5 | |
| 6 | #include <memory> |
| 7 | #include <sdbusplus/bus.hpp> |
| 8 | #include <string> |
| 9 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 10 | namespace ipmi_flash |
Patrick Venture | 26a1726 | 2019-05-20 11:03:35 -0700 | [diff] [blame] | 11 | { |
| 12 | |
| 13 | /** |
| 14 | * Representation of what is used for verification. Currently, this reduces the |
| 15 | * chance of error by using an object instead of two strings to control the |
| 16 | * verification step, however, it leaves room for a future possibility out |
| 17 | * something wholly configurable. |
| 18 | */ |
| 19 | class SystemdVerification : public VerificationInterface |
| 20 | { |
| 21 | public: |
| 22 | /** |
| 23 | * Create a default Verification object that uses systemd to trigger the |
| 24 | * process. |
| 25 | * |
| 26 | * @param[in] bus - an sdbusplus handler for a bus to use. |
| 27 | * @param[in] path - the path to check for verification status. |
| 28 | * @param[in[ service - the systemd service to start to trigger |
| 29 | * verification. |
| 30 | */ |
| 31 | static std::unique_ptr<VerificationInterface> |
| 32 | CreateVerification(sdbusplus::bus::bus&& bus, const std::string& path, |
| 33 | const std::string& service); |
| 34 | |
| 35 | SystemdVerification(sdbusplus::bus::bus&& bus, const std::string& path, |
| 36 | const std::string& service) : |
| 37 | bus(std::move(bus)), |
| 38 | checkPath(path), triggerService(service) |
| 39 | { |
| 40 | } |
| 41 | |
| 42 | ~SystemdVerification() = default; |
| 43 | SystemdVerification(const SystemdVerification&) = delete; |
| 44 | SystemdVerification& operator=(const SystemdVerification&) = delete; |
| 45 | SystemdVerification(SystemdVerification&&) = default; |
| 46 | SystemdVerification& operator=(SystemdVerification&&) = default; |
| 47 | |
| 48 | bool triggerVerification() override; |
| 49 | void abortVerification() override; |
| 50 | VerifyCheckResponses checkVerificationState() override; |
| 51 | |
| 52 | private: |
| 53 | sdbusplus::bus::bus bus; |
| 54 | const std::string checkPath; |
| 55 | const std::string triggerService; |
| 56 | }; |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 57 | } // namespace ipmi_flash |