blob: 13b98da4554796f172a1ddd3a9bc65d1d7102c69 [file] [log] [blame]
Lei YU56aaf452018-06-21 16:09:44 +08001#pragma once
2
Lei YU56aaf452018-06-21 16:09:44 +08003#include <sdbusplus/bus.hpp>
Gunnar Millsb0ce9962018-09-07 13:39:10 -05004#include <string>
Lei YU56aaf452018-06-21 16:09:44 +08005
6namespace phosphor
7{
8namespace software
9{
10namespace updater
11{
12
13class Helper
14{
15 public:
16 Helper() = delete;
17 Helper(const Helper&) = delete;
18 Helper& operator=(const Helper&) = delete;
19 Helper(Helper&&) = default;
20 Helper& operator=(Helper&&) = default;
21
22 /** @brief Constructor
23 *
24 * @param[in] bus - sdbusplus D-Bus bus connection
25 */
26 Helper(sdbusplus::bus::bus& bus) : bus(bus)
27 {
28 // Empty
29 }
30
Adriana Kobylakbbcb7be2018-07-17 15:47:34 -050031 /** @brief Set an environment variable to the specified value
32 *
33 * @param[in] entryId - The variable name
34 * @param[in] value - The variable value
35 */
36 void setEntry(const std::string& entryId, uint8_t value);
37
Lei YU56aaf452018-06-21 16:09:44 +080038 /** @brief Clear an image with the entry id
39 *
40 * @param[in] entryId - The image entry id
41 */
42 void clearEntry(const std::string& entryId);
43
44 /** @brief Clean up all the unused images */
45 void cleanup();
46
47 /** @brief Do factory reset */
48 void factoryReset();
49
50 /** @brief Remove the image with the version id
51 *
52 * @param[in] versionId - The version id of the image
53 */
54 void removeVersion(const std::string& versionId);
55
56 /** @brief Update version id in uboot env
57 *
58 * @param[in] versionId - The version id of the image
59 */
60 void updateUbootVersionId(const std::string& versionId);
61
Lei YU56aaf452018-06-21 16:09:44 +080062 /** @brief Mirror Uboot to the alt uboot partition */
63 void mirrorAlt();
64
65 private:
66 /** @brief Persistent sdbusplus D-Bus bus connection. */
67 sdbusplus::bus::bus& bus;
68};
69
70} // namespace updater
71} // namespace software
72} // namespace phosphor