LEDS: Get the service names for all physical LED dbus paths at once
Previous code made a call to get the service name for every physical
LED and that was a little costly. This patch changes it to get the
service names of all the physical LED dbus paths and uses it.
This is done everytime a group of LEDs are to be manipulated.
Fixes openbmc/phosphor-led-manager#4
Change-Id: I5ce455f683a38eae7f9b383013f5729ec7dd7fae
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/manager.hpp b/manager.hpp
index 4adb229..1a75f8c 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -85,6 +85,9 @@
/** @brief sdbusplus handler */
sdbusplus::bus::bus& bus;
+ /** Map of physical LED path to service name */
+ std::map<std::string, std::string> phyLeds {};
+
/** @brief Pointers to groups that are in asserted state */
std::set<const group*> assertedGroups;
@@ -138,15 +141,8 @@
return;
}
- /** @brief Finds the service name given a dbus object path and interface
- *
- * @param[in] objPath - dbus object path
- * @param[in] interface - dbus interface
- *
- * @return: Service name or none
- */
- std::string getServiceName(const std::string& objPath,
- const std::string& interface) const;
+ /** @brief Populates map of Physical LED paths to service name */
+ void populateObjectMap();
};
} // namespace led