blob: 0b6764223058ab4863f28593430b4136bd93fd3b [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
62 /** @brief Enable field mode */
63 void enableFieldMode();
64
65 /** @brief Mirror Uboot to the alt uboot partition */
66 void mirrorAlt();
67
68 private:
69 /** @brief Persistent sdbusplus D-Bus bus connection. */
70 sdbusplus::bus::bus& bus;
71};
72
73} // namespace updater
74} // namespace software
75} // namespace phosphor