1 #pragma once 2 3 #include <sdbusplus/bus.hpp> 4 #include <sdbusplus/server/object.hpp> 5 #include <xyz/openbmc_project/Condition/HostFirmware/server.hpp> 6 7 #include <iostream> 8 9 namespace phosphor 10 { 11 namespace condition 12 { 13 14 using HostIntf = sdbusplus::server::object_t< 15 sdbusplus::server::xyz::openbmc_project::condition::HostFirmware>; 16 17 class Host : public HostIntf 18 { 19 public: 20 Host() = delete; 21 Host(const Host&) = delete; 22 Host& operator=(const Host&) = delete; 23 Host(Host&&) = delete; 24 Host& operator=(Host&&) = delete; 25 ~Host() override = default; 26 Host(sdbusplus::bus_t & bus,const std::string & path,const std::string & hostId)27 Host(sdbusplus::bus_t& bus, const std::string& path, 28 const std::string& hostId) : 29 HostIntf(bus, path.c_str()), lineName("host" + hostId) 30 { 31 scanGpioPin(); 32 }; 33 34 /** @brief Override reads to CurrentFirmwareCondition */ 35 FirmwareCondition currentFirmwareCondition() const override; 36 37 private: 38 std::string lineName; 39 bool isActHigh; 40 41 /* 42 * Scan gpio pin to detect the name and active state 43 */ 44 void scanGpioPin(); 45 }; 46 } // namespace condition 47 } // namespace phosphor 48