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> |
Adriana Kobylak | 58aa750 | 2020-06-08 11:12:11 -0500 | [diff] [blame] | 4 | |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 5 | #include <string> |
Lei YU | 56aaf45 | 2018-06-21 16:09:44 +0800 | [diff] [blame] | 6 | |
| 7 | namespace phosphor |
| 8 | { |
| 9 | namespace software |
| 10 | { |
| 11 | namespace updater |
| 12 | { |
| 13 | |
| 14 | class Helper |
| 15 | { |
| 16 | public: |
| 17 | Helper() = delete; |
| 18 | Helper(const Helper&) = delete; |
| 19 | Helper& operator=(const Helper&) = delete; |
| 20 | Helper(Helper&&) = default; |
| 21 | Helper& operator=(Helper&&) = default; |
| 22 | |
| 23 | /** @brief Constructor |
| 24 | * |
| 25 | * @param[in] bus - sdbusplus D-Bus bus connection |
| 26 | */ |
| 27 | Helper(sdbusplus::bus::bus& bus) : bus(bus) |
| 28 | { |
| 29 | // Empty |
| 30 | } |
| 31 | |
Adriana Kobylak | bbcb7be | 2018-07-17 15:47:34 -0500 | [diff] [blame] | 32 | /** @brief Set an environment variable to the specified value |
| 33 | * |
| 34 | * @param[in] entryId - The variable name |
| 35 | * @param[in] value - The variable value |
| 36 | */ |
| 37 | void setEntry(const std::string& entryId, uint8_t value); |
| 38 | |
Lei YU | 56aaf45 | 2018-06-21 16:09:44 +0800 | [diff] [blame] | 39 | /** @brief Clear an image with the entry id |
| 40 | * |
| 41 | * @param[in] entryId - The image entry id |
| 42 | */ |
| 43 | void clearEntry(const std::string& entryId); |
| 44 | |
| 45 | /** @brief Clean up all the unused images */ |
| 46 | void cleanup(); |
| 47 | |
| 48 | /** @brief Do factory reset */ |
| 49 | void factoryReset(); |
| 50 | |
| 51 | /** @brief Remove the image with the version id |
| 52 | * |
| 53 | * @param[in] versionId - The version id of the image |
| 54 | */ |
| 55 | void removeVersion(const std::string& versionId); |
| 56 | |
| 57 | /** @brief Update version id in uboot env |
| 58 | * |
| 59 | * @param[in] versionId - The version id of the image |
| 60 | */ |
| 61 | void updateUbootVersionId(const std::string& versionId); |
| 62 | |
Lei YU | 56aaf45 | 2018-06-21 16:09:44 +0800 | [diff] [blame] | 63 | /** @brief Mirror Uboot to the alt uboot partition */ |
| 64 | void mirrorAlt(); |
| 65 | |
| 66 | private: |
| 67 | /** @brief Persistent sdbusplus D-Bus bus connection. */ |
| 68 | sdbusplus::bus::bus& bus; |
| 69 | }; |
| 70 | |
| 71 | } // namespace updater |
| 72 | } // namespace software |
| 73 | } // namespace phosphor |