sensorhandler: Method names use camelCase
Change-Id: Ib0c92d9eee70a7b416832be91d9da155aea62cbf
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index 19ba192..bd96ea2 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -1904,8 +1904,8 @@
// populate sensor name from path
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"
+ get_sdr::body::setIdStrLen(name.size(), record.body);
+ get_sdr::body::setIdType(3, record.body); // "8-bit ASCII + Latin 1"
std::memcpy(record.body.idString, name.c_str(),
std::min(name.length() + 1, sizeof(record.body.idString)));
@@ -1920,7 +1920,7 @@
sensorSettable =
mappedVariant<bool>(mutability->second, "Mutable", false);
}
- get_sdr::body::init_settable_state(sensorSettable, record.body);
+ get_sdr::body::initSettableState(sensorSettable, record.body);
// Grant write permission to sensors deemed externally settable
details::sdrWriteTable.setWritePermission(sensorNum, sensorSettable);
@@ -2007,7 +2007,7 @@
if (ipmi::sensor::Mutability::Write ==
(sensor->second.mutability & ipmi::sensor::Mutability::Write))
{
- get_sdr::body::init_settable_state(true, record.body);
+ get_sdr::body::initSettableState(true, record.body);
}
auto idString = sensor->second.sensorName;
@@ -2019,16 +2019,15 @@
if (idString.length() > FULL_RECORD_ID_STR_MAX_LENGTH)
{
- get_sdr::body::set_id_strlen(FULL_RECORD_ID_STR_MAX_LENGTH,
- record.body);
+ get_sdr::body::setIdStrLen(FULL_RECORD_ID_STR_MAX_LENGTH, record.body);
}
else
{
- get_sdr::body::set_id_strlen(idString.length(), record.body);
+ get_sdr::body::setIdStrLen(idString.length(), record.body);
}
- get_sdr::body::set_id_type(3, &record.body); // "8-bit ASCII + Latin 1"
+ get_sdr::body::setIdType(3, &record.body); // "8-bit ASCII + Latin 1"
std::strncpy(record.body.idString, idString.c_str(),
- get_sdr::body::get_id_strlen(record.body));
+ get_sdr::body::setIdStrLen(record.body));
}
#endif
@@ -2088,8 +2087,8 @@
// populate sensor name from path
auto name = sensor::parseSdrIdFromPath(path);
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"
+ get_sdr::body::setIdStrLen(nameSize, record.body);
+ get_sdr::body::setIdType(3, record.body); // "8-bit ASCII + Latin 1"
std::memset(record.body.idString, 0x00, sizeof(record.body.idString));
std::memcpy(record.body.idString, name.c_str(), nameSize);
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index 434e220..fb7879e 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -1207,8 +1207,8 @@
/* Key */
data.key.containerEntityId = entity->second.containerEntityId;
data.key.containerEntityInstance = entity->second.containerEntityInstance;
- get_sdr::key::set_flags(entity->second.isList, entity->second.isLinked,
- data.key);
+ get_sdr::key::setFlags(entity->second.isList, entity->second.isLinked,
+ data.key);
data.key.entityId1 = entity->second.containedEntities[0].first;
data.key.entityInstance1 = entity->second.containedEntities[0].second;
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 78d1e9d..9165408 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -1113,7 +1113,7 @@
body.sensorUnits2Base = get_sdr::SENSOR_UNIT_WATTS;
break;
case server::Value::Unit::Percent:
- get_sdr::body::set_percentage(body);
+ get_sdr::body::setPercentage(body);
break;
default:
// Cannot be hit.
@@ -1127,8 +1127,8 @@
}
}
-ipmi::Cc populate_record_from_dbus(const ipmi::sensor::Info& info,
- get_sdr::SensorDataFullRecordBody& body)
+ipmi::Cc populateRecordFromDbus(const ipmi::sensor::Info& info,
+ get_sdr::SensorDataFullRecordBody& body)
{
/* Functional sensor case */
if (isAnalogSensor(info.propertyInterfaces.begin()->first))
@@ -1136,10 +1136,10 @@
/* Unit info */
setUnitFieldsForObject(info, body);
- get_sdr::body::set_b(info.coefficientB, body);
- get_sdr::body::set_m(info.coefficientM, body);
- get_sdr::body::set_b_exp(info.exponentB, body);
- get_sdr::body::set_r_exp(info.exponentR, body);
+ get_sdr::body::setB(info.coefficientB, body);
+ get_sdr::body::setM(info.coefficientM, body);
+ get_sdr::body::setBexp(info.exponentB, body);
+ get_sdr::body::setRexp(info.exponentR, body);
}
/* ID string */
@@ -1152,15 +1152,14 @@
if (idString.length() > FULL_RECORD_ID_STR_MAX_LENGTH)
{
- get_sdr::body::set_id_strlen(FULL_RECORD_ID_STR_MAX_LENGTH, body);
+ get_sdr::body::setIdStrLen(FULL_RECORD_ID_STR_MAX_LENGTH, body);
}
else
{
- get_sdr::body::set_id_strlen(idString.length(), body);
+ get_sdr::body::setIdStrLen(idString.length(), body);
}
- get_sdr::body::set_id_type(3, body); // "8-bit ASCII + Latin 1"
- strncpy(body.idString, idString.c_str(),
- get_sdr::body::get_id_strlen(body));
+ get_sdr::body::setIdType(3, body); // "8-bit ASCII + Latin 1"
+ strncpy(body.idString, idString.c_str(), get_sdr::body::getIdStrLen(body));
return ipmi::ccSuccess;
};
@@ -1205,17 +1204,17 @@
if (deviceID.length() > get_sdr::FRU_RECORD_DEVICE_ID_MAX_LENGTH)
{
- get_sdr::body::set_device_id_strlen(
+ get_sdr::body::setDeviceIdStrLen(
get_sdr::FRU_RECORD_DEVICE_ID_MAX_LENGTH, record.body);
}
else
{
- get_sdr::body::set_device_id_strlen(deviceID.length(), record.body);
+ get_sdr::body::setDeviceIdStrLen(deviceID.length(), record.body);
}
uint16_t nextRecordId{};
strncpy(record.body.deviceID, deviceID.c_str(),
- get_sdr::body::get_device_id_strlen(record.body));
+ get_sdr::body::getDeviceIdStrLen(record.body));
if (++fru == frus.end())
{
@@ -1278,8 +1277,8 @@
/* Key */
record.key.containerEntityId = entity->second.containerEntityId;
record.key.containerEntityInstance = entity->second.containerEntityInstance;
- get_sdr::key::set_flags(entity->second.isList, entity->second.isLinked,
- record.key);
+ get_sdr::key::setFlags(entity->second.isList, entity->second.isLinked,
+ record.key);
record.key.entityId1 = entity->second.containedEntities[0].first;
record.key.entityInstance1 = entity->second.containedEntities[0].second;
@@ -1367,7 +1366,7 @@
record.header.recordLength = sizeof(record.key) + sizeof(record.body);
/* Key */
- get_sdr::key::set_owner_id_bmc(record.key);
+ get_sdr::key::setOwnerIdBmc(record.key);
record.key.sensorNumber = sensorId;
/* Body */
@@ -1378,11 +1377,11 @@
if (ipmi::sensor::Mutability::Write ==
(sensor->second.mutability & ipmi::sensor::Mutability::Write))
{
- get_sdr::body::init_settable_state(true, record.body);
+ get_sdr::body::initSettableState(true, record.body);
}
// Set the type-specific details given the DBus interface
- populate_record_from_dbus(sensor->second, record.body);
+ populateRecordFromDbus(sensor->second, record.body);
sdrCacheMap[sensorId] = std::move(record);
}
diff --git a/sensorhandler.hpp b/sensorhandler.hpp
index 5d58a6c..79ad489 100644
--- a/sensorhandler.hpp
+++ b/sensorhandler.hpp
@@ -149,41 +149,40 @@
static constexpr uint8_t listOrRangeBit = 7;
static constexpr uint8_t linkedBit = 6;
-inline void set_owner_id_ipmb(SensorDataRecordKey& key)
+inline void setOwnerIdIpmb(SensorDataRecordKey& key)
{
key.ownerId &= ~0x01;
};
-inline void set_owner_id_system_sw(SensorDataRecordKey& key)
+inline void setOwnerIdSystemSw(SensorDataRecordKey& key)
{
key.ownerId |= 0x01;
};
-inline void set_owner_id_bmc(SensorDataRecordKey& key)
+inline void setOwnerIdBmc(SensorDataRecordKey& key)
{
key.ownerId |= 0x20;
};
-inline void set_owner_id_address(uint8_t addr, SensorDataRecordKey& key)
+inline void setOwnerIdAddress(uint8_t addr, SensorDataRecordKey& key)
{
key.ownerId &= 0x01;
key.ownerId |= addr << 1;
};
-inline void set_owner_lun(uint8_t lun, SensorDataRecordKey& key)
+inline void setOwnerLun(uint8_t lun, SensorDataRecordKey& key)
{
key.ownerLun &= ~0x03;
key.ownerLun |= (lun & 0x03);
};
-inline void set_owner_lun_channel(uint8_t channel, SensorDataRecordKey& key)
+inline void setOwnerLunChannel(uint8_t channel, SensorDataRecordKey& key)
{
key.ownerLun &= 0x0f;
key.ownerLun |= ((channel & 0xf) << 4);
};
-inline void set_flags(bool isList, bool isLinked,
- SensorDataEntityRecordKey& key)
+inline void setFlags(bool isList, bool isLinked, SensorDataEntityRecordKey& key)
{
key.flags = 0x00;
if (!isList)
@@ -338,24 +337,23 @@
namespace body
{
-inline void set_entity_instance_number(uint8_t n,
- SensorDataFullRecordBody& body)
+inline void setEntityInstanceNumber(uint8_t n, SensorDataFullRecordBody& body)
{
body.entityInstance &= 1 << 7;
body.entityInstance |= (n & ~(1 << 7));
};
-inline void set_entity_physical_entity(SensorDataFullRecordBody& body)
+inline void setEntityPhysicalEntity(SensorDataFullRecordBody& body)
{
body.entityInstance &= ~(1 << 7);
};
-inline void set_entity_logical_container(SensorDataFullRecordBody& body)
+inline void setEntityLogicalContainer(SensorDataFullRecordBody& body)
{
body.entityInstance |= 1 << 7;
};
-inline void sensor_scanning_state(bool enabled, SensorDataFullRecordBody& body)
+inline void sensorScanningState(bool enabled, SensorDataFullRecordBody& body)
{
if (enabled)
{
@@ -367,7 +365,7 @@
};
};
-inline void event_generation_state(bool enabled, SensorDataFullRecordBody& body)
+inline void eventGenerationState(bool enabled, SensorDataFullRecordBody& body)
{
if (enabled)
{
@@ -379,7 +377,7 @@
}
};
-inline void init_types_state(bool enabled, SensorDataFullRecordBody& body)
+inline void initTypesState(bool enabled, SensorDataFullRecordBody& body)
{
if (enabled)
{
@@ -391,7 +389,7 @@
}
};
-inline void init_hyst_state(bool enabled, SensorDataFullRecordBody& body)
+inline void initHystState(bool enabled, SensorDataFullRecordBody& body)
{
if (enabled)
{
@@ -403,7 +401,7 @@
}
};
-inline void init_thresh_state(bool enabled, SensorDataFullRecordBody& body)
+inline void initThreshState(bool enabled, SensorDataFullRecordBody& body)
{
if (enabled)
{
@@ -415,7 +413,7 @@
}
};
-inline void init_events_state(bool enabled, SensorDataFullRecordBody& body)
+inline void initEventsState(bool enabled, SensorDataFullRecordBody& body)
{
if (enabled)
{
@@ -427,7 +425,7 @@
}
};
-inline void init_scanning_state(bool enabled, SensorDataFullRecordBody& body)
+inline void initScanningState(bool enabled, SensorDataFullRecordBody& body)
{
if (enabled)
{
@@ -439,7 +437,7 @@
}
};
-inline void init_settable_state(bool enabled, SensorDataFullRecordBody& body)
+inline void initSettableState(bool enabled, SensorDataFullRecordBody& body)
{
if (enabled)
{
@@ -451,56 +449,55 @@
}
};
-inline void set_percentage(SensorDataFullRecordBody& body)
+inline void setPercentage(SensorDataFullRecordBody& body)
{
body.sensorUnits1 |= 1 << 0;
};
-inline void unset_percentage(SensorDataFullRecordBody& body)
+inline void unsetPercentage(SensorDataFullRecordBody& body)
{
body.sensorUnits1 &= ~(1 << 0);
};
-inline void set_modifier_operation(uint8_t op, SensorDataFullRecordBody& body)
+inline void setModifierOperation(uint8_t op, SensorDataFullRecordBody& body)
{
body.sensorUnits1 &= ~(3 << 1);
body.sensorUnits1 |= (op & 0x3) << 1;
};
-inline void set_rate_unit(uint8_t unit, SensorDataFullRecordBody& body)
+inline void setRateUnit(uint8_t unit, SensorDataFullRecordBody& body)
{
body.sensorUnits1 &= ~(7 << 3);
body.sensorUnits1 |= (unit & 0x7) << 3;
};
-inline void set_analog_data_format(uint8_t format,
- SensorDataFullRecordBody& body)
+inline void setAnalogDataFormat(uint8_t format, SensorDataFullRecordBody& body)
{
body.sensorUnits1 &= ~(3 << 6);
body.sensorUnits1 |= (format & 0x3) << 6;
};
-inline void set_m(uint16_t m, SensorDataFullRecordBody& body)
+inline void setM(uint16_t m, SensorDataFullRecordBody& body)
{
body.mLsb = m & 0xff;
body.mMsbAndTolerance &= ~(3 << 6);
body.mMsbAndTolerance |= ((m & (3 << 8)) >> 2);
};
-inline void set_tolerance(uint8_t tol, SensorDataFullRecordBody& body)
+inline void setTolerance(uint8_t tol, SensorDataFullRecordBody& body)
{
body.mMsbAndTolerance &= ~0x3f;
body.mMsbAndTolerance |= tol & 0x3f;
};
-inline void set_b(uint16_t b, SensorDataFullRecordBody& body)
+inline void setB(uint16_t b, SensorDataFullRecordBody& body)
{
body.bLsb = b & 0xff;
body.bMsbAndAccuracyLsb &= ~(3 << 6);
body.bMsbAndAccuracyLsb |= ((b & (3 << 8)) >> 2);
};
-inline void set_accuracy(uint16_t acc, SensorDataFullRecordBody& body)
+inline void setAccuracy(uint16_t acc, SensorDataFullRecordBody& body)
{
// bottom 6 bits
body.bMsbAndAccuracyLsb &= ~0x3f;
@@ -510,71 +507,71 @@
body.accuracyAndSensorDirection |= ((acc >> 6) & 0xf) << 4;
};
-inline void set_accuracy_exp(uint8_t exp, SensorDataFullRecordBody& body)
+inline void setAccuracyExp(uint8_t exp, SensorDataFullRecordBody& body)
{
body.accuracyAndSensorDirection &= ~(3 << 2);
body.accuracyAndSensorDirection |= (exp & 3) << 2;
};
-inline void set_sensor_dir(uint8_t dir, SensorDataFullRecordBody& body)
+inline void setSensorDir(uint8_t dir, SensorDataFullRecordBody& body)
{
body.accuracyAndSensorDirection &= ~(3 << 0);
body.accuracyAndSensorDirection |= (dir & 3);
};
-inline void set_b_exp(uint8_t exp, SensorDataFullRecordBody& body)
+inline void setBexp(uint8_t exp, SensorDataFullRecordBody& body)
{
body.rbExponents &= 0xf0;
body.rbExponents |= exp & 0x0f;
};
-inline void set_r_exp(uint8_t exp, SensorDataFullRecordBody& body)
+inline void setRexp(uint8_t exp, SensorDataFullRecordBody& body)
{
body.rbExponents &= 0x0f;
body.rbExponents |= (exp & 0x0f) << 4;
};
-inline void set_id_strlen(uint8_t len, SensorDataFullRecordBody& body)
+inline void setIdStrLen(uint8_t len, SensorDataFullRecordBody& body)
{
body.idStringInfo &= ~(0x1f);
body.idStringInfo |= len & 0x1f;
};
-inline void set_id_strlen(uint8_t len, SensorDataEventRecordBody& body)
+inline void setIdStrLen(uint8_t len, SensorDataEventRecordBody& body)
{
body.idStringInfo &= ~(0x1f);
body.idStringInfo |= len & 0x1f;
};
-inline uint8_t get_id_strlen(const SensorDataFullRecordBody& body)
+inline uint8_t getIdStrLen(const SensorDataFullRecordBody& body)
{
return body.idStringInfo & 0x1f;
};
-inline void set_id_type(uint8_t type, SensorDataFullRecordBody& body)
+inline void setIdType(uint8_t type, SensorDataFullRecordBody& body)
{
body.idStringInfo &= ~(3 << 6);
body.idStringInfo |= (type & 0x3) << 6;
};
-inline void set_id_type(uint8_t type, SensorDataEventRecordBody& body)
+inline void setIdType(uint8_t type, SensorDataEventRecordBody& body)
{
body.idStringInfo &= ~(3 << 6);
body.idStringInfo |= (type & 0x3) << 6;
};
-inline void set_device_id_strlen(uint8_t len, SensorDataFruRecordBody& body)
+inline void setDeviceIdStrLen(uint8_t len, SensorDataFruRecordBody& body)
{
body.deviceIDLen &= ~(LENGTH_MASK);
body.deviceIDLen |= len & LENGTH_MASK;
};
-inline uint8_t get_device_id_strlen(const SensorDataFruRecordBody& body)
+inline uint8_t getDeviceIdStrLen(const SensorDataFruRecordBody& body)
{
return body.deviceIDLen & LENGTH_MASK;
};
-inline void set_readable_mask(uint8_t mask, SensorDataFullRecordBody& body)
+inline void setReadableMask(uint8_t mask, SensorDataFullRecordBody& body)
{
body.discreteReadingSettingMask[1] = mask & 0x3F;
}