blob: 894b534bffc146200c400c7bd1918e2652944591 [file] [log] [blame]
Patrick Venture26a17262019-05-20 11:03:35 -07001#pragma once
2
3#include "status.hpp"
Patrick Venture26a17262019-05-20 11:03:35 -07004
5#include <memory>
6#include <sdbusplus/bus.hpp>
7#include <string>
8
Patrick Venture1d5a31c2019-05-20 11:38:22 -07009namespace ipmi_flash
Patrick Venture26a17262019-05-20 11:03:35 -070010{
11
12/**
13 * Representation of what is used for verification. Currently, this reduces the
14 * chance of error by using an object instead of two strings to control the
15 * verification step, however, it leaves room for a future possibility out
16 * something wholly configurable.
17 */
Patrick Venture1d66fe62019-06-03 14:57:27 -070018class SystemdVerification : public TriggerableActionInterface
Patrick Venture26a17262019-05-20 11:03:35 -070019{
20 public:
21 /**
22 * Create a default Verification object that uses systemd to trigger the
23 * process.
24 *
25 * @param[in] bus - an sdbusplus handler for a bus to use.
26 * @param[in] path - the path to check for verification status.
27 * @param[in[ service - the systemd service to start to trigger
28 * verification.
29 */
Patrick Venture1d66fe62019-06-03 14:57:27 -070030 static std::unique_ptr<TriggerableActionInterface>
Patrick Venture26a17262019-05-20 11:03:35 -070031 CreateVerification(sdbusplus::bus::bus&& bus, const std::string& path,
32 const std::string& service);
33
34 SystemdVerification(sdbusplus::bus::bus&& bus, const std::string& path,
35 const std::string& service) :
36 bus(std::move(bus)),
37 checkPath(path), triggerService(service)
38 {
39 }
40
41 ~SystemdVerification() = default;
42 SystemdVerification(const SystemdVerification&) = delete;
43 SystemdVerification& operator=(const SystemdVerification&) = delete;
44 SystemdVerification(SystemdVerification&&) = default;
45 SystemdVerification& operator=(SystemdVerification&&) = default;
46
Patrick Venture1d66fe62019-06-03 14:57:27 -070047 bool trigger() override;
48 void abort() override;
Patrick Ventureda66fd82019-06-03 11:11:24 -070049 ActionStatus status() override;
Patrick Venture26a17262019-05-20 11:03:35 -070050
51 private:
52 sdbusplus::bus::bus bus;
53 const std::string checkPath;
54 const std::string triggerService;
55};
Patrick Venture1d5a31c2019-05-20 11:38:22 -070056} // namespace ipmi_flash