Use the lower camel case of the C++ standard
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ied901f0cc7cc6606e199dad0e31a35f838c32ab9
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp
index dca07a1..e6b6a61 100644
--- a/fault-monitor/fru-fault-monitor.cpp
+++ b/fault-monitor/fru-fault-monitor.cpp
@@ -19,13 +19,12 @@
using namespace phosphor::logging;
-constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
-constexpr auto MAPPER_OBJ_PATH = "/xyz/openbmc_project/object_mapper";
-constexpr auto MAPPER_IFACE = "xyz.openbmc_project.ObjectMapper";
-constexpr auto OBJMGR_IFACE = "org.freedesktop.DBus.ObjectManager";
-constexpr auto LED_GROUPS = "/xyz/openbmc_project/led/groups/";
-constexpr auto LOG_PATH = "/xyz/openbmc_project/logging";
-constexpr auto LOG_IFACE = "xyz.openbmc_project.Logging.Entry";
+static constexpr auto mapperBusName = "xyz.openbmc_project.ObjectMapper";
+static constexpr auto mapperObjPath = "/xyz/openbmc_project/object_mapper";
+static constexpr auto mapperIntf = "xyz.openbmc_project.ObjectMapper";
+static constexpr auto objMgrIntf = "org.freedesktop.DBus.ObjectManager";
+static constexpr auto ledGroups = "/xyz/openbmc_project/led/groups/";
+static constexpr auto logIntf = "xyz.openbmc_project.Logging.Entry";
using AssociationList =
std::vector<std::tuple<std::string, std::string, std::string>>;
@@ -49,9 +48,9 @@
std::string getService(sdbusplus::bus_t& bus, const std::string& path)
{
- auto mapper = bus.new_method_call(MAPPER_BUSNAME, MAPPER_OBJ_PATH,
- MAPPER_IFACE, "GetObject");
- mapper.append(path.c_str(), std::vector<std::string>({OBJMGR_IFACE}));
+ auto mapper = bus.new_method_call(mapperBusName, mapperObjPath, mapperIntf,
+ "GetObject");
+ mapper.append(path.c_str(), std::vector<std::string>({objMgrIntf}));
std::unordered_map<std::string, std::vector<std::string>> mapperResponse;
try
@@ -82,7 +81,7 @@
std::string service;
try
{
- std::string groups{LED_GROUPS};
+ std::string groups{ledGroups};
groups.pop_back();
service = getService(bus, groups);
}
@@ -103,7 +102,7 @@
}
auto unit = path.substr(pos + 1);
- std::string ledPath = LED_GROUPS + unit + '_' + LED_FAULT;
+ std::string ledPath = ledGroups + unit + '_' + LED_FAULT;
auto method = bus.new_method_call(service.c_str(), ledPath.c_str(),
"org.freedesktop.DBus.Properties", "Set");
@@ -187,11 +186,11 @@
void getLoggingSubTree(sdbusplus::bus_t& bus, MapperResponseType& subtree)
{
auto depth = 0;
- auto mapperCall = bus.new_method_call(MAPPER_BUSNAME, MAPPER_OBJ_PATH,
- MAPPER_IFACE, "GetSubTree");
+ auto mapperCall = bus.new_method_call(mapperBusName, mapperObjPath,
+ mapperIntf, "GetSubTree");
mapperCall.append("/");
mapperCall.append(depth);
- mapperCall.append(std::vector<Interface>({LOG_IFACE}));
+ mapperCall.append(std::vector<Interface>({logIntf}));
try
{
diff --git a/manager/lamptest/lamptest.cpp b/manager/lamptest/lamptest.cpp
index d90fc8a..a70f89c 100644
--- a/manager/lamptest/lamptest.cpp
+++ b/manager/lamptest/lamptest.cpp
@@ -22,7 +22,7 @@
// Physical LEDs will be updated during lamp test
for (const auto& it : ledsDeAssert)
{
- std::string path = std::string(PHY_LED_PATH) + it.name;
+ std::string path = std::string(phyLedPath) + it.name;
auto iter = std::find_if(
forceUpdateLEDs.begin(), forceUpdateLEDs.end(),
[&path](const auto& name) { return name == path; });
@@ -36,7 +36,7 @@
for (const auto& it : ledsAssert)
{
- std::string path = std::string(PHY_LED_PATH) + it.name;
+ std::string path = std::string(phyLedPath) + it.name;
auto iter = std::find_if(
forceUpdateLEDs.begin(), forceUpdateLEDs.end(),
[&path](const auto& name) { return name == path; });
@@ -137,7 +137,7 @@
uint8_t dutyOn{};
try
{
- auto properties = dBusHandler.getAllProperties(path, PHY_LED_IFACE);
+ auto properties = dBusHandler.getAllProperties(path, phyLedIntf);
state = std::get<std::string>(properties["State"]);
period = std::get<uint16_t>(properties["Period"]);
@@ -174,14 +174,13 @@
// Get paths of all the Physical LED objects
try
{
- physicalLEDPaths = dBusHandler.getSubTreePaths(PHY_LED_PATH,
- PHY_LED_IFACE);
+ physicalLEDPaths = dBusHandler.getSubTreePaths(phyLedPath, phyLedIntf);
}
catch (const sdbusplus::exception_t& e)
{
lg2::error(
"Failed to call the SubTreePaths method: {ERROR}, ledPath: {PATH}, ledInterface: {INTERFACE}",
- "ERROR", e, "PATH", PHY_LED_PATH, "INTERFACE", PHY_LED_IFACE);
+ "ERROR", e, "PATH", phyLedPath, "INTERFACE", phyLedIntf);
return;
}
@@ -292,11 +291,11 @@
const std::vector<std::string> empty{};
auto forceLEDs = json.value("forceLEDs", empty);
std::ranges::transform(forceLEDs, std::back_inserter(forceUpdateLEDs),
- [](const auto& i) { return PHY_LED_PATH + i; });
+ [](const auto& i) { return phyLedPath + i; });
auto skipLEDs = json.value("skipLEDs", empty);
std::ranges::transform(skipLEDs, std::back_inserter(skipUpdateLEDs),
- [](const auto& i) { return PHY_LED_PATH + i; });
+ [](const auto& i) { return phyLedPath + i; });
}
catch (const std::exception& e)
{
diff --git a/manager/manager.cpp b/manager/manager.cpp
index 12f507a..6d8bdb8 100644
--- a/manager/manager.cpp
+++ b/manager/manager.cpp
@@ -123,7 +123,7 @@
{
for (const auto& it : ledsDeAssert)
{
- std::string objPath = std::string(PHY_LED_PATH) + it.name;
+ std::string objPath = std::string(phyLedPath) + it.name;
lg2::debug("De-Asserting LED, NAME = {NAME}", "NAME", it.name);
drivePhysicalLED(objPath, Layout::Action::Off, it.dutyOn,
it.period);
@@ -134,7 +134,7 @@
{
for (const auto& it : ledsAssert)
{
- std::string objPath = std::string(PHY_LED_PATH) + it.name;
+ std::string objPath = std::string(phyLedPath) + it.name;
lg2::debug("Asserting LED, NAME = {NAME}", "NAME", it.name);
drivePhysicalLED(objPath, it.action, it.dutyOn, it.period);
}
@@ -155,14 +155,12 @@
PropertyValue dutyOnValue{dutyOn};
PropertyValue periodValue{period};
- dBusHandler.setProperty(objPath, PHY_LED_IFACE, "DutyOn",
- dutyOnValue);
- dBusHandler.setProperty(objPath, PHY_LED_IFACE, "Period",
- periodValue);
+ dBusHandler.setProperty(objPath, phyLedIntf, "DutyOn", dutyOnValue);
+ dBusHandler.setProperty(objPath, phyLedIntf, "Period", periodValue);
}
PropertyValue actionValue{getPhysicalAction(action)};
- dBusHandler.setProperty(objPath, PHY_LED_IFACE, "State", actionValue);
+ dBusHandler.setProperty(objPath, phyLedIntf, "State", actionValue);
}
catch (const std::exception& e)
{
diff --git a/manager/manager.hpp b/manager/manager.hpp
index ac00d76..d8573b6 100644
--- a/manager/manager.hpp
+++ b/manager/manager.hpp
@@ -13,8 +13,8 @@
{
using namespace phosphor::led::utils;
-static constexpr auto PHY_LED_PATH = "/xyz/openbmc_project/led/physical/";
-static constexpr auto PHY_LED_IFACE = "xyz.openbmc_project.Led.Physical";
+static constexpr auto phyLedPath = "/xyz/openbmc_project/led/physical/";
+static constexpr auto phyLedIntf = "xyz.openbmc_project.Led.Physical";
/** @class Manager
* @brief Manages group of LEDs and applies action on the elements of group
diff --git a/utils.cpp b/utils.cpp
index 1176d9a..7b20ee1 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -18,8 +18,8 @@
auto& bus = DBusHandler::getBus();
- auto mapper = bus.new_method_call(MAPPER_BUSNAME, MAPPER_OBJ_PATH,
- MAPPER_IFACE, "GetObject");
+ auto mapper = bus.new_method_call(mapperBusName, mapperObjPath, mapperIntf,
+ "GetObject");
mapper.append(path, InterfaceList({interface}));
auto mapperResponseMsg = bus.call(mapper);
@@ -51,7 +51,7 @@
}
auto method = bus.new_method_call(service.c_str(), objectPath.c_str(),
- DBUS_PROPERTY_IFACE, "GetAll");
+ proIntf, "GetAll");
method.append(interface);
auto reply = bus.call(method);
@@ -76,7 +76,7 @@
}
auto method = bus.new_method_call(service.c_str(), objectPath.c_str(),
- DBUS_PROPERTY_IFACE, "Get");
+ proIntf, "Get");
method.append(interface, propertyName);
auto reply = bus.call(method);
@@ -99,7 +99,7 @@
}
auto method = bus.new_method_call(service.c_str(), objectPath.c_str(),
- DBUS_PROPERTY_IFACE, "Set");
+ proIntf, "Set");
method.append(interface.c_str(), propertyName.c_str(), value);
bus.call_noreply(method);
@@ -113,8 +113,8 @@
auto& bus = DBusHandler::getBus();
- auto method = bus.new_method_call(MAPPER_BUSNAME, MAPPER_OBJ_PATH,
- MAPPER_IFACE, "GetSubTreePaths");
+ auto method = bus.new_method_call(mapperBusName, mapperObjPath, mapperIntf,
+ "GetSubTreePaths");
method.append(objectPath.c_str());
method.append(0); // Depth 0 to search all
method.append(std::vector<std::string>({interface.c_str()}));
diff --git a/utils.hpp b/utils.hpp
index afc5120..72e70e3 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -9,10 +9,10 @@
{
namespace utils
{
-constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
-constexpr auto MAPPER_OBJ_PATH = "/xyz/openbmc_project/object_mapper";
-constexpr auto MAPPER_IFACE = "xyz.openbmc_project.ObjectMapper";
-constexpr auto DBUS_PROPERTY_IFACE = "org.freedesktop.DBus.Properties";
+static constexpr auto mapperBusName = "xyz.openbmc_project.ObjectMapper";
+static constexpr auto mapperObjPath = "/xyz/openbmc_project/object_mapper";
+static constexpr auto mapperIntf = "xyz.openbmc_project.ObjectMapper";
+static constexpr auto proIntf = "org.freedesktop.DBus.Properties";
// The value of the property(type: variant, contains some basic types)
// Eg: uint8_t : dutyOn, uint16_t : Period, std::string : Name,