xref: /openbmc/pldm/host-bmc/host_condition.hpp (revision 84b790cb)
1319ebb31SPavithra Barithaya #pragma once
2319ebb31SPavithra Barithaya 
3319ebb31SPavithra Barithaya #include "host-bmc/host_pdr_handler.hpp"
4319ebb31SPavithra Barithaya 
5319ebb31SPavithra Barithaya #include <sdbusplus/bus.hpp>
6319ebb31SPavithra Barithaya #include <sdbusplus/server/object.hpp>
7319ebb31SPavithra Barithaya #include <xyz/openbmc_project/Condition/HostFirmware/server.hpp>
8319ebb31SPavithra Barithaya 
9319ebb31SPavithra Barithaya namespace pldm
10319ebb31SPavithra Barithaya {
11319ebb31SPavithra Barithaya namespace dbus_api
12319ebb31SPavithra Barithaya {
13319ebb31SPavithra Barithaya 
14*84b790cbSPatrick Williams using HostIntf = sdbusplus::server::object_t<
15319ebb31SPavithra Barithaya     sdbusplus::xyz::openbmc_project::Condition::server::HostFirmware>;
16319ebb31SPavithra Barithaya 
17319ebb31SPavithra Barithaya class Host : public HostIntf
18319ebb31SPavithra Barithaya {
19319ebb31SPavithra Barithaya   public:
20319ebb31SPavithra Barithaya     Host() = delete;
21319ebb31SPavithra Barithaya     Host(const Host&) = delete;
22319ebb31SPavithra Barithaya     Host& operator=(const Host&) = delete;
23319ebb31SPavithra Barithaya     Host(Host&&) = delete;
24319ebb31SPavithra Barithaya     Host& operator=(Host&&) = delete;
25319ebb31SPavithra Barithaya     virtual ~Host() = default;
26319ebb31SPavithra Barithaya 
Host(sdbusplus::bus_t & bus,const std::string & path)27*84b790cbSPatrick Williams     Host(sdbusplus::bus_t& bus, const std::string& path) :
28319ebb31SPavithra Barithaya         HostIntf(bus, path.c_str()){};
29319ebb31SPavithra Barithaya 
30319ebb31SPavithra Barithaya     /** @brief Override reads to CurrentFirmwareCondition */
31319ebb31SPavithra Barithaya     FirmwareCondition currentFirmwareCondition() const override;
32319ebb31SPavithra Barithaya 
33319ebb31SPavithra Barithaya     /** @brief Store shared pointer to host PDR instance */
setHostPdrObj(std::shared_ptr<HostPDRHandler> obj)34319ebb31SPavithra Barithaya     void setHostPdrObj(std::shared_ptr<HostPDRHandler> obj)
35319ebb31SPavithra Barithaya     {
36319ebb31SPavithra Barithaya         hostPdrObj = obj;
37319ebb31SPavithra Barithaya     }
38319ebb31SPavithra Barithaya 
39319ebb31SPavithra Barithaya   private:
40319ebb31SPavithra Barithaya     std::shared_ptr<HostPDRHandler> hostPdrObj;
41319ebb31SPavithra Barithaya };
42319ebb31SPavithra Barithaya } // namespace dbus_api
43319ebb31SPavithra Barithaya } // namespace pldm
44