Publish BMC position on DBus

For RBMC prototype systems, the BMC position needs to be determined
because some services run only on the active BMC.

This commit adds a stub API to detect whether the system is an RBMC
prototype. If it is, the BMC position is published on DBus based on
Motherboard VPD EEPROM access.

Change-Id: I38b9f6b5d1ba4e840ad98208c7983fc650d0735b
Signed-off-by: Anupama B R <anupama.b.r1@ibm.com>
diff --git a/vpd-manager/oem-handler/ibm_handler.cpp b/vpd-manager/oem-handler/ibm_handler.cpp
index ed6da47..fdd4e5a 100644
--- a/vpd-manager/oem-handler/ibm_handler.cpp
+++ b/vpd-manager/oem-handler/ibm_handler.cpp
@@ -413,6 +413,22 @@
             m_sysCfgJsonObj = m_worker->getSysCfgJsonObj();
         }
 
+        // Update BMC postion for RBMC prototype system
+        // Ignore BMC position update in case of any error
+        uint16_t l_errCode = 0;
+        if (isRbmcProtoTypeSystem(l_errCode) && l_errCode == 0)
+        {
+            size_t l_rbmcPosition = constants::VALUE_1;
+            if (isMotherboardEepromAccessible())
+            {
+                l_rbmcPosition = constants::VALUE_0;
+            }
+
+            (void)l_rbmcPosition;
+            // ToDo: Create Object interface map for position property and
+            // publish it on DBus.
+        }
+
         // Enable all mux which are used for connecting to the i2c on the
         // pcie slots for pcie cards. These are not enabled by kernel due to
         // an issue seen with Castello cards, where the i2c line hangs on a
@@ -446,4 +462,24 @@
     m_worker->collectFrusFromJson();
     SetTimerToDetectVpdCollectionStatus();
 }
+
+bool IbmHandler::isRbmcProtoTypeSystem(
+    [[maybe_unused]] uint16_t& o_errCode) const noexcept
+{
+    // TODO:
+    // Parse the system VPD from EEPROM.
+    // Check the IM keyword value. If the IM value indicates an RBMC prototype
+    // system, return true otherwise false.
+    // In case of any error or IM value not found in the map, set error code and
+    // return false.
+
+    return false;
+}
+
+bool IbmHandler::isMotherboardEepromAccessible() const noexcept
+{
+    // TODO: Check whether the motherboard EEPROM is accessible.
+
+    return false;
+}
 } // namespace vpd
diff --git a/vpd-manager/oem-handler/ibm_handler.hpp b/vpd-manager/oem-handler/ibm_handler.hpp
index 73ae2e1..6a79133 100644
--- a/vpd-manager/oem-handler/ibm_handler.hpp
+++ b/vpd-manager/oem-handler/ibm_handler.hpp
@@ -120,6 +120,26 @@
      */
     void enableMuxChips();
 
+    /**
+     * @brief Checks whether the system is an RBMC prototype.
+     *
+     * @param[out] o_errCode - To set error code in case of error.
+     *
+     * @return true for RBMC prototype system, false otherwise.
+     */
+    bool isRbmcProtoTypeSystem(
+        [[maybe_unused]] uint16_t& o_errCode) const noexcept;
+
+    /**
+     * @brief Checks whether the motherboard EEPROM is accessible.
+     *
+     * This function is used to update the BMC position for the RBMC prototype
+     * system based on whether the motherboard EEPROM can be accessed.
+     *
+     * @return true if able to access motherboard EEPROM, false otherwise.
+     */
+    bool isMotherboardEepromAccessible() const noexcept;
+
     // Parsed system config json object.
     nlohmann::json m_sysCfgJsonObj{};