Remove Configuration interface prefix from utils APIs
This eliminates some repetitive verbosity from daemons that handle a lot
of different sensor types (such as hwmontempsensor and psusensor). It
also positions us to more cleanly use a single data structure for both
existing APIs like GetSensorConfiguration() and
setupPropertiesChangedMatches(), as well as upcoming I2C
device-management support.
Tested: hwmontempsensor and adcsensor on romed8hm3 continue to behave as
they did previously.
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I9d80475ca4160c8d2ff0afab942709496d51238d
diff --git a/src/MCUTempSensor.cpp b/src/MCUTempSensor.cpp
index 8c96154..47893d2 100644
--- a/src/MCUTempSensor.cpp
+++ b/src/MCUTempSensor.cpp
@@ -39,8 +39,7 @@
constexpr const bool debug = false;
-constexpr const char* configInterface =
- "xyz.openbmc_project.Configuration.MCUTempSensor";
+constexpr const char* sensorType = "MCUTempSensor";
static constexpr double mcuTempMaxReading = 0xFF;
static constexpr double mcuTempMinReading = 0;
@@ -55,8 +54,7 @@
uint8_t busId, uint8_t mcuAddress,
uint8_t tempReg) :
Sensor(escapeName(sensorName), std::move(thresholdData),
- sensorConfiguration,
- "xyz.openbmc_project.Configuration.MCUTempSensor", false, false,
+ sensorConfiguration, "MCUTempSensor", false, false,
mcuTempMaxReading, mcuTempMinReading, conn),
busId(busId), mcuAddress(mcuAddress), tempReg(tempReg),
objectServer(objectServer), waitTimer(io)
@@ -210,7 +208,7 @@
{
for (const auto& [intf, cfg] : interfaces)
{
- if (intf != configInterface)
+ if (intf != configInterfaceName(sensorType))
{
continue;
}
@@ -292,8 +290,7 @@
std::vector<std::unique_ptr<sdbusplus::bus::match_t>> matches =
setupPropertiesChangedMatches(
- *systemBus, std::to_array<const char*>({configInterface}),
- eventHandler);
+ *systemBus, std::to_array<const char*>({sensorType}), eventHandler);
setupManufacturingModeMatch(*systemBus);
io.run();
return 0;