| Lei YU | 56aaf45 | 2018-06-21 16:09:44 +0800 | [diff] [blame^] | 1 | #pragma once | 
 | 2 |  | 
 | 3 | #include <string> | 
 | 4 | #include <sdbusplus/bus.hpp> | 
 | 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 |  | 
 | 31 |     /** @brief Clear an image with the entry id | 
 | 32 |      * | 
 | 33 |      * @param[in] entryId - The image entry id | 
 | 34 |      */ | 
 | 35 |     void clearEntry(const std::string& entryId); | 
 | 36 |  | 
 | 37 |     /** @brief Clean up all the unused images */ | 
 | 38 |     void cleanup(); | 
 | 39 |  | 
 | 40 |     /** @brief Do factory reset */ | 
 | 41 |     void factoryReset(); | 
 | 42 |  | 
 | 43 |     /** @brief Remove the image with the version id | 
 | 44 |      * | 
 | 45 |      * @param[in] versionId - The version id of the image | 
 | 46 |      */ | 
 | 47 |     void removeVersion(const std::string& versionId); | 
 | 48 |  | 
 | 49 |     /** @brief Update version id in uboot env | 
 | 50 |      * | 
 | 51 |      * @param[in] versionId - The version id of the image | 
 | 52 |      */ | 
 | 53 |     void updateUbootVersionId(const std::string& versionId); | 
 | 54 |  | 
 | 55 |     /** @brief Enable field mode */ | 
 | 56 |     void enableFieldMode(); | 
 | 57 |  | 
 | 58 |     /** @brief Mirror Uboot to the alt uboot partition */ | 
 | 59 |     void mirrorAlt(); | 
 | 60 |  | 
 | 61 |   private: | 
 | 62 |     /** @brief Persistent sdbusplus D-Bus bus connection. */ | 
 | 63 |     sdbusplus::bus::bus& bus; | 
 | 64 | }; | 
 | 65 |  | 
 | 66 | } // namespace updater | 
 | 67 | } // namespace software | 
 | 68 | } // namespace phosphor |