Lei YU | 56aaf45 | 2018-06-21 16:09:44 +0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Lei YU | 56aaf45 | 2018-06-21 16:09:44 +0800 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame^] | 4 | #include <string> |
Lei YU | 56aaf45 | 2018-06-21 16:09:44 +0800 | [diff] [blame] | 5 | |
| 6 | namespace phosphor |
| 7 | { |
| 8 | namespace software |
| 9 | { |
| 10 | namespace updater |
| 11 | { |
| 12 | |
| 13 | class 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 Kobylak | bbcb7be | 2018-07-17 15:47:34 -0500 | [diff] [blame] | 31 | /** @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 YU | 56aaf45 | 2018-06-21 16:09:44 +0800 | [diff] [blame] | 38 | /** @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 |