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");
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index 84a4449..434e220 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -710,9 +710,9 @@
size_t sizeDiff = maxFruSdrNameSize - name.size();
resp.header.recordId = 0x0; // calling code is to implement these
- resp.header.sdr_version = ipmiSdrVersion;
- resp.header.record_type = get_sdr::SENSOR_DATA_FRU_RECORD;
- resp.header.record_length = sizeof(resp.body) + sizeof(resp.key) - sizeDiff;
+ resp.header.sdrVersion = ipmiSdrVersion;
+ resp.header.recordType = get_sdr::SENSOR_DATA_FRU_RECORD;
+ resp.header.recordLength = sizeof(resp.body) + sizeof(resp.key) - sizeDiff;
resp.key.deviceAddress = 0x20;
resp.key.fruID = device->first;
resp.key.accessLun = 0x80; // logical / physical fru device
@@ -1200,9 +1200,9 @@
/* Header */
// Based on IPMI Spec v2.0 rev 1.1
data.header.recordId = recordId;
- data.header.sdr_version = SDR_VERSION;
- data.header.record_type = 0x08;
- data.header.record_length = sizeof(data.key) + sizeof(data.body);
+ data.header.sdrVersion = SDR_VERSION;
+ data.header.recordType = 0x08;
+ data.header.recordLength = sizeof(data.key) + sizeof(data.body);
/* Key */
data.key.containerEntityId = entity->second.containerEntityId;
diff --git a/include/dbus-sdr/storagecommands.hpp b/include/dbus-sdr/storagecommands.hpp
index bc9a275..e23b621 100644
--- a/include/dbus-sdr/storagecommands.hpp
+++ b/include/dbus-sdr/storagecommands.hpp
@@ -105,10 +105,10 @@
entityInstance(entityInst), oem(mfrDefined)
{
header.recordId = recordID;
- header.sdr_version = ipmiSdrVersion;
- header.record_type = 0x12;
+ header.sdrVersion = ipmiSdrVersion;
+ header.recordType = 0x12;
size_t nameLen = std::min(sensorname.size(), sizeof(name));
- header.record_length =
+ header.recordLength =
sizeof(Type12Record) - sizeof(get_sdr::SensorDataRecordHeader) -
sizeof(name) + nameLen;
typeLengthCode = 0xc0 | nameLen;
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())
{
diff --git a/sensorhandler.hpp b/sensorhandler.hpp
index 693ab96..5d58a6c 100644
--- a/sensorhandler.hpp
+++ b/sensorhandler.hpp
@@ -95,9 +95,9 @@
struct SensorDataRecordHeader
{
uint16_t recordId;
- uint8_t sdr_version;
- uint8_t record_type;
- uint8_t record_length; // Length not counting the header
+ uint8_t sdrVersion;
+ uint8_t recordType;
+ uint8_t recordLength; // Length not counting the header
} __attribute__((packed));
enum SensorDataRecordType
@@ -113,9 +113,9 @@
// Record key
struct SensorDataRecordKey
{
- uint8_t owner_id;
- uint8_t owner_lun;
- uint8_t sensor_number;
+ uint8_t ownerId;
+ uint8_t ownerLun;
+ uint8_t sensorNumber;
} __attribute__((packed));
/** @struct SensorDataFruRecordKey
@@ -151,35 +151,35 @@
inline void set_owner_id_ipmb(SensorDataRecordKey& key)
{
- key.owner_id &= ~0x01;
+ key.ownerId &= ~0x01;
};
inline void set_owner_id_system_sw(SensorDataRecordKey& key)
{
- key.owner_id |= 0x01;
+ key.ownerId |= 0x01;
};
inline void set_owner_id_bmc(SensorDataRecordKey& key)
{
- key.owner_id |= 0x20;
+ key.ownerId |= 0x20;
};
inline void set_owner_id_address(uint8_t addr, SensorDataRecordKey& key)
{
- key.owner_id &= 0x01;
- key.owner_id |= addr << 1;
+ key.ownerId &= 0x01;
+ key.ownerId |= addr << 1;
};
inline void set_owner_lun(uint8_t lun, SensorDataRecordKey& key)
{
- key.owner_lun &= ~0x03;
- key.owner_lun |= (lun & 0x03);
+ key.ownerLun &= ~0x03;
+ key.ownerLun |= (lun & 0x03);
};
inline void set_owner_lun_channel(uint8_t channel, SensorDataRecordKey& key)
{
- key.owner_lun &= 0x0f;
- key.owner_lun |= ((channel & 0xf) << 4);
+ key.ownerLun &= 0x0f;
+ key.ownerLun |= ((channel & 0xf) << 4);
};
inline void set_flags(bool isList, bool isLinked,
@@ -221,43 +221,43 @@
struct SensorDataFullRecordBody
{
- uint8_t entity_id;
- uint8_t entity_instance;
- uint8_t sensor_initialization;
- uint8_t sensor_capabilities; // no macro support
- uint8_t sensor_type;
- uint8_t event_reading_type;
- uint8_t supported_assertions[2]; // no macro support
- uint8_t supported_deassertions[2]; // no macro support
- uint8_t discrete_reading_setting_mask[2]; // no macro support
- uint8_t sensor_units_1;
- uint8_t sensor_units_2_base;
- uint8_t sensor_units_3_modifier;
+ uint8_t entityId;
+ uint8_t entityInstance;
+ uint8_t sensorInitialization;
+ uint8_t sensorCapabilities; // no macro support
+ uint8_t sensorType;
+ uint8_t eventReadingType;
+ uint8_t supportedAssertions[2]; // no macro support
+ uint8_t supportedDeassertions[2]; // no macro support
+ uint8_t discreteReadingSettingMask[2]; // no macro support
+ uint8_t sensorUnits1;
+ uint8_t sensorUnits2Base;
+ uint8_t sensorUnits3Modifier;
uint8_t linearization;
- uint8_t m_lsb;
- uint8_t m_msb_and_tolerance;
- uint8_t b_lsb;
- uint8_t b_msb_and_accuracy_lsb;
- uint8_t accuracy_and_sensor_direction;
- uint8_t r_b_exponents;
- uint8_t analog_characteristic_flags; // no macro support
- uint8_t nominal_reading;
- uint8_t normal_max;
- uint8_t normal_min;
- uint8_t sensor_max;
- uint8_t sensor_min;
- uint8_t upper_nonrecoverable_threshold;
- uint8_t upper_critical_threshold;
- uint8_t upper_noncritical_threshold;
- uint8_t lower_nonrecoverable_threshold;
- uint8_t lower_critical_threshold;
- uint8_t lower_noncritical_threshold;
- uint8_t positive_threshold_hysteresis;
- uint8_t negative_threshold_hysteresis;
+ uint8_t mLsb;
+ uint8_t mMsbAndTolerance;
+ uint8_t bLsb;
+ uint8_t bMsbAndAccuracyLsb;
+ uint8_t accuracyAndSensorDirection;
+ uint8_t rbExponents;
+ uint8_t analogCharacteristicFlags; // no macro support
+ uint8_t nominalReading;
+ uint8_t normalMax;
+ uint8_t normalMin;
+ uint8_t sensorMax;
+ uint8_t sensorMin;
+ uint8_t upperNonrecoverableThreshold;
+ uint8_t upperCriticalThreshold;
+ uint8_t upperNoncriticalThreshold;
+ uint8_t lowerNonrecoverableThreshold;
+ uint8_t lowerCriticalThreshold;
+ uint8_t lowerNoncriticalThreshold;
+ uint8_t positiveThresholdHysteresis;
+ uint8_t negativeThresholdHysteresis;
uint16_t reserved;
- uint8_t oem_reserved;
- uint8_t id_string_info;
- char id_string[FULL_RECORD_ID_STR_MAX_LENGTH];
+ uint8_t oemReserved;
+ uint8_t idStringInfo;
+ char idString[FULL_RECORD_ID_STR_MAX_LENGTH];
} __attribute__((packed));
/** @struct SensorDataCompactRecord
@@ -266,25 +266,25 @@
*/
struct SensorDataCompactRecordBody
{
- uint8_t entity_id;
- uint8_t entity_instance;
- uint8_t sensor_initialization;
- uint8_t sensor_capabilities; // no macro support
- uint8_t sensor_type;
- uint8_t event_reading_type;
- uint8_t supported_assertions[2]; // no macro support
- uint8_t supported_deassertions[2]; // no macro support
- uint8_t discrete_reading_setting_mask[2]; // no macro support
- uint8_t sensor_units_1;
- uint8_t sensor_units_2_base;
- uint8_t sensor_units_3_modifier;
+ uint8_t entityId;
+ uint8_t entityInstance;
+ uint8_t sensorInitialization;
+ uint8_t sensorCapabilities; // no macro support
+ uint8_t sensorType;
+ uint8_t eventReadingType;
+ uint8_t supportedAssertions[2]; // no macro support
+ uint8_t supportedDeassertions[2]; // no macro support
+ uint8_t discreteReadingSettingMask[2]; // no macro support
+ uint8_t sensorUnits1;
+ uint8_t sensorUnits2Base;
+ uint8_t sensorUnits3Modifier;
uint8_t record_sharing[2];
- uint8_t positive_threshold_hysteresis;
- uint8_t negative_threshold_hysteresis;
+ uint8_t positiveThresholdHysteresis;
+ uint8_t negativeThresholdHysteresis;
uint8_t reserved[3];
- uint8_t oem_reserved;
- uint8_t id_string_info;
- char id_string[FULL_RECORD_ID_STR_MAX_LENGTH];
+ uint8_t oemReserved;
+ uint8_t idStringInfo;
+ char idString[FULL_RECORD_ID_STR_MAX_LENGTH];
} __attribute__((packed));
/** @struct SensorDataEventRecord
@@ -293,16 +293,16 @@
*/
struct SensorDataEventRecordBody
{
- uint8_t entity_id;
- uint8_t entity_instance;
- uint8_t sensor_type;
- uint8_t event_reading_type;
- uint8_t sensor_record_sharing_1;
- uint8_t sensor_record_sharing_2;
+ uint8_t entityId;
+ uint8_t entityInstance;
+ uint8_t sensorType;
+ uint8_t eventReadingType;
+ uint8_t sensorRecordSharing1;
+ uint8_t sensorRecordSharing2;
uint8_t reserved;
- uint8_t oem_reserved;
- uint8_t id_string_info;
- char id_string[FULL_RECORD_ID_STR_MAX_LENGTH];
+ uint8_t oemReserved;
+ uint8_t idStringInfo;
+ char idString[FULL_RECORD_ID_STR_MAX_LENGTH];
} __attribute__((packed));
/** @struct SensorDataFruRecordBody
@@ -341,29 +341,29 @@
inline void set_entity_instance_number(uint8_t n,
SensorDataFullRecordBody& body)
{
- body.entity_instance &= 1 << 7;
- body.entity_instance |= (n & ~(1 << 7));
+ body.entityInstance &= 1 << 7;
+ body.entityInstance |= (n & ~(1 << 7));
};
inline void set_entity_physical_entity(SensorDataFullRecordBody& body)
{
- body.entity_instance &= ~(1 << 7);
+ body.entityInstance &= ~(1 << 7);
};
inline void set_entity_logical_container(SensorDataFullRecordBody& body)
{
- body.entity_instance |= 1 << 7;
+ body.entityInstance |= 1 << 7;
};
inline void sensor_scanning_state(bool enabled, SensorDataFullRecordBody& body)
{
if (enabled)
{
- body.sensor_initialization |= 1 << 0;
+ body.sensorInitialization |= 1 << 0;
}
else
{
- body.sensor_initialization &= ~(1 << 0);
+ body.sensorInitialization &= ~(1 << 0);
};
};
@@ -371,11 +371,11 @@
{
if (enabled)
{
- body.sensor_initialization |= 1 << 1;
+ body.sensorInitialization |= 1 << 1;
}
else
{
- body.sensor_initialization &= ~(1 << 1);
+ body.sensorInitialization &= ~(1 << 1);
}
};
@@ -383,11 +383,11 @@
{
if (enabled)
{
- body.sensor_initialization |= 1 << 2;
+ body.sensorInitialization |= 1 << 2;
}
else
{
- body.sensor_initialization &= ~(1 << 2);
+ body.sensorInitialization &= ~(1 << 2);
}
};
@@ -395,11 +395,11 @@
{
if (enabled)
{
- body.sensor_initialization |= 1 << 3;
+ body.sensorInitialization |= 1 << 3;
}
else
{
- body.sensor_initialization &= ~(1 << 3);
+ body.sensorInitialization &= ~(1 << 3);
}
};
@@ -407,11 +407,11 @@
{
if (enabled)
{
- body.sensor_initialization |= 1 << 4;
+ body.sensorInitialization |= 1 << 4;
}
else
{
- body.sensor_initialization &= ~(1 << 4);
+ body.sensorInitialization &= ~(1 << 4);
}
};
@@ -419,11 +419,11 @@
{
if (enabled)
{
- body.sensor_initialization |= 1 << 5;
+ body.sensorInitialization |= 1 << 5;
}
else
{
- body.sensor_initialization &= ~(1 << 5);
+ body.sensorInitialization &= ~(1 << 5);
}
};
@@ -431,11 +431,11 @@
{
if (enabled)
{
- body.sensor_initialization |= 1 << 6;
+ body.sensorInitialization |= 1 << 6;
}
else
{
- body.sensor_initialization &= ~(1 << 6);
+ body.sensorInitialization &= ~(1 << 6);
}
};
@@ -443,124 +443,124 @@
{
if (enabled)
{
- body.sensor_initialization |= 1 << 7;
+ body.sensorInitialization |= 1 << 7;
}
else
{
- body.sensor_initialization &= ~(1 << 7);
+ body.sensorInitialization &= ~(1 << 7);
}
};
inline void set_percentage(SensorDataFullRecordBody& body)
{
- body.sensor_units_1 |= 1 << 0;
+ body.sensorUnits1 |= 1 << 0;
};
inline void unset_percentage(SensorDataFullRecordBody& body)
{
- body.sensor_units_1 &= ~(1 << 0);
+ body.sensorUnits1 &= ~(1 << 0);
};
inline void set_modifier_operation(uint8_t op, SensorDataFullRecordBody& body)
{
- body.sensor_units_1 &= ~(3 << 1);
- body.sensor_units_1 |= (op & 0x3) << 1;
+ body.sensorUnits1 &= ~(3 << 1);
+ body.sensorUnits1 |= (op & 0x3) << 1;
};
inline void set_rate_unit(uint8_t unit, SensorDataFullRecordBody& body)
{
- body.sensor_units_1 &= ~(7 << 3);
- body.sensor_units_1 |= (unit & 0x7) << 3;
+ body.sensorUnits1 &= ~(7 << 3);
+ body.sensorUnits1 |= (unit & 0x7) << 3;
};
inline void set_analog_data_format(uint8_t format,
SensorDataFullRecordBody& body)
{
- body.sensor_units_1 &= ~(3 << 6);
- body.sensor_units_1 |= (format & 0x3) << 6;
+ body.sensorUnits1 &= ~(3 << 6);
+ body.sensorUnits1 |= (format & 0x3) << 6;
};
inline void set_m(uint16_t m, SensorDataFullRecordBody& body)
{
- body.m_lsb = m & 0xff;
- body.m_msb_and_tolerance &= ~(3 << 6);
- body.m_msb_and_tolerance |= ((m & (3 << 8)) >> 2);
+ body.mLsb = m & 0xff;
+ body.mMsbAndTolerance &= ~(3 << 6);
+ body.mMsbAndTolerance |= ((m & (3 << 8)) >> 2);
};
inline void set_tolerance(uint8_t tol, SensorDataFullRecordBody& body)
{
- body.m_msb_and_tolerance &= ~0x3f;
- body.m_msb_and_tolerance |= tol & 0x3f;
+ body.mMsbAndTolerance &= ~0x3f;
+ body.mMsbAndTolerance |= tol & 0x3f;
};
inline void set_b(uint16_t b, SensorDataFullRecordBody& body)
{
- body.b_lsb = b & 0xff;
- body.b_msb_and_accuracy_lsb &= ~(3 << 6);
- body.b_msb_and_accuracy_lsb |= ((b & (3 << 8)) >> 2);
+ body.bLsb = b & 0xff;
+ body.bMsbAndAccuracyLsb &= ~(3 << 6);
+ body.bMsbAndAccuracyLsb |= ((b & (3 << 8)) >> 2);
};
inline void set_accuracy(uint16_t acc, SensorDataFullRecordBody& body)
{
// bottom 6 bits
- body.b_msb_and_accuracy_lsb &= ~0x3f;
- body.b_msb_and_accuracy_lsb |= acc & 0x3f;
+ body.bMsbAndAccuracyLsb &= ~0x3f;
+ body.bMsbAndAccuracyLsb |= acc & 0x3f;
// top 4 bits
- body.accuracy_and_sensor_direction &= 0x0f;
- body.accuracy_and_sensor_direction |= ((acc >> 6) & 0xf) << 4;
+ body.accuracyAndSensorDirection &= 0x0f;
+ body.accuracyAndSensorDirection |= ((acc >> 6) & 0xf) << 4;
};
inline void set_accuracy_exp(uint8_t exp, SensorDataFullRecordBody& body)
{
- body.accuracy_and_sensor_direction &= ~(3 << 2);
- body.accuracy_and_sensor_direction |= (exp & 3) << 2;
+ body.accuracyAndSensorDirection &= ~(3 << 2);
+ body.accuracyAndSensorDirection |= (exp & 3) << 2;
};
inline void set_sensor_dir(uint8_t dir, SensorDataFullRecordBody& body)
{
- body.accuracy_and_sensor_direction &= ~(3 << 0);
- body.accuracy_and_sensor_direction |= (dir & 3);
+ body.accuracyAndSensorDirection &= ~(3 << 0);
+ body.accuracyAndSensorDirection |= (dir & 3);
};
inline void set_b_exp(uint8_t exp, SensorDataFullRecordBody& body)
{
- body.r_b_exponents &= 0xf0;
- body.r_b_exponents |= exp & 0x0f;
+ body.rbExponents &= 0xf0;
+ body.rbExponents |= exp & 0x0f;
};
inline void set_r_exp(uint8_t exp, SensorDataFullRecordBody& body)
{
- body.r_b_exponents &= 0x0f;
- body.r_b_exponents |= (exp & 0x0f) << 4;
+ body.rbExponents &= 0x0f;
+ body.rbExponents |= (exp & 0x0f) << 4;
};
inline void set_id_strlen(uint8_t len, SensorDataFullRecordBody& body)
{
- body.id_string_info &= ~(0x1f);
- body.id_string_info |= len & 0x1f;
+ body.idStringInfo &= ~(0x1f);
+ body.idStringInfo |= len & 0x1f;
};
inline void set_id_strlen(uint8_t len, SensorDataEventRecordBody& body)
{
- body.id_string_info &= ~(0x1f);
- body.id_string_info |= len & 0x1f;
+ body.idStringInfo &= ~(0x1f);
+ body.idStringInfo |= len & 0x1f;
};
inline uint8_t get_id_strlen(const SensorDataFullRecordBody& body)
{
- return body.id_string_info & 0x1f;
+ return body.idStringInfo & 0x1f;
};
inline void set_id_type(uint8_t type, SensorDataFullRecordBody& body)
{
- body.id_string_info &= ~(3 << 6);
- body.id_string_info |= (type & 0x3) << 6;
+ body.idStringInfo &= ~(3 << 6);
+ body.idStringInfo |= (type & 0x3) << 6;
};
inline void set_id_type(uint8_t type, SensorDataEventRecordBody& body)
{
- body.id_string_info &= ~(3 << 6);
- body.id_string_info |= (type & 0x3) << 6;
+ body.idStringInfo &= ~(3 << 6);
+ body.idStringInfo |= (type & 0x3) << 6;
};
inline void set_device_id_strlen(uint8_t len, SensorDataFruRecordBody& body)
@@ -576,7 +576,7 @@
inline void set_readable_mask(uint8_t mask, SensorDataFullRecordBody& body)
{
- body.discrete_reading_setting_mask[1] = mask & 0x3F;
+ body.discreteReadingSettingMask[1] = mask & 0x3F;
}
} // namespace body