xref: /openbmc/pldm/fw-update/update.hpp (revision 11085f1bd8bc53d7ed142116d18c91ab67c29668)
1 #pragma once
2 
3 #include <xyz/openbmc_project/Software/ApplyTime/server.hpp>
4 #include <xyz/openbmc_project/Software/MultipartUpdate/server.hpp>
5 #include <xyz/openbmc_project/Software/Update/server.hpp>
6 
7 namespace pldm
8 {
9 
10 namespace fw_update
11 {
12 
13 class UpdateManager;
14 
15 using UpdateIntf = sdbusplus::server::object_t<
16     sdbusplus::xyz::openbmc_project::Software::server::Update,
17     sdbusplus::xyz::openbmc_project::Software::server::MultipartUpdate>;
18 using ApplyTimeIntf =
19     sdbusplus::xyz::openbmc_project::Software::server::ApplyTime;
20 
21 /** @class Update
22  *
23  *  Concrete implementation of xyz.openbmc_project.Software.Update D-Bus
24  *  interface
25  */
26 class Update : public UpdateIntf
27 {
28   public:
29     /** @brief Constructor
30      *
31      *  @param[in] bus - Bus to attach to
32      *  @param[in] objPath - D-Bus object path
33      *  @param[in] updateManager - Reference to FW update manager
34      */
Update(sdbusplus::bus_t & bus,const std::string & path,UpdateManager * updateManager)35     Update(sdbusplus::bus_t& bus, const std::string& path,
36            UpdateManager* updateManager) :
37         UpdateIntf(bus, path.c_str()), updateManager(updateManager),
38         objPath(path)
39     {}
40 
41     virtual sdbusplus::message::object_path startUpdate(
42         sdbusplus::message::unix_fd image,
43         ApplyTimeIntf::RequestedApplyTimes applyTime) override;
44 
45     ~Update() noexcept override = default;
46 
47   private:
48     UpdateManager* updateManager;
49     const std::string objPath;
50     std::stringstream imageStream;
51 };
52 
53 } // namespace fw_update
54 
55 } // namespace pldm
56