1 #pragma once 2 3 #include <sdbusplus/server.hpp> 4 #include <xyz/openbmc_project/Common/FilePath/server.hpp> 5 6 #include <format> 7 #include <string> 8 9 namespace bios_bmc_smm_error_logger 10 { 11 12 using FileNotifierInterface = sdbusplus::server::object_t< 13 sdbusplus::xyz::openbmc_project::Common::server::FilePath>; 14 15 /** 16 * @brief A class for notifying file paths of CPER logs. 17 */ 18 class CperFileNotifier : public FileNotifierInterface 19 { 20 public: 21 /** 22 * @brief Constructor for the CperFileNotifier class. 23 * 24 * @param bus - bus to attach to. 25 * @param filePath - full path of the CPER log JSON file. 26 * @param entry - index of the DBus file path object. 27 */ CperFileNotifier(sdbusplus::bus_t & bus,const std::string & filePath,uint64_t entry)28 CperFileNotifier(sdbusplus::bus_t& bus, const std::string& filePath, 29 uint64_t entry) : 30 FileNotifierInterface(bus, generatePath(entry).c_str(), 31 action::emit_no_signals) 32 { 33 // We only need the interface added signal for the fault monitor. So 34 // stop emitting properties changed signal. 35 path(filePath, /*skipSignal=*/true); 36 } 37 38 static constexpr const char* cperBasePath = 39 "/xyz/openbmc_project/external_storer/bios_bmc_smm_error_logger/CPER"; 40 41 private: 42 /** 43 * @brief Generate a path for the CperFileNotifier DBus object. 44 * 45 * @param[in] entry - unique index for the DBus object. 46 */ generatePath(uint64_t entry)47 std::string generatePath(uint64_t entry) 48 { 49 return std::format("{}/entry{}", cperBasePath, entry); 50 } 51 }; 52 53 } // namespace bios_bmc_smm_error_logger 54