blob: eaeefc74ab51d76f2452c2596f60056b9f0d0012 [file] [log] [blame]
Thang Tranba2241c2021-10-26 17:47:09 +07001#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
9namespace phosphor
10{
11namespace condition
12{
13
14using HostIntf = sdbusplus::server::object::object<
15 sdbusplus::xyz::openbmc_project::Condition::server::HostFirmware>;
16
17class 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