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/IpmbSensor.cpp b/src/IpmbSensor.cpp
index 9d087a7..7c5f965 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -36,8 +36,7 @@
constexpr const bool debug = false;
-constexpr const char* configInterface =
- "xyz.openbmc_project.Configuration.IpmbSensor";
+constexpr const char* sensorType = "IpmbSensor";
static constexpr double ipmbMaxReading = 0xFF;
static constexpr double ipmbMinReading = 0;
@@ -64,8 +63,8 @@
uint8_t deviceAddress, uint8_t hostSMbusIndex,
const float pollRate, std::string& sensorTypeName) :
Sensor(escapeName(sensorName), std::move(thresholdData),
- sensorConfiguration, "xyz.openbmc_project.Configuration.IpmbSensor",
- false, false, ipmbMaxReading, ipmbMinReading, conn, PowerState::on),
+ sensorConfiguration, "IpmbSensor", false, false, ipmbMaxReading,
+ ipmbMinReading, conn, PowerState::on),
deviceAddress(deviceAddress), hostSMbusIndex(hostSMbusIndex),
sensorPollMs(static_cast<int>(pollRate * 1000)), objectServer(objectServer),
waitTimer(io)
@@ -499,7 +498,7 @@
{
for (const auto& [intf, cfg] : interfaces)
{
- if (intf != configInterface)
+ if (intf != configInterfaceName(sensorType))
{
continue;
}
@@ -640,8 +639,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);
sdbusplus::bus::match_t powerChangeMatch(
static_cast<sdbusplus::bus_t&>(*systemBus),