blob: d64d8c8dd75a672ce8da4dcb240355ad4b93d295 [file] [log] [blame]
Patrick Venture26a17262019-05-20 11:03:35 -07001#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 Venture1d5a31c2019-05-20 11:38:22 -070010namespace ipmi_flash
Patrick Venture26a17262019-05-20 11:03:35 -070011{
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 */
19class 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 Venture1d5a31c2019-05-20 11:38:22 -070057} // namespace ipmi_flash