Thang Tran | ba2241c | 2021-10-26 17:47:09 +0700 | [diff] [blame] | 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::object< |
| 15 | sdbusplus::xyz::openbmc_project::Condition::server::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 | virtual ~Host() = default; |
| 26 | |
| 27 | Host(sdbusplus::bus::bus& bus, const std::string& path, |
| 28 | const std::string& hostId) : |
| 29 | HostIntf(bus, path.c_str()), |
| 30 | lineName("host" + hostId) |
| 31 | { |
| 32 | scanGpioPin(); |
| 33 | }; |
| 34 | |
| 35 | /** @brief Override reads to CurrentFirmwareCondition */ |
| 36 | FirmwareCondition currentFirmwareCondition() const override; |
| 37 | |
| 38 | private: |
| 39 | std::string lineName; |
| 40 | bool isActHigh; |
| 41 | |
| 42 | /* |
| 43 | * Scan gpio pin to detect the name and active state |
| 44 | */ |
| 45 | void scanGpioPin(); |
| 46 | }; |
| 47 | } // namespace condition |
| 48 | } // namespace phosphor |