1 #pragma once 2 3 #include "dump_entry.hpp" 4 #include "xyz/openbmc_project/Dump/Entry/BMC/server.hpp" 5 #include "xyz/openbmc_project/Dump/Entry/server.hpp" 6 #include "xyz/openbmc_project/Object/Delete/server.hpp" 7 #include "xyz/openbmc_project/Time/EpochTime/server.hpp" 8 9 #include <sdbusplus/bus.hpp> 10 #include <sdbusplus/server/object.hpp> 11 12 #include <filesystem> 13 14 namespace phosphor 15 { 16 namespace dump 17 { 18 namespace bmc 19 { 20 template <typename T> 21 using ServerObject = typename sdbusplus::server::object_t<T>; 22 23 using EntryIfaces = sdbusplus::server::object_t< 24 sdbusplus::xyz::openbmc_project::Dump::Entry::server::BMC>; 25 26 using originatorTypes = sdbusplus::xyz::openbmc_project::Common::server:: 27 OriginatedBy::OriginatorTypes; 28 29 class Manager; 30 31 /** @class Entry 32 * @brief OpenBMC Dump Entry implementation. 33 * @details A concrete implementation for the 34 * xyz.openbmc_project.Dump.Entry DBus API 35 */ 36 class Entry : virtual public EntryIfaces, virtual public phosphor::dump::Entry 37 { 38 public: 39 Entry() = delete; 40 Entry(const Entry&) = delete; 41 Entry& operator=(const Entry&) = delete; 42 Entry(Entry&&) = delete; 43 Entry& operator=(Entry&&) = delete; 44 ~Entry() = default; 45 46 /** @brief Constructor for the Dump Entry Object 47 * @param[in] bus - Bus to attach to. 48 * @param[in] objPath - Object path to attach to 49 * @param[in] dumpId - Dump id. 50 * @param[in] timeStamp - Dump creation timestamp 51 * since the epoch. 52 * @param[in] fileSize - Dump file size in bytes. 53 * @param[in] file - Absolute path to the dump file. 54 * @param[in] status - status of the dump. 55 * @param[in] originatorId - Id of the originator of the dump 56 * @param[in] originatorType - Originator type 57 * @param[in] parent - The dump entry's parent. 58 */ 59 Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId, 60 uint64_t timeStamp, uint64_t fileSize, 61 const std::filesystem::path& file, 62 phosphor::dump::OperationStatus status, std::string originatorId, 63 originatorTypes originatorType, phosphor::dump::Manager& parent) : 64 EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit), 65 phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, fileSize, 66 file, status, originatorId, originatorType, 67 parent) 68 { 69 // Emit deferred signal. 70 this->phosphor::dump::bmc::EntryIfaces::emit_object_added(); 71 } 72 73 /** @brief Delete this d-bus object. 74 */ 75 void delete_() override; 76 77 /** @brief Method to initiate the offload of dump 78 * @param[in] uri - URI to offload dump 79 */ 80 void initiateOffload(std::string uri) override; 81 82 /** @brief Method to update an existing dump entry, once the dump creation 83 * is completed this function will be used to update the entry which got 84 * created during the dump request. 85 * @param[in] timeStamp - Dump creation timestamp 86 * @param[in] fileSize - Dump file size in bytes. 87 * @param[in] file - Name of dump file. 88 */ 89 void update(uint64_t timeStamp, uint64_t fileSize, 90 const std::filesystem::path& filePath) 91 { 92 elapsed(timeStamp); 93 size(fileSize); 94 // TODO: Handled dump failed case with #ibm-openbmc/2808 95 status(OperationStatus::Completed); 96 file = filePath; 97 // TODO: serialization of this property will be handled with 98 // #ibm-openbmc/2597 99 completedTime(timeStamp); 100 } 101 }; 102 103 } // namespace bmc 104 } // namespace dump 105 } // namespace phosphor 106