PLDM: Implement host-condition interface

This commit implements the PDI interface defined at
https://gerrit.openbmc-project.xyz/c/openbmc
/phosphor-dbus-interfaces/+/42435

pldmd hosts the new xyz.openbmc_project.Condition.HostFirmware interface
so it's difficult for it to have other code within pldmd to also set
this during startup.

The solution proposed in this commit is to provide the hostPDRHandler
object to the HostFirmware interface implementation. This then allows
reads of the HostFirmware property to just ask the hostPDRHandler for
the current state of the host.

Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>
Change-Id: I3f7d4f573332e96fcd3ae594dc25750070cd6e62
diff --git a/host-bmc/host_condition.cpp b/host-bmc/host_condition.cpp
new file mode 100644
index 0000000..2bdcb36
--- /dev/null
+++ b/host-bmc/host_condition.cpp
@@ -0,0 +1,24 @@
+#include "host_condition.hpp"
+
+namespace pldm
+{
+namespace dbus_api
+{
+
+Host::FirmwareCondition Host::currentFirmwareCondition() const
+{
+    bool hostRunning = false;
+
+    if (hostPdrObj != nullptr)
+    {
+        hostRunning = hostPdrObj.get()->isHostUp();
+    }
+
+    auto value = hostRunning ? Host::FirmwareCondition::Running
+                             : Host::FirmwareCondition::Off;
+
+    return value;
+}
+
+} // namespace dbus_api
+} // namespace pldm