1b49b7d80SGeorge Liu #pragma once 2b49b7d80SGeorge Liu 3b49b7d80SGeorge Liu #include "pldmd/dbus_impl_pdr.hpp" 4b49b7d80SGeorge Liu #include "pldmd/dbus_impl_requester.hpp" 5b49b7d80SGeorge Liu #include "requester/handler.hpp" 6b49b7d80SGeorge Liu 7b49b7d80SGeorge Liu #include <sdbusplus/server/object.hpp> 8b49b7d80SGeorge Liu #include <xyz/openbmc_project/Led/Group/server.hpp> 9b49b7d80SGeorge Liu 10b49b7d80SGeorge Liu #include <string> 11b49b7d80SGeorge Liu 12b49b7d80SGeorge Liu using namespace pldm::dbus_api; 13b49b7d80SGeorge Liu 14b49b7d80SGeorge Liu namespace pldm 15b49b7d80SGeorge Liu { 16b49b7d80SGeorge Liu namespace led 17b49b7d80SGeorge Liu { 18b49b7d80SGeorge Liu 19b49b7d80SGeorge Liu using LEDGroupObj = sdbusplus::server::object_t< 20b49b7d80SGeorge Liu sdbusplus::xyz::openbmc_project::Led::server::Group>; 21b49b7d80SGeorge Liu 22b49b7d80SGeorge Liu class HostLampTestInterfaces 23b49b7d80SGeorge Liu { 24b49b7d80SGeorge Liu public: ~HostLampTestInterfaces()25b49b7d80SGeorge Liu virtual ~HostLampTestInterfaces() {} 26b49b7d80SGeorge Liu 27b49b7d80SGeorge Liu virtual uint16_t getEffecterID() = 0; 28b49b7d80SGeorge Liu virtual uint8_t setHostStateEffecter(uint16_t effecterID) = 0; 29b49b7d80SGeorge Liu }; 30b49b7d80SGeorge Liu 31b49b7d80SGeorge Liu /** @class HostLampTest 32b49b7d80SGeorge Liu * @brief Manages group of Host lamp test LEDs 33b49b7d80SGeorge Liu */ 34b49b7d80SGeorge Liu class HostLampTest : public HostLampTestInterfaces, public LEDGroupObj 35b49b7d80SGeorge Liu { 36b49b7d80SGeorge Liu public: 37b49b7d80SGeorge Liu HostLampTest() = delete; 38b49b7d80SGeorge Liu ~HostLampTest() = default; 39b49b7d80SGeorge Liu HostLampTest(const HostLampTest&) = delete; 40b49b7d80SGeorge Liu HostLampTest& operator=(const HostLampTest&) = delete; 41b49b7d80SGeorge Liu HostLampTest(HostLampTest&&) = delete; 42b49b7d80SGeorge Liu HostLampTest& operator=(HostLampTest&&) = delete; 43b49b7d80SGeorge Liu 44b49b7d80SGeorge Liu /** @brief Constructs LED Group 45b49b7d80SGeorge Liu * 46b49b7d80SGeorge Liu * @param[in] bus - Handle to system dbus 47b49b7d80SGeorge Liu * @param[in] objPath - The D-Bus path that hosts LED group 48b49b7d80SGeorge Liu * @param[in] mctp_fd - MCTP file descriptor 49b49b7d80SGeorge Liu * @param[in] mctp_eid - MCTP EID 50b49b7d80SGeorge Liu * @param[in] instanceIdDb - InstanceIdDb object to obtain instance id 51b49b7d80SGeorge Liu * @param[in] repo - pointer to BMC's primary PDR repo 52b49b7d80SGeorge Liu * @param[in] handler - PLDM request handler 53b49b7d80SGeorge Liu */ HostLampTest(sdbusplus::bus_t & bus,const std::string & objPath,uint8_t mctp_eid,pldm::InstanceIdDb & instanceIdDb,pldm_pdr * repo,pldm::requester::Handler<pldm::requester::Request> * handler)54b49b7d80SGeorge Liu HostLampTest(sdbusplus::bus_t& bus, const std::string& objPath, 55b49b7d80SGeorge Liu uint8_t mctp_eid, pldm::InstanceIdDb& instanceIdDb, 56b49b7d80SGeorge Liu pldm_pdr* repo, 57b49b7d80SGeorge Liu pldm::requester::Handler<pldm::requester::Request>* handler) : 58*16c2a0a0SPatrick Williams LEDGroupObj(bus, objPath.c_str()), path(objPath), mctp_eid(mctp_eid), 59*16c2a0a0SPatrick Williams instanceIdDb(instanceIdDb), pdrRepo(repo), handler(handler) 60b49b7d80SGeorge Liu {} 61b49b7d80SGeorge Liu 62b49b7d80SGeorge Liu /** @brief Property SET Override function 63b49b7d80SGeorge Liu * 64b49b7d80SGeorge Liu * @param[in] value - True or False 65b49b7d80SGeorge Liu * @return - Success or exception thrown 66b49b7d80SGeorge Liu */ 67b49b7d80SGeorge Liu bool asserted(bool value) override; 68b49b7d80SGeorge Liu 69b49b7d80SGeorge Liu /** @brief Property GET Override function 70b49b7d80SGeorge Liu * 71b49b7d80SGeorge Liu * @return - True or False 72b49b7d80SGeorge Liu */ 73b49b7d80SGeorge Liu bool asserted() const override; 74b49b7d80SGeorge Liu 75b49b7d80SGeorge Liu /** @brief Get effecterID from PDRs. 76b49b7d80SGeorge Liu * 77b49b7d80SGeorge Liu * @return effecterID 78b49b7d80SGeorge Liu */ 79b49b7d80SGeorge Liu uint16_t getEffecterID() override; 80b49b7d80SGeorge Liu 81b49b7d80SGeorge Liu /** @brief Set state effecter states to PHYP. 82b49b7d80SGeorge Liu * 83b49b7d80SGeorge Liu * @param[in] effecterID - effecterID 84b49b7d80SGeorge Liu * 85b49b7d80SGeorge Liu * @return rc - PLDM completion codes 86b49b7d80SGeorge Liu */ 87b49b7d80SGeorge Liu uint8_t setHostStateEffecter(uint16_t effecterID) override; 88b49b7d80SGeorge Liu 89b49b7d80SGeorge Liu private: 90b49b7d80SGeorge Liu /** @brief Path of the group instance */ 91b49b7d80SGeorge Liu std::string path; 92b49b7d80SGeorge Liu 93b49b7d80SGeorge Liu /** @brief MCTP EID of host firmware */ 94b49b7d80SGeorge Liu uint8_t mctp_eid; 95b49b7d80SGeorge Liu 96b49b7d80SGeorge Liu /** @brief Reference to the InstanceIdDb object to obtain instance id 97b49b7d80SGeorge Liu */ 98b49b7d80SGeorge Liu pldm::InstanceIdDb& instanceIdDb; 99b49b7d80SGeorge Liu 100b49b7d80SGeorge Liu /** @brief pointer to BMC's primary PDR repo */ 101b49b7d80SGeorge Liu const pldm_pdr* pdrRepo; 102b49b7d80SGeorge Liu 103b49b7d80SGeorge Liu /** @brief Effecter ID */ 104b49b7d80SGeorge Liu uint16_t effecterID = 0; 105b49b7d80SGeorge Liu 106b49b7d80SGeorge Liu /** @brief PLDM request handler */ 107b49b7d80SGeorge Liu pldm::requester::Handler<pldm::requester::Request>* handler; 108b49b7d80SGeorge Liu }; 109b49b7d80SGeorge Liu 110b49b7d80SGeorge Liu } // namespace led 111b49b7d80SGeorge Liu } // namespace pldm 112