summaryrefslogtreecommitdiffstats
path: root/item_updater_helper.hpp
blob: 0b6764223058ab4863f28593430b4136bd93fd3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once

#include <sdbusplus/bus.hpp>
#include <string>

namespace phosphor
{
namespace software
{
namespace updater
{

class Helper
{
  public:
    Helper() = delete;
    Helper(const Helper&) = delete;
    Helper& operator=(const Helper&) = delete;
    Helper(Helper&&) = default;
    Helper& operator=(Helper&&) = default;

    /** @brief Constructor
     *
     *  @param[in] bus - sdbusplus D-Bus bus connection
     */
    Helper(sdbusplus::bus::bus& bus) : bus(bus)
    {
        // Empty
    }

    /** @brief Set an environment variable to the specified value
     *
     * @param[in] entryId - The variable name
     * @param[in] value - The variable value
     */
    void setEntry(const std::string& entryId, uint8_t value);

    /** @brief Clear an image with the entry id
     *
     * @param[in] entryId - The image entry id
     */
    void clearEntry(const std::string& entryId);

    /** @brief Clean up all the unused images */
    void cleanup();

    /** @brief Do factory reset */
    void factoryReset();

    /** @brief Remove the image with the version id
     *
     * @param[in] versionId - The version id of the image
     */
    void removeVersion(const std::string& versionId);

    /** @brief Update version id in uboot env
     *
     * @param[in] versionId - The version id of the image
     */
    void updateUbootVersionId(const std::string& versionId);

    /** @brief Enable field mode */
    void enableFieldMode();

    /** @brief Mirror Uboot to the alt uboot partition */
    void mirrorAlt();

  private:
    /** @brief Persistent sdbusplus D-Bus bus connection. */
    sdbusplus::bus::bus& bus;
};

} // namespace updater
} // namespace software
} // namespace phosphor
OpenPOWER on IntegriCloud