blob: 441611d00f8616d9a3f4a69198228f8f7824849e [file] [log] [blame]
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -05001#pragma once
2
3#include "dump_manager.hpp"
4#include "dump_utils.hpp"
5#include "xyz/openbmc_project/Dump/NewDump/server.hpp"
6
7#include <sdbusplus/bus.hpp>
8#include <sdbusplus/server/object.hpp>
Dhruvaraj Subhashchandran7040bce2020-09-16 00:50:19 -05009#include <xyz/openbmc_project/Dump/Create/server.hpp>
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050010
11namespace phosphor
12{
13namespace dump
14{
15namespace system
16{
17
18using NotifyIface = sdbusplus::server::object::object<
Dhruvaraj Subhashchandran7040bce2020-09-16 00:50:19 -050019 sdbusplus::xyz::openbmc_project::Dump::server::Create,
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050020 sdbusplus::xyz::openbmc_project::Dump::server::NewDump>;
21
22/** @class Manager
23 * @brief System Dump manager implementation.
24 * @details A concrete implementation for the
25 * xyz.openbmc_project.Dump.Notify DBus API
26 */
27class Manager : virtual public NotifyIface,
28 virtual public phosphor::dump::Manager
29{
30 public:
31 Manager() = delete;
32 Manager(const Manager&) = default;
33 Manager& operator=(const Manager&) = delete;
34 Manager(Manager&&) = delete;
35 Manager& operator=(Manager&&) = delete;
36 virtual ~Manager() = default;
37
38 /** @brief Constructor to put object onto bus at a dbus path.
39 * @param[in] bus - Bus to attach to.
40 * @param[in] event - Dump manager sd_event loop.
41 * @param[in] path - Path to attach at.
42 * @param[in] baseEntryPath - Base path of the dump entry.
43 */
44 Manager(sdbusplus::bus::bus& bus, const char* path,
45 const std::string& baseEntryPath) :
46 NotifyIface(bus, path),
47 phosphor::dump::Manager(bus, path, baseEntryPath)
48 {
49 }
50
51 void restore() override
52 {
53 // TODO #2597 Implement the restore to restore the dump entries
54 // after the service restart.
55 }
56
57 /** @brief Notify the system dump manager about creation of a new dump.
58 * @param[in] dumpType - Type of the Dump.
59 * @param[in] dumpId - Id from the source of the dump.
60 * @param[in] size - Size of the dump.
61 */
62 void notify(NewDump::DumpType dumpType, uint32_t dumpId,
63 uint64_t size) override;
Dhruvaraj Subhashchandran7040bce2020-09-16 00:50:19 -050064
65 /** @brief Implementation for CreateDump
66 * Method to create Dump.
67 *
68 * @return id - The Dump entry id number.
69 */
70 uint32_t createDump() override;
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050071};
72
73} // namespace system
74} // namespace dump
75} // namespace phosphor