bmc: cleanup verification language and symbols
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ife4d7e519e44aff60441c5909346ca6d7e2aa090
diff --git a/bmc/general_systemd.hpp b/bmc/general_systemd.hpp
new file mode 100644
index 0000000..5c4c0e3
--- /dev/null
+++ b/bmc/general_systemd.hpp
@@ -0,0 +1,60 @@
+#pragma once
+
+#include "status.hpp"
+
+#include <memory>
+#include <sdbusplus/bus.hpp>
+#include <string>
+
+namespace ipmi_flash
+{
+
+/**
+ * Representation of what is used for triggering an action with systemd and
+ * checking the result by reading a file.
+ */
+class SystemdWithStatusFile : public TriggerableActionInterface
+{
+ public:
+ /**
+ * Create a default SystemdWithStatusFile object that uses systemd to
+ * trigger the process.
+ *
+ * @param[in] bus - an sdbusplus handler for a bus to use.
+ * @param[in] path - the path to check for verification status.
+ * @param[in] service - the systemd service to start to trigger
+ * verification.
+ * @param[in] mode - the job-mode when starting the systemd Unit.
+ */
+ static std::unique_ptr<TriggerableActionInterface>
+ CreateSystemdWithStatusFile(sdbusplus::bus::bus&& bus,
+ const std::string& path,
+ const std::string& service,
+ const std::string& mode);
+
+ SystemdWithStatusFile(sdbusplus::bus::bus&& bus, const std::string& path,
+ const std::string& service, const std::string& mode) :
+ bus(std::move(bus)),
+ checkPath(path), triggerService(service), mode(mode)
+ {
+ }
+
+ ~SystemdWithStatusFile() = default;
+ SystemdWithStatusFile(const SystemdWithStatusFile&) = delete;
+ SystemdWithStatusFile& operator=(const SystemdWithStatusFile&) = delete;
+ SystemdWithStatusFile(SystemdWithStatusFile&&) = default;
+ SystemdWithStatusFile& operator=(SystemdWithStatusFile&&) = default;
+
+ bool trigger() override;
+ void abort() override;
+ ActionStatus status() override;
+
+ const std::string getMode() const;
+
+ private:
+ sdbusplus::bus::bus bus;
+ const std::string checkPath;
+ const std::string triggerService;
+ const std::string mode;
+};
+} // namespace ipmi_flash