Refactor set sensor handling code
A summary of the changes:
- Do not generate per sensor type code to update d-bus objects
corresponding to sensors. Function to update d-bus objects based on
standard sensor event types, such as assertion, event data, are now
generic functions - the need not be generated per sensor or per sensor
type.
- There's a special case where the assertion is treated as a reading
(i.e read the entire assertion field as-is). In this case, code needs
to be generated per sensor because the type of the mapped d-bus
property can vary. In this case have a generic template function, and
generate minimal code like so:
inline ipmi_ret_t readingAssertion(const SetSensorReadingReq& cmdData,
const Info& sensorInfo)
{
// Corresponding d-bus property is uint32_t
return set::readingAssertion<uint32_t>(cmdData, sensorInfo);
}
- Make sensor-example.yaml succinct.
- Make the code in writesensor.mako.cpp more pythonic.
Change-Id: I84415ca6e3f756bbb51a90e290539eb086a7f78b
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/types.hpp b/types.hpp
index d3c8dc6..5b943f4 100644
--- a/types.hpp
+++ b/types.hpp
@@ -58,13 +58,14 @@
{
Type sensorType;
InstancePath sensorPath;
+ DbusInterface sensorInterface;
ReadingType sensorReadingType;
Multiplier coefficientM;
OffsetB coefficientB;
Exponent exponentB;
ScaledOffset scaledOffset;
- std::function<uint8_t(SetSensorReadingReq&,const Info&)> updateFunc;
- DbusInterfaceMap sensorInterfaces;
+ std::function<uint8_t(SetSensorReadingReq&, const Info&)> updateFunc;
+ DbusInterfaceMap propertyInterfaces;
};
using Id = uint8_t;