sensorhanlder: Struct properties use camelCase

Change-Id: Ib76451f5b967ad342875bf000e8ce20599d35a1e
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index 97ab5e5..19ba192 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -1781,13 +1781,13 @@
     uint8_t lun = static_cast<uint8_t>(sensorNum >> 8);
 
     record.header.recordId = recordID;
-    record.header.sdr_version = ipmiSdrVersion;
-    record.header.record_type = get_sdr::SENSOR_DATA_FULL_RECORD;
-    record.header.record_length = sizeof(get_sdr::SensorDataFullRecord) -
-                                  sizeof(get_sdr::SensorDataRecordHeader);
-    record.key.owner_id = bmcI2CAddr;
-    record.key.owner_lun = lun;
-    record.key.sensor_number = sensornumber;
+    record.header.sdrVersion = ipmiSdrVersion;
+    record.header.recordType = get_sdr::SENSOR_DATA_FULL_RECORD;
+    record.header.recordLength = sizeof(get_sdr::SensorDataFullRecord) -
+                                 sizeof(get_sdr::SensorDataRecordHeader);
+    record.key.ownerId = bmcI2CAddr;
+    record.key.ownerLun = lun;
+    record.key.sensorNumber = sensornumber;
 }
 bool constructSensorSdr(
     ipmi::Context::ptr ctx,
@@ -1806,18 +1806,17 @@
         return false;
     }
 
-    record.body.sensor_capabilities = 0x68; // auto rearm - todo hysteresis
-    record.body.sensor_type = getSensorTypeFromPath(path);
+    record.body.sensorCapabilities = 0x68; // auto rearm - todo hysteresis
+    record.body.sensorType = getSensorTypeFromPath(path);
     std::string type = getSensorTypeStringFromPath(path);
     auto typeCstr = type.c_str();
     auto findUnits = sensorUnits.find(typeCstr);
     if (findUnits != sensorUnits.end())
     {
-        record.body.sensor_units_2_base =
-            static_cast<uint8_t>(findUnits->second);
+        record.body.sensorUnits2Base = static_cast<uint8_t>(findUnits->second);
     } // else default 0x0 unspecified
 
-    record.body.event_reading_type = getSensorEventTypeFromPath(path);
+    record.body.eventReadingType = getSensorEventTypeFromPath(path);
 
     auto sensorObject = sensorMap.find(sensor::sensorInterface);
     if (sensorObject == sensorMap.end())
@@ -1834,8 +1833,8 @@
     updateIpmiFromAssociation(path, ipmiDecoratorPaths, sensorMap, entityId,
                               entityInstance);
 
-    record.body.entity_id = entityId;
-    record.body.entity_instance = entityInstance;
+    record.body.entityId = entityId;
+    record.body.entityInstance = entityInstance;
 
     double max = 0;
     double min = 0;
@@ -1868,23 +1867,23 @@
     // Byte 30 = RRRRBBBB = rExp (signed), bExp (signed)
 
     // apply M, B, and exponents, M and B are 10 bit values, exponents are 4
-    record.body.m_lsb = mValue & 0xFF;
+    record.body.mLsb = mValue & 0xFF;
 
     uint8_t mBitSign = (mValue < 0) ? 1 : 0;
     uint8_t mBitNine = (mValue & 0x0100) >> 8;
 
     // move the smallest bit of the MSB into place (bit 9)
-    // the MSbs are bits 7:8 in m_msb_and_tolerance
-    record.body.m_msb_and_tolerance = (mBitSign << 7) | (mBitNine << 6);
+    // the MSbs are bits 7:8 in mMsbAndToLerance
+    record.body.mMsbAndTolerance = (mBitSign << 7) | (mBitNine << 6);
 
-    record.body.b_lsb = bValue & 0xFF;
+    record.body.bLsb = bValue & 0xFF;
 
     uint8_t bBitSign = (bValue < 0) ? 1 : 0;
     uint8_t bBitNine = (bValue & 0x0100) >> 8;
 
     // move the smallest bit of the MSB into place (bit 9)
-    // the MSbs are bits 7:8 in b_msb_and_accuracy_lsb
-    record.body.b_msb_and_accuracy_lsb = (bBitSign << 7) | (bBitNine << 6);
+    // the MSbs are bits 7:8 in bMsbAndAccuracyLsb
+    record.body.bMsbAndAccuracyLsb = (bBitSign << 7) | (bBitNine << 6);
 
     uint8_t rExpSign = (rExp < 0) ? 1 : 0;
     uint8_t rExpBits = rExp & 0x07;
@@ -1893,11 +1892,11 @@
     uint8_t bExpBits = bExp & 0x07;
 
     // move rExp and bExp into place
-    record.body.r_b_exponents =
+    record.body.rbExponents =
         (rExpSign << 7) | (rExpBits << 4) | (bExpSign << 3) | bExpBits;
 
     // Set the analog reading byte interpretation accordingly
-    record.body.sensor_units_1 = (bSigned ? 1 : 0) << 7;
+    record.body.sensorUnits1 = (bSigned ? 1 : 0) << 7;
 
     // TODO(): Perhaps care about Tolerance, Accuracy, and so on
     // These seem redundant, but derivable from the above 5 attributes
@@ -1907,8 +1906,8 @@
     auto name = sensor::parseSdrIdFromPath(path);
     get_sdr::body::set_id_strlen(name.size(), record.body);
     get_sdr::body::set_id_type(3, record.body); // "8-bit ASCII + Latin 1"
-    std::memcpy(record.body.id_string, name.c_str(),
-                std::min(name.length() + 1, sizeof(record.body.id_string)));
+    std::memcpy(record.body.idString, name.c_str(),
+                std::min(name.length() + 1, sizeof(record.body.idString)));
 
     // Remember the sensor name, as determined for this sensor number
     details::sdrStatsTable.updateName(sensorNum, name);
@@ -1939,56 +1938,56 @@
 
     if (thresholdData.criticalHigh)
     {
-        record.body.upper_critical_threshold = *thresholdData.criticalHigh;
-        record.body.supported_deassertions[1] |= static_cast<uint8_t>(
+        record.body.upperCriticalThreshold = *thresholdData.criticalHigh;
+        record.body.supportedDeassertions[1] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::criticalThreshold);
-        record.body.supported_deassertions[1] |= static_cast<uint8_t>(
+        record.body.supportedDeassertions[1] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::upperCriticalGoingHigh);
-        record.body.supported_assertions[1] |= static_cast<uint8_t>(
+        record.body.supportedAssertions[1] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::upperCriticalGoingHigh);
-        record.body.discrete_reading_setting_mask[0] |=
+        record.body.discreteReadingSettingMask[0] |=
             static_cast<uint8_t>(IPMISensorReadingByte3::upperCritical);
     }
     if (thresholdData.warningHigh)
     {
-        record.body.upper_noncritical_threshold = *thresholdData.warningHigh;
-        record.body.supported_deassertions[1] |= static_cast<uint8_t>(
+        record.body.upperNoncriticalThreshold = *thresholdData.warningHigh;
+        record.body.supportedDeassertions[1] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::nonCriticalThreshold);
-        record.body.supported_deassertions[0] |= static_cast<uint8_t>(
+        record.body.supportedDeassertions[0] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::upperNonCriticalGoingHigh);
-        record.body.supported_assertions[0] |= static_cast<uint8_t>(
+        record.body.supportedAssertions[0] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::upperNonCriticalGoingHigh);
-        record.body.discrete_reading_setting_mask[0] |=
+        record.body.discreteReadingSettingMask[0] |=
             static_cast<uint8_t>(IPMISensorReadingByte3::upperNonCritical);
     }
     if (thresholdData.criticalLow)
     {
-        record.body.lower_critical_threshold = *thresholdData.criticalLow;
-        record.body.supported_assertions[1] |= static_cast<uint8_t>(
+        record.body.lowerCriticalThreshold = *thresholdData.criticalLow;
+        record.body.supportedAssertions[1] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::criticalThreshold);
-        record.body.supported_deassertions[0] |= static_cast<uint8_t>(
+        record.body.supportedDeassertions[0] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::lowerCriticalGoingLow);
-        record.body.supported_assertions[0] |= static_cast<uint8_t>(
+        record.body.supportedAssertions[0] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::lowerCriticalGoingLow);
-        record.body.discrete_reading_setting_mask[0] |=
+        record.body.discreteReadingSettingMask[0] |=
             static_cast<uint8_t>(IPMISensorReadingByte3::lowerCritical);
     }
     if (thresholdData.warningLow)
     {
-        record.body.lower_noncritical_threshold = *thresholdData.warningLow;
-        record.body.supported_assertions[1] |= static_cast<uint8_t>(
+        record.body.lowerNoncriticalThreshold = *thresholdData.warningLow;
+        record.body.supportedAssertions[1] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::nonCriticalThreshold);
-        record.body.supported_deassertions[0] |= static_cast<uint8_t>(
+        record.body.supportedDeassertions[0] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::lowerNonCriticalGoingLow);
-        record.body.supported_assertions[0] |= static_cast<uint8_t>(
+        record.body.supportedAssertions[0] |= static_cast<uint8_t>(
             IPMISensorEventEnableThresholds::lowerNonCriticalGoingLow);
-        record.body.discrete_reading_setting_mask[0] |=
+        record.body.discreteReadingSettingMask[0] |=
             static_cast<uint8_t>(IPMISensorReadingByte3::lowerNonCritical);
     }
 
     // everything that is readable is setable
-    record.body.discrete_reading_setting_mask[1] =
-        record.body.discrete_reading_setting_mask[0];
+    record.body.discreteReadingSettingMask[1] =
+        record.body.discreteReadingSettingMask[0];
     return true;
 }
 
@@ -2001,34 +2000,34 @@
 {
     constructSensorSdrHeaderKey(sensorNum, recordID, record);
 
-    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))
     {
         get_sdr::body::init_settable_state(true, record.body);
     }
 
-    auto id_string = sensor->second.sensorName;
+    auto idString = sensor->second.sensorName;
 
-    if (id_string.empty())
+    if (idString.empty())
     {
-        id_string = sensor->second.sensorNameFunc(sensor->second);
+        idString = sensor->second.sensorNameFunc(sensor->second);
     }
 
-    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,
                                      record.body);
     }
     else
     {
-        get_sdr::body::set_id_strlen(id_string.length(), record.body);
+        get_sdr::body::set_id_strlen(idString.length(), record.body);
     }
     get_sdr::body::set_id_type(3, &record.body); // "8-bit ASCII + Latin 1"
-    std::strncpy(record.body.id_string, id_string.c_str(),
+    std::strncpy(record.body.idString, idString.c_str(),
                  get_sdr::body::get_id_strlen(record.body));
 }
 #endif
@@ -2041,16 +2040,16 @@
     uint8_t lun = static_cast<uint8_t>(sensorNum >> 8);
 
     record.header.recordId = recordID;
-    record.header.sdr_version = ipmiSdrVersion;
-    record.header.record_type = get_sdr::SENSOR_DATA_EVENT_RECORD;
-    record.header.record_length = sizeof(get_sdr::SensorDataEventRecord) -
-                                  sizeof(get_sdr::SensorDataRecordHeader);
-    record.key.owner_id = bmcI2CAddr;
-    record.key.owner_lun = lun;
-    record.key.sensor_number = sensornumber;
+    record.header.sdrVersion = ipmiSdrVersion;
+    record.header.recordType = get_sdr::SENSOR_DATA_EVENT_RECORD;
+    record.header.recordLength = sizeof(get_sdr::SensorDataEventRecord) -
+                                 sizeof(get_sdr::SensorDataRecordHeader);
+    record.key.ownerId = bmcI2CAddr;
+    record.key.ownerLun = lun;
+    record.key.sensorNumber = sensornumber;
 
-    record.body.entity_id = 0x00;
-    record.body.entity_instance = 0x01;
+    record.body.entityId = 0x00;
+    record.body.entityInstance = 0x01;
 }
 
 // Construct a type 3 SDR for VR typed sensor(daemon).
@@ -2073,27 +2072,26 @@
     // follow the association chain to get the parent board's entityid and
     // entityInstance
     updateIpmiFromAssociation(path, ipmiDecoratorPaths, sensorMap,
-                              record.body.entity_id,
-                              record.body.entity_instance);
+                              record.body.entityId, record.body.entityInstance);
 
     // Sensor type is hardcoded as a module/board type instead of parsing from
     // sensor path. This is because VR control is allocated in an independent
     // path(/xyz/openbmc_project/vr/profile/...) which is not categorized by
     // types.
     static constexpr const uint8_t moduleBoardType = 0x15;
-    record.body.sensor_type = moduleBoardType;
-    record.body.event_reading_type = 0x00;
+    record.body.sensorType = moduleBoardType;
+    record.body.eventReadingType = 0x00;
 
-    record.body.sensor_record_sharing_1 = 0x00;
-    record.body.sensor_record_sharing_2 = 0x00;
+    record.body.sensorRecordSharing1 = 0x00;
+    record.body.sensorRecordSharing2 = 0x00;
 
     // populate sensor name from path
     auto name = sensor::parseSdrIdFromPath(path);
-    int nameSize = std::min(name.size(), sizeof(record.body.id_string));
+    int nameSize = std::min(name.size(), sizeof(record.body.idString));
     get_sdr::body::set_id_strlen(nameSize, record.body);
     get_sdr::body::set_id_type(3, record.body); // "8-bit ASCII + Latin 1"
-    std::memset(record.body.id_string, 0x00, sizeof(record.body.id_string));
-    std::memcpy(record.body.id_string, name.c_str(), nameSize);
+    std::memset(record.body.idString, 0x00, sizeof(record.body.idString));
+    std::memcpy(record.body.idString, name.c_str(), nameSize);
 
     // Remember the sensor name, as determined for this sensor number
     details::sdrStatsTable.updateName(sensorNum, name);
@@ -2468,7 +2466,7 @@
     }
 
     size_t sdrLength =
-        sizeof(get_sdr::SensorDataRecordHeader) + hdr->record_length;
+        sizeof(get_sdr::SensorDataRecordHeader) + hdr->recordLength;
     if (offset >= sdrLength)
     {
         lg2::error("ipmiStorageGetSDR: offset is outside the record");