blob: 82312e07df8c6fe1f1598967f357ffc899236214 [file] [log] [blame]
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -06001#pragma once
2
Dhruvaraj Subhashchandran860b8a32021-05-05 13:01:49 -05003#include "bmcstored_dump_entry.hpp"
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -06004#include "xyz/openbmc_project/Dump/Entry/BMC/server.hpp"
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -06005
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -06006#include <sdbusplus/bus.hpp>
7#include <sdbusplus/server/object.hpp>
8
Jayanth Othayoth0af74a52021-04-08 03:55:21 -05009#include <filesystem>
10
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060011namespace phosphor
12{
13namespace dump
14{
15namespace bmc
16{
17template <typename T>
Patrick Williams9b18bf22022-07-22 19:26:55 -050018using ServerObject = typename sdbusplus::server::object_t<T>;
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060019
Patrick Williams9b18bf22022-07-22 19:26:55 -050020using EntryIfaces = sdbusplus::server::object_t<
Dhruvaraj Subhashchandran860b8a32021-05-05 13:01:49 -050021 sdbusplus::xyz::openbmc_project::Dump::Entry::server::BMC>;
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060022
Asmitha Karunanithi74a1f392021-10-27 03:23:59 -050023using originatorTypes = sdbusplus::xyz::openbmc_project::Common::server::
24 OriginatedBy::OriginatorTypes;
25
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060026class 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 Subhashchandran860b8a32021-05-05 13:01:49 -050033class Entry :
34 virtual public EntryIfaces,
35 virtual public phosphor::dump::bmc_stored::Entry
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060036{
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 Subhashchandrana6ab8062020-10-29 15:29:10 -050053 * @param[in] status - status of the dump.
Asmitha Karunanithi74a1f392021-10-27 03:23:59 -050054 * @param[in] originatorId - Id of the originator of the dump
55 * @param[in] originatorType - Originator type
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060056 * @param[in] parent - The dump entry's parent.
57 */
Patrick Williams9b18bf22022-07-22 19:26:55 -050058 Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId,
Jayanth Othayoth3fc6df42021-04-08 03:45:24 -050059 uint64_t timeStamp, uint64_t fileSize,
60 const std::filesystem::path& file,
Asmitha Karunanithi74a1f392021-10-27 03:23:59 -050061 phosphor::dump::OperationStatus status, std::string originatorId,
62 originatorTypes originatorType, phosphor::dump::Manager& parent) :
Patrick Williams73f64072022-04-01 17:04:47 -050063 EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit),
Dhruvaraj Subhashchandran860b8a32021-05-05 13:01:49 -050064 phosphor::dump::bmc_stored::Entry(bus, objPath.c_str(), dumpId,
65 timeStamp, fileSize, file, status,
66 originatorId, originatorType, parent)
Dhruvaraj Subhashchandran2f8e2762021-02-11 07:22:35 -060067 {
68 // Emit deferred signal.
69 this->phosphor::dump::bmc::EntryIfaces::emit_object_added();
70 }
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060071};
72
73} // namespace bmc
74} // namespace dump
75} // namespace phosphor