Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Dhruvaraj Subhashchandran | 860b8a3 | 2021-05-05 13:01:49 -0500 | [diff] [blame] | 3 | #include "bmcstored_dump_entry.hpp" |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 4 | #include "xyz/openbmc_project/Dump/Entry/BMC/server.hpp" |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 5 | |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 6 | #include <sdbusplus/bus.hpp> |
| 7 | #include <sdbusplus/server/object.hpp> |
| 8 | |
Jayanth Othayoth | 0af74a5 | 2021-04-08 03:55:21 -0500 | [diff] [blame] | 9 | #include <filesystem> |
| 10 | |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 11 | namespace phosphor |
| 12 | { |
| 13 | namespace dump |
| 14 | { |
| 15 | namespace bmc |
| 16 | { |
| 17 | template <typename T> |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 18 | using ServerObject = typename sdbusplus::server::object_t<T>; |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 19 | |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 20 | using EntryIfaces = sdbusplus::server::object_t< |
Dhruvaraj Subhashchandran | 860b8a3 | 2021-05-05 13:01:49 -0500 | [diff] [blame] | 21 | sdbusplus::xyz::openbmc_project::Dump::Entry::server::BMC>; |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 22 | |
Asmitha Karunanithi | 74a1f39 | 2021-10-27 03:23:59 -0500 | [diff] [blame] | 23 | using originatorTypes = sdbusplus::xyz::openbmc_project::Common::server:: |
| 24 | OriginatedBy::OriginatorTypes; |
| 25 | |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 26 | class Manager; |
| 27 | |
| 28 | /** @class Entry |
| 29 | * @brief OpenBMC Dump Entry implementation. |
| 30 | * @details A concrete implementation for the |
| 31 | * xyz.openbmc_project.Dump.Entry DBus API |
| 32 | */ |
Dhruvaraj Subhashchandran | 860b8a3 | 2021-05-05 13:01:49 -0500 | [diff] [blame] | 33 | class Entry : |
| 34 | virtual public EntryIfaces, |
| 35 | virtual public phosphor::dump::bmc_stored::Entry |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 36 | { |
| 37 | public: |
| 38 | Entry() = delete; |
| 39 | Entry(const Entry&) = delete; |
| 40 | Entry& operator=(const Entry&) = delete; |
| 41 | Entry(Entry&&) = delete; |
| 42 | Entry& operator=(Entry&&) = delete; |
| 43 | ~Entry() = default; |
| 44 | |
| 45 | /** @brief Constructor for the Dump Entry Object |
| 46 | * @param[in] bus - Bus to attach to. |
| 47 | * @param[in] objPath - Object path to attach to |
| 48 | * @param[in] dumpId - Dump id. |
| 49 | * @param[in] timeStamp - Dump creation timestamp |
| 50 | * since the epoch. |
| 51 | * @param[in] fileSize - Dump file size in bytes. |
| 52 | * @param[in] file - Name of dump file. |
Dhruvaraj Subhashchandran | a6ab806 | 2020-10-29 15:29:10 -0500 | [diff] [blame] | 53 | * @param[in] status - status of the dump. |
Asmitha Karunanithi | 74a1f39 | 2021-10-27 03:23:59 -0500 | [diff] [blame] | 54 | * @param[in] originatorId - Id of the originator of the dump |
| 55 | * @param[in] originatorType - Originator type |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 56 | * @param[in] parent - The dump entry's parent. |
| 57 | */ |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 58 | Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId, |
Jayanth Othayoth | 3fc6df4 | 2021-04-08 03:45:24 -0500 | [diff] [blame] | 59 | uint64_t timeStamp, uint64_t fileSize, |
| 60 | const std::filesystem::path& file, |
Asmitha Karunanithi | 74a1f39 | 2021-10-27 03:23:59 -0500 | [diff] [blame] | 61 | phosphor::dump::OperationStatus status, std::string originatorId, |
| 62 | originatorTypes originatorType, phosphor::dump::Manager& parent) : |
Patrick Williams | 73f6407 | 2022-04-01 17:04:47 -0500 | [diff] [blame] | 63 | EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit), |
Dhruvaraj Subhashchandran | 860b8a3 | 2021-05-05 13:01:49 -0500 | [diff] [blame] | 64 | phosphor::dump::bmc_stored::Entry(bus, objPath.c_str(), dumpId, |
| 65 | timeStamp, fileSize, file, status, |
| 66 | originatorId, originatorType, parent) |
Dhruvaraj Subhashchandran | 2f8e276 | 2021-02-11 07:22:35 -0600 | [diff] [blame] | 67 | { |
| 68 | // Emit deferred signal. |
| 69 | this->phosphor::dump::bmc::EntryIfaces::emit_object_added(); |
| 70 | } |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | } // namespace bmc |
| 74 | } // namespace dump |
| 75 | } // namespace phosphor |