summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTom Joseph <tomjoseph@in.ibm.com>2017-09-07 15:38:40 +0530
committerTom Joseph <tomjoseph@in.ibm.com>2017-09-14 19:29:38 +0530
commit580af36bd4668723dccedee792350edc5673f417 (patch)
treefb498015545a8387d68ce831d0c92959b1bb0ec7 /scripts
parentb673ff6af479ee90057e948c94f506f4186f064e (diff)
downloadphosphor-host-ipmid-580af36bd4668723dccedee792350edc5673f417.tar.gz
phosphor-host-ipmid-580af36bd4668723dccedee792350edc5673f417.zip
sensor: Pass the dbus property type as a template parameter
readingAssertion and reading type of sensors, take the dbus property type as template parameters. Instead of generating code to handle that, the function parameter is updated with the template parameter. Resolves openbmc/openbmc#2220 Change-Id: Ib9e15727ba96e3a53c46f17bffc9ef68dbf73194 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/writesensor.mako.cpp71
1 files changed, 7 insertions, 64 deletions
diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp
index f420490..5cc024e 100644
--- a/scripts/writesensor.mako.cpp
+++ b/scripts/writesensor.mako.cpp
@@ -29,64 +29,6 @@ interfaceDict = {}
using namespace ipmi::sensor;
-%for key in sensorDict.iterkeys():
-<%
- sensor = sensorDict[key]
- readingType = sensor["readingType"]
- interfaces = sensor["interfaces"]
- for interface, properties in interfaces.items():
- for property, values in properties.items():
- for offset, attributes in values.items():
- type = attributes["type"]
-%>\
-%if "readingAssertion" == readingType:
-namespace sensor_${key}
-{
-
-inline ipmi_ret_t readingAssertion(const SetSensorReadingReq& cmdData,
- const Info& sensorInfo)
-{
- return set::readingAssertion<${type}>(cmdData, sensorInfo);
-}
-
-namespace get
-{
-
-inline GetSensorResponse readingAssertion(const Info& sensorInfo)
-{
- return ipmi::sensor::get::readingAssertion<${type}>(sensorInfo);
-}
-
-} //namespace get
-
-} // namespace sensor_${key}
-
-%elif "readingData" == readingType:
-
-namespace sensor_${key}
-{
-
-inline ipmi_ret_t readingData(const SetSensorReadingReq& cmdData,
- const Info& sensorInfo)
-{
- return set::readingData<${type}>(cmdData, sensorInfo);
-}
-
-namespace get
-{
-
-inline GetSensorResponse readingData(const Info& sensorInfo)
-{
- return ipmi::sensor::get::readingData<${type}>(sensorInfo);
-}
-
-} //namespace get
-
-} // namespace sensor_${key}
-
-%endif
-% endfor
-
extern const IdInfoMap sensors = {
% for key in sensorDict.iterkeys():
% if key:
@@ -106,12 +48,13 @@ extern const IdInfoMap sensors = {
updateFunc += sensor["readingType"]
getFunc = interfaceDict[serviceInterface]["getFunc"]
getFunc += sensor["readingType"]
- if "readingAssertion" == valueReadingType:
- updateFunc = "sensor_" + str(key) + "::" + valueReadingType
- getFunc = "sensor_" + str(key) + "::get::" + valueReadingType
- elif "readingData" == valueReadingType:
- updateFunc = "sensor_" + str(key) + "::" + valueReadingType
- getFunc = "sensor_" + str(key) + "::get::" + valueReadingType
+ if "readingAssertion" == valueReadingType or "readingData" == valueReadingType:
+ for interface,properties in interfaces.items():
+ for dbus_property,property_value in properties.items():
+ for offset,values in property_value.items():
+ valueType = values["type"]
+ updateFunc = "set::" + valueReadingType + "<" + valueType + ">"
+ getFunc = "get::" + valueReadingType + "<" + valueType + ">"
sensorInterface = serviceInterface
if serviceInterface == "org.freedesktop.DBus.Properties":
sensorInterface = next(iter(interfaces))
OpenPOWER on IntegriCloud