sensorhanlder: Struct properties use camelCase
Change-Id: Ib76451f5b967ad342875bf000e8ce20599d35a1e
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index f75160e..78d1e9d 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -1082,8 +1082,8 @@
get_sdr::SensorDataFullRecordBody& body)
{
namespace server = sdbusplus::server::xyz::openbmc_project::sensor;
- body.sensor_units_1 = info.sensorUnits1; // default is 0. unsigned, no rate,
- // no modifier, not a %
+ body.sensorUnits1 = info.sensorUnits1; // default is 0. unsigned, no rate,
+ // no modifier, not a %
try
{
auto unit = server::Value::convertUnitFromString(info.unit);
@@ -1092,25 +1092,25 @@
switch (unit)
{
case server::Value::Unit::DegreesC:
- body.sensor_units_2_base = get_sdr::SENSOR_UNIT_DEGREES_C;
+ body.sensorUnits2Base = get_sdr::SENSOR_UNIT_DEGREES_C;
break;
case server::Value::Unit::RPMS:
- body.sensor_units_2_base = get_sdr::SENSOR_UNIT_RPM;
+ body.sensorUnits2Base = get_sdr::SENSOR_UNIT_RPM;
break;
case server::Value::Unit::Volts:
- body.sensor_units_2_base = get_sdr::SENSOR_UNIT_VOLTS;
+ body.sensorUnits2Base = get_sdr::SENSOR_UNIT_VOLTS;
break;
case server::Value::Unit::Meters:
- body.sensor_units_2_base = get_sdr::SENSOR_UNIT_METERS;
+ body.sensorUnits2Base = get_sdr::SENSOR_UNIT_METERS;
break;
case server::Value::Unit::Amperes:
- body.sensor_units_2_base = get_sdr::SENSOR_UNIT_AMPERES;
+ body.sensorUnits2Base = get_sdr::SENSOR_UNIT_AMPERES;
break;
case server::Value::Unit::Joules:
- body.sensor_units_2_base = get_sdr::SENSOR_UNIT_JOULES;
+ body.sensorUnits2Base = get_sdr::SENSOR_UNIT_JOULES;
break;
case server::Value::Unit::Watts:
- body.sensor_units_2_base = get_sdr::SENSOR_UNIT_WATTS;
+ body.sensorUnits2Base = get_sdr::SENSOR_UNIT_WATTS;
break;
case server::Value::Unit::Percent:
get_sdr::body::set_percentage(body);
@@ -1143,23 +1143,23 @@
}
/* ID string */
- auto id_string = info.sensorName;
+ auto idString = info.sensorName;
- if (id_string.empty())
+ if (idString.empty())
{
- id_string = info.sensorNameFunc(info);
+ idString = info.sensorNameFunc(info);
}
- if (id_string.length() > FULL_RECORD_ID_STR_MAX_LENGTH)
+ if (idString.length() > FULL_RECORD_ID_STR_MAX_LENGTH)
{
get_sdr::body::set_id_strlen(FULL_RECORD_ID_STR_MAX_LENGTH, body);
}
else
{
- get_sdr::body::set_id_strlen(id_string.length(), body);
+ get_sdr::body::set_id_strlen(idString.length(), body);
}
get_sdr::body::set_id_type(3, body); // "8-bit ASCII + Latin 1"
- strncpy(body.id_string, id_string.c_str(),
+ strncpy(body.idString, idString.c_str(),
get_sdr::body::get_id_strlen(body));
return ipmi::ccSuccess;
@@ -1183,9 +1183,9 @@
get_sdr::SensorDataFruRecord record{};
/* Header */
record.header.recordId = recordID;
- record.header.sdr_version = SDR_VERSION; // Based on IPMI Spec v2.0 rev 1.1
- record.header.record_type = get_sdr::SENSOR_DATA_FRU_RECORD;
- record.header.record_length = sizeof(record.key) + sizeof(record.body);
+ record.header.sdrVersion = SDR_VERSION; // Based on IPMI Spec v2.0 rev 1.1
+ record.header.recordType = get_sdr::SENSOR_DATA_FRU_RECORD;
+ record.header.recordLength = sizeof(record.key) + sizeof(record.body);
/* Key */
record.key.fruID = fruID;
@@ -1271,9 +1271,9 @@
get_sdr::SensorDataEntityRecord record{};
/* Header */
record.header.recordId = recordID;
- record.header.sdr_version = SDR_VERSION; // Based on IPMI Spec v2.0 rev 1.1
- record.header.record_type = get_sdr::SENSOR_DATA_ENTITY_RECORD;
- record.header.record_length = sizeof(record.key) + sizeof(record.body);
+ record.header.sdrVersion = SDR_VERSION; // Based on IPMI Spec v2.0 rev 1.1
+ record.header.recordType = get_sdr::SENSOR_DATA_ENTITY_RECORD;
+ record.header.recordLength = sizeof(record.key) + sizeof(record.body);
/* Key */
record.key.containerEntityId = entity->second.containerEntityId;
@@ -1354,27 +1354,27 @@
}
}
- uint8_t sensor_id = sensor->first;
+ uint8_t sensorId = sensor->first;
- auto it = sdrCacheMap.find(sensor_id);
+ auto it = sdrCacheMap.find(sensorId);
if (it == sdrCacheMap.end())
{
/* Header */
get_sdr::SensorDataFullRecord record = {};
- record.header.recordId = sensor_id;
- record.header.sdr_version = 0x51; // Based on IPMI Spec v2.0 rev 1.1
- record.header.record_type = get_sdr::SENSOR_DATA_FULL_RECORD;
- record.header.record_length = sizeof(record.key) + sizeof(record.body);
+ record.header.recordId = sensorId;
+ record.header.sdrVersion = 0x51; // Based on IPMI Spec v2.0 rev 1.1
+ record.header.recordType = get_sdr::SENSOR_DATA_FULL_RECORD;
+ record.header.recordLength = sizeof(record.key) + sizeof(record.body);
/* Key */
get_sdr::key::set_owner_id_bmc(record.key);
- record.key.sensor_number = sensor_id;
+ record.key.sensorNumber = sensorId;
/* Body */
- record.body.entity_id = sensor->second.entityType;
- record.body.sensor_type = sensor->second.sensorType;
- record.body.event_reading_type = sensor->second.sensorReadingType;
- record.body.entity_instance = sensor->second.instance;
+ record.body.entityId = sensor->second.entityType;
+ record.body.sensorType = sensor->second.sensorType;
+ record.body.eventReadingType = sensor->second.sensorReadingType;
+ record.body.entityInstance = sensor->second.instance;
if (ipmi::sensor::Mutability::Write ==
(sensor->second.mutability & ipmi::sensor::Mutability::Write))
{
@@ -1383,11 +1383,11 @@
// Set the type-specific details given the DBus interface
populate_record_from_dbus(sensor->second, record.body);
- sdrCacheMap[sensor_id] = std::move(record);
+ sdrCacheMap[sensorId] = std::move(record);
}
uint16_t nextRecordId{};
- const auto& record = sdrCacheMap[sensor_id];
+ const auto& record = sdrCacheMap[sensorId];
if (++sensor == ipmi::sensor::sensors.end())
{