Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 1 | ## This file is a template. The comment below is emitted |
| 2 | ## into the rendered file; feel free to edit this file. |
| 3 | |
| 4 | // !!! WARNING: This is a GENERATED Code..Please do NOT Edit !!! |
| 5 | |
| 6 | #include "types.hpp" |
| 7 | using namespace ipmi::sensor; |
| 8 | |
| 9 | extern const IdInfoMap sensors = { |
| 10 | % for key in sensorDict.iterkeys(): |
| 11 | % if key: |
| 12 | {${key},{ |
| 13 | <% |
| 14 | sensor = sensorDict[key] |
| 15 | interfaces = sensor["interfaces"] |
| 16 | path = sensor["path"] |
| 17 | sensorType = sensor["sensorType"] |
| 18 | readingType = sensor["sensorReadingType"] |
Emily Shaffer | 10f4959 | 2017-05-10 12:01:10 -0700 | [diff] [blame] | 19 | multiplier = sensor.get("multiplierM", 1) |
| 20 | offset = sensor.get("offsetB", 0) |
| 21 | exp = sensor.get("bExp", 0) |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 22 | %> |
Emily Shaffer | 10f4959 | 2017-05-10 12:01:10 -0700 | [diff] [blame] | 23 | ${sensorType},"${path}",${readingType},${multiplier},${offset},${exp}, |
| 24 | ${offset * pow(10,exp)},{ |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 25 | % for interface,properties in interfaces.iteritems(): |
| 26 | {"${interface}",{ |
| 27 | % for dbus_property,property_value in properties.iteritems(): |
| 28 | {"${dbus_property}",{ |
| 29 | % for offset,values in property_value.iteritems(): |
| 30 | { ${offset},{ |
Ratan Gupta | ca4c446 | 2017-03-16 00:00:06 +0530 | [diff] [blame] | 31 | <% valueType = values["type"] %>\ |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 32 | % for name,value in values.iteritems(): |
| 33 | % if name == "type": |
Ratan Gupta | ca4c446 | 2017-03-16 00:00:06 +0530 | [diff] [blame] | 34 | <% continue %>\ |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 35 | % endif |
| 36 | % if valueType == "string": |
| 37 | std::string("${value}"), |
Ratan Gupta | ca4c446 | 2017-03-16 00:00:06 +0530 | [diff] [blame] | 38 | % elif valueType == "bool": |
| 39 | <% value = str(value).lower() %>\ |
| 40 | ${value}, |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 41 | % else: |
| 42 | ${value}, |
| 43 | % endif |
| 44 | % endfor |
| 45 | } |
| 46 | }, |
| 47 | % endfor |
| 48 | }}, |
| 49 | % endfor |
| 50 | }}, |
| 51 | % endfor |
| 52 | } |
| 53 | }}, |
| 54 | % endif |
| 55 | % endfor |
| 56 | }; |
| 57 | |