blob: b8fe605fb9a011c329f590c433c1b713edee0abb [file] [log] [blame]
Patrick Venture6d7735d2019-06-21 10:03:19 -07001#pragma once
2
3#include "status.hpp"
4
5#include <memory>
6#include <sdbusplus/bus.hpp>
7#include <string>
8
9namespace ipmi_flash
10{
11
12class SystemdPreparation : public TriggerableActionInterface
13{
14 public:
15 static std::unique_ptr<TriggerableActionInterface>
Patrick Venture39157582019-08-21 10:02:18 -070016 CreatePreparation(sdbusplus::bus::bus&& bus, const std::string& service,
17 const std::string& mode);
Patrick Venture6d7735d2019-06-21 10:03:19 -070018
Patrick Venture39157582019-08-21 10:02:18 -070019 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 Venture6d7735d2019-06-21 10:03:19 -070023 {
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 Venture39157582019-08-21 10:02:18 -070039 const std::string mode;
Patrick Venture6d7735d2019-06-21 10:03:19 -070040 ActionStatus state = ActionStatus::unknown;
41};
42
43} // namespace ipmi_flash