Systems: Restore old-style LocationIndicatorActive

The commit 2eaa927 [1] altered the D-Bus associations used for setting
and getting the LED state for the Systems resource. Machines which use
entity-manager do not have the new association yet.

This commit is adding back the use of the old D-Bus method under a
compile option. This will be enabled by default until October 15, 2025
and completely removed by June 2026.

[1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/82078

Tested:
 - Built with option enabled and confirmed logging showed old method
   being used.
 - Built with option disabled and confirmed logging showed new method
   being used.

Change-Id: I271fc464ef512b742a8c85419668aa09d38e525d
Signed-off-by: Janet Adkins <janeta@us.ibm.com>
diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp
index 32e9725..b74dc4d 100644
--- a/redfish-core/lib/led.hpp
+++ b/redfish-core/lib/led.hpp
@@ -153,6 +153,96 @@
         });
 }
 
+/**
+ * @brief Retrieves identify system led group properties over dbus
+ *
+ * @param[in] asyncResp     Shared pointer for generating response message.
+ *
+ * @return None.
+ */
+inline void getSystemLocationIndicatorActive(
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+{
+    BMCWEB_LOG_DEBUG("Get LocationIndicatorActive");
+    dbus::utility::getProperty<bool>(
+        "xyz.openbmc_project.LED.GroupManager",
+        "/xyz/openbmc_project/led/groups/enclosure_identify_blink",
+        "xyz.openbmc_project.Led.Group", "Asserted",
+        [asyncResp](const boost::system::error_code& ec, const bool blinking) {
+            // Some systems may not have enclosure_identify_blink object so
+            // proceed to get enclosure_identify state.
+            if (ec == boost::system::errc::invalid_argument)
+            {
+                BMCWEB_LOG_DEBUG(
+                    "Get identity blinking LED failed, mismatch in property type");
+                messages::internalError(asyncResp->res);
+                return;
+            }
+
+            // Blinking ON, no need to check enclosure_identify assert.
+            if (!ec && blinking)
+            {
+                asyncResp->res.jsonValue["LocationIndicatorActive"] = true;
+                return;
+            }
+
+            dbus::utility::getProperty<bool>(
+                "xyz.openbmc_project.LED.GroupManager",
+                "/xyz/openbmc_project/led/groups/enclosure_identify",
+                "xyz.openbmc_project.Led.Group", "Asserted",
+                [asyncResp](const boost::system::error_code& ec2,
+                            const bool ledOn) {
+                    if (ec2 == boost::system::errc::invalid_argument)
+                    {
+                        BMCWEB_LOG_DEBUG(
+                            "Get enclosure identity led failed, mismatch in property type");
+                        messages::internalError(asyncResp->res);
+                        return;
+                    }
+
+                    if (ec2)
+                    {
+                        return;
+                    }
+
+                    asyncResp->res.jsonValue["LocationIndicatorActive"] = ledOn;
+                });
+        });
+}
+
+/**
+ * @brief Sets identify system led group properties
+ *
+ * @param[in] asyncResp     Shared pointer for generating response message.
+ * @param[in] ledState  LED state passed from request
+ *
+ * @return None.
+ */
+inline void setSystemLocationIndicatorActive(
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const bool ledState)
+{
+    BMCWEB_LOG_DEBUG("Set LocationIndicatorActive");
+
+    sdbusplus::asio::setProperty(
+        *crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager",
+        "/xyz/openbmc_project/led/groups/enclosure_identify_blink",
+        "xyz.openbmc_project.Led.Group", "Asserted", ledState,
+        [asyncResp, ledState](const boost::system::error_code& ec) {
+            if (ec)
+            {
+                // Some systems may not have enclosure_identify_blink object so
+                // lets set enclosure_identify state also if
+                // enclosure_identify_blink failed
+                setDbusProperty(
+                    asyncResp, "LocationIndicatorActive",
+                    "xyz.openbmc_project.LED.GroupManager",
+                    sdbusplus::message::object_path(
+                        "/xyz/openbmc_project/led/groups/enclosure_identify"),
+                    "xyz.openbmc_project.Led.Group", "Asserted", ledState);
+            }
+        });
+}
+
 inline void handleLedGroupSubtree(
     const std::string& objPath, const boost::system::error_code& ec,
     const dbus::utility::MapperGetSubTreeResponse& subtree,