Patrick Venture | 6d7735d | 2019-06-21 10:03:19 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "status.hpp" |
| 4 | |
| 5 | #include <memory> |
| 6 | #include <sdbusplus/bus.hpp> |
| 7 | #include <string> |
| 8 | |
| 9 | namespace ipmi_flash |
| 10 | { |
| 11 | |
| 12 | class SystemdPreparation : public TriggerableActionInterface |
| 13 | { |
| 14 | public: |
| 15 | static std::unique_ptr<TriggerableActionInterface> |
Patrick Venture | 3915758 | 2019-08-21 10:02:18 -0700 | [diff] [blame^] | 16 | CreatePreparation(sdbusplus::bus::bus&& bus, const std::string& service, |
| 17 | const std::string& mode); |
Patrick Venture | 6d7735d | 2019-06-21 10:03:19 -0700 | [diff] [blame] | 18 | |
Patrick Venture | 3915758 | 2019-08-21 10:02:18 -0700 | [diff] [blame^] | 19 | SystemdPreparation(sdbusplus::bus::bus&& bus, const std::string& service, |
| 20 | const std::string& mode) : |
| 21 | bus(std::move(bus)), |
| 22 | triggerService(service), mode(mode) |
Patrick Venture | 6d7735d | 2019-06-21 10:03:19 -0700 | [diff] [blame] | 23 | { |
| 24 | } |
| 25 | |
| 26 | ~SystemdPreparation() = default; |
| 27 | SystemdPreparation(const SystemdPreparation&) = delete; |
| 28 | SystemdPreparation& operator=(const SystemdPreparation&) = delete; |
| 29 | SystemdPreparation(SystemdPreparation&&) = default; |
| 30 | SystemdPreparation& operator=(SystemdPreparation&&) = default; |
| 31 | |
| 32 | bool trigger() override; |
| 33 | void abort() override; |
| 34 | ActionStatus status() override; |
| 35 | |
| 36 | private: |
| 37 | sdbusplus::bus::bus bus; |
| 38 | const std::string triggerService; |
Patrick Venture | 3915758 | 2019-08-21 10:02:18 -0700 | [diff] [blame^] | 39 | const std::string mode; |
Patrick Venture | 6d7735d | 2019-06-21 10:03:19 -0700 | [diff] [blame] | 40 | ActionStatus state = ActionStatus::unknown; |
| 41 | }; |
| 42 | |
| 43 | } // namespace ipmi_flash |