sensor: Implement sensor "PRIORITY"
This commit introduces the `xyz.openbmc_project.Common.Priority`
interface to define the priority of sensors. If a sensor's priority
attribute is specified, this interface is created with the 'priority'
attribute. However, if the priority attribute is not specified, this
interface is not created.
The `xyz.openbmc_project.Common.Priority` interface is used to indicate
the priority level of fan sensors. It provides information about
primary and secondary RPM sensors for dual rotor fans, allowing for a
more specific description of the sensor's priority.
phosphor-dbus-interfaces commit:
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/66779
Tested: Build phosphor-hwmon successfully
'''
1. Retrieve the priority level of the secondary sensor
busctl introspect xyz.openbmc_project.Hwmon-xxx .Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_1 xyz.openbmc_project.Common.Priority
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Priority property u 1 emits-change writable
2. If the "PRIORITY" is not specified in the sensor's configuration file
busctl introspect xyz.openbmc_project.Hwmon-xxx .Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_0 xyz.openbmc_project.Common.Priority
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
3. Change the sensor priority
busctl set-property xyz.openbmc_project.Hwmon-xxx.Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_1 xyz.openbmc_project.Common.Priority \
Priority u 0
busctl introspect xyz.openbmc_project.Hwmon-xxx .Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_1 xyz.openbmc_project.Common.Priority
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Priority property u 0 emits-change writable
'''
Change-Id: I7a226cf105756bc32e04f6724428d93e84dfb72a
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
diff --git a/mainloop.hpp b/mainloop.hpp
index cc8de94..6ce02a2 100644
--- a/mainloop.hpp
+++ b/mainloop.hpp
@@ -25,7 +25,9 @@
static constexpr auto sensorID = 0;
static constexpr auto sensorLabel = 1;
static constexpr auto sensorAccuracy = 2;
-using SensorIdentifiers = std::tuple<std::string, std::string, std::string>;
+static constexpr auto sensorPriority = 3;
+using SensorIdentifiers =
+ std::tuple<std::string, std::string, std::string, std::string>;
/** @class MainLoop
* @brief hwmon-readd main application loop.