1 #pragma once 2 #include "common/utils.hpp" 3 #include "pldmd/handler.hpp" 4 5 #include <phosphor-logging/lg2.hpp> 6 7 PHOSPHOR_LOG2_USING; 8 9 namespace pldm 10 { 11 namespace responder 12 { 13 14 namespace platform_config 15 { 16 using namespace pldm::utils; 17 18 static constexpr auto compatibleInterface = 19 "xyz.openbmc_project.Inventory.Decorator.Compatible"; 20 static constexpr auto namesProperty = "Names"; 21 22 using SystemTypeCallback = std::function<void(const std::string&, bool)>; 23 24 class Handler : public CmdHandler 25 { 26 public: 27 Handler() 28 { 29 systemCompatibleMatchCallBack = 30 std::make_unique<sdbusplus::bus::match_t>( 31 pldm::utils::DBusHandler::getBus(), 32 sdbusplus::bus::match::rules::interfacesAdded() + 33 sdbusplus::bus::match::rules::sender( 34 "xyz.openbmc_project.EntityManager"), 35 std::bind(&Handler::systemCompatibleCallback, this, 36 std::placeholders::_1)); 37 sysTypeCallback = nullptr; 38 } 39 40 /** @brief Interface to get the system type information using Dbus query 41 * 42 * @return - the system type information 43 */ 44 virtual std::optional<std::filesystem::path> getPlatformName(); 45 46 /** @brief D-Bus Interface added signal match for Entity Manager */ 47 void systemCompatibleCallback(sdbusplus::message_t& msg); 48 49 /** @brief Registers the callback from other objects */ 50 void registerSystemTypeCallback(SystemTypeCallback callback); 51 52 private: 53 /** @brief system type/model */ 54 std::string systemType; 55 56 /** @brief D-Bus Interface added signal match for Entity Manager */ 57 std::unique_ptr<sdbusplus::bus::match_t> systemCompatibleMatchCallBack; 58 59 /** @brief Registered Callback */ 60 SystemTypeCallback sysTypeCallback; 61 }; 62 63 } // namespace platform_config 64 65 } // namespace responder 66 67 } // namespace pldm 68