sensor-cache: Use async calls in get sensor reading
Use the async calls in ipmiSensorGetSensorReading() for cached sensors.
Note that the code was using sdbusplus::message as the parameter for the
getFunc(), now it could be simplified to ipmi::PropertyMap and unify the
two cases: property update callback and getting property.
Tested: Verify the ipmi sensor list works fine.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: If7afed410f794a5317b8d4b4965cac291a735d12
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index d502268..949b732 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -205,21 +205,8 @@
}
#else
std::optional<GetSensorResponse> assertion(uint8_t id, const Info& sensorInfo,
- sdbusplus::message::message& msg)
+ const PropertyMap& /*properties*/)
{
- auto type = msg.get_type();
- if (type == msgTypeSignal)
- {
- // This is signal callback
- std::string interfaceName;
- msg.read(interfaceName);
- if (interfaceName != sensorInfo.sensorInterface)
- {
- // Not the interface we need
- return {};
- }
- }
-
// The assertion may contain multiple properties
// So we have to get the properties from DBus anyway
auto response = mapDbusToAssertion(sensorInfo, sensorInfo.sensorPath,
@@ -234,21 +221,8 @@
}
std::optional<GetSensorResponse> eventdata2(uint8_t id, const Info& sensorInfo,
- sdbusplus::message::message& msg)
+ const PropertyMap& /*properties*/)
{
- auto type = msg.get_type();
- if (type == msgTypeSignal)
- {
- // This is signal callback
- std::string interfaceName;
- msg.read(interfaceName);
- if (interfaceName != sensorInfo.sensorInterface)
- {
- // Not the interface we need
- return {};
- }
- }
-
// The eventdata2 may contain multiple properties
// So we have to get the properties from DBus anyway
auto response = mapDbusToEventdata2(sensorInfo);
@@ -476,21 +450,8 @@
#else
std::optional<GetSensorResponse> assertion(uint8_t id, const Info& sensorInfo,
- sdbusplus::message::message& msg)
+ const PropertyMap& /*properties*/)
{
- auto type = msg.get_type();
- if (type == msgTypeSignal)
- {
- // This is signal callback
- std::string interfaceName;
- msg.read(interfaceName);
- if (interfaceName != sensorInfo.sensorInterface)
- {
- // Not the interface we need
- return {};
- }
- }
-
// The assertion may contain multiple properties
// So we have to get the properties from DBus anyway
namespace fs = std::filesystem;