Clean up codes
This commit cleans up codes to follow coding style and conventions
of OpenBMC.
Change-Id: Ib2a9b2589b839db6eb0f31b392b3fa54aef3a8c6
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
diff --git a/sensors/include/ADCSensor.hpp b/sensors/include/ADCSensor.hpp
index d59bd5f..e15ba0a 100644
--- a/sensors/include/ADCSensor.hpp
+++ b/sensors/include/ADCSensor.hpp
@@ -12,27 +12,26 @@
ADCSensor(const std::string &path,
sdbusplus::asio::object_server &objectServer,
std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &sensor_name,
+ boost::asio::io_service &io, const std::string &sensorName,
std::vector<thresholds::Threshold> &&thresholds,
- const double scale_factor,
- const std::string &sensorConfiguration);
+ const double scaleFactor, const std::string &sensorConfiguration);
~ADCSensor();
private:
std::string path;
sdbusplus::asio::object_server &objServer;
- boost::asio::posix::stream_descriptor input_dev;
- boost::asio::deadline_timer wait_timer;
- boost::asio::streambuf read_buf;
- int err_count;
- double max_value;
- double min_value;
- double scale_factor;
- void setup_read(void);
- void handle_response(const boost::system::error_code &err);
- void check_thresholds(void);
- void update_value(const double &new_value);
+ boost::asio::posix::stream_descriptor inputDev;
+ boost::asio::deadline_timer waitTimer;
+ boost::asio::streambuf readBuf;
+ int errCount;
+ double maxValue;
+ double minValue;
+ double scaleFactor;
+ void setupRead(void);
+ void handleResponse(const boost::system::error_code &err);
+ void checkThresholds(void);
+ void updateValue(const double &newValue);
- void set_initial_properties(
+ void setInitialProperties(
std::shared_ptr<sdbusplus::asio::connection> &conn);
-};
\ No newline at end of file
+};
diff --git a/sensors/include/CPUSensor.hpp b/sensors/include/CPUSensor.hpp
index 4229801..c4fca5d 100644
--- a/sensors/include/CPUSensor.hpp
+++ b/sensors/include/CPUSensor.hpp
@@ -10,31 +10,31 @@
std::string name;
std::string configuration;
CPUSensor(const std::string &path, const std::string &objectType,
- sdbusplus::asio::object_server &object_server,
+ sdbusplus::asio::object_server &objectServer,
std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &fan_name,
+ boost::asio::io_service &io, const std::string &fanName,
std::vector<thresholds::Threshold> &&thresholds,
const std::string &configuration);
~CPUSensor();
- constexpr static unsigned int SENSOR_SCALE_FACTOR = 1000;
- constexpr static unsigned int SENSOR_POLL_MS = 1000;
+ static constexpr unsigned int sensorScaleFactor = 1000;
+ static constexpr unsigned int sensorPollMs = 1000;
private:
std::string path;
std::string objectType;
sdbusplus::asio::object_server &objServer;
std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
- boost::asio::posix::stream_descriptor input_dev;
- boost::asio::deadline_timer wait_timer;
- boost::asio::streambuf read_buf;
- int err_count;
- double max_value;
- double min_value;
- void setup_read(void);
- void handle_response(const boost::system::error_code &err);
- void check_thresholds(void);
- void update_value(const double &new_value);
+ boost::asio::posix::stream_descriptor inputDev;
+ boost::asio::deadline_timer waitTimer;
+ boost::asio::streambuf readBuf;
+ int errCount;
+ double maxValue;
+ double minValue;
+ void setupRead(void);
+ void handleResponse(const boost::system::error_code &err);
+ void checkThresholds(void);
+ void updateValue(const double &newValue);
- void set_initial_properties(
+ void setInitialProperties(
std::shared_ptr<sdbusplus::asio::connection> &conn);
};
diff --git a/sensors/include/HwmonTempSensor.hpp b/sensors/include/HwmonTempSensor.hpp
index ebdaea6..14cb6c7 100644
--- a/sensors/include/HwmonTempSensor.hpp
+++ b/sensors/include/HwmonTempSensor.hpp
@@ -12,7 +12,7 @@
HwmonTempSensor(const std::string &path, const std::string &objectType,
sdbusplus::asio::object_server &objectServer,
std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &fan_name,
+ boost::asio::io_service &io, const std::string &fanName,
std::vector<thresholds::Threshold> &&thresholds,
const std::string &sensorConfiguration);
~HwmonTempSensor();
@@ -21,17 +21,17 @@
std::string path;
std::string objectType;
sdbusplus::asio::object_server &objServer;
- boost::asio::posix::stream_descriptor input_dev;
- boost::asio::deadline_timer wait_timer;
- boost::asio::streambuf read_buf;
- int err_count;
- double max_value;
- double min_value;
- void setup_read(void);
- void handle_response(const boost::system::error_code &err);
- void check_thresholds(void);
- void update_value(const double &new_value);
+ boost::asio::posix::stream_descriptor inputDev;
+ boost::asio::deadline_timer waitTimer;
+ boost::asio::streambuf readBuf;
+ int errCount;
+ double maxValue;
+ double minValue;
+ void setupRead(void);
+ void handleResponse(const boost::system::error_code &err);
+ void checkThresholds(void);
+ void updateValue(const double &newValue);
- void set_initial_properties(
+ void setInitialProperties(
std::shared_ptr<sdbusplus::asio::connection> &conn);
};
\ No newline at end of file
diff --git a/sensors/include/PwmSensor.hpp b/sensors/include/PwmSensor.hpp
index 9429099..0a712fb 100644
--- a/sensors/include/PwmSensor.hpp
+++ b/sensors/include/PwmSensor.hpp
@@ -17,4 +17,4 @@
std::shared_ptr<sdbusplus::asio::dbus_interface> controlInterface;
void setValue(uint32_t value);
uint32_t getValue(bool errThrow = true);
-};
\ No newline at end of file
+};
diff --git a/sensors/include/TachSensor.hpp b/sensors/include/TachSensor.hpp
index e352855..33d2da0 100644
--- a/sensors/include/TachSensor.hpp
+++ b/sensors/include/TachSensor.hpp
@@ -12,7 +12,7 @@
TachSensor(const std::string &path,
sdbusplus::asio::object_server &objectServer,
std::shared_ptr<sdbusplus::asio::connection> &conn,
- boost::asio::io_service &io, const std::string &fan_name,
+ boost::asio::io_service &io, const std::string &fanName,
std::vector<thresholds::Threshold> &&thresholds,
const std::string &sensorConfiguration);
~TachSensor();
@@ -21,17 +21,17 @@
std::string path;
sdbusplus::asio::object_server &objServer;
std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
- boost::asio::posix::stream_descriptor input_dev;
- boost::asio::deadline_timer wait_timer;
- boost::asio::streambuf read_buf;
- int err_count;
- double max_value;
- double min_value;
- void setup_read(void);
- void handle_response(const boost::system::error_code &err);
- void check_thresholds(void);
- void update_value(const double &new_value);
+ boost::asio::posix::stream_descriptor inputDev;
+ boost::asio::deadline_timer waitTimer;
+ boost::asio::streambuf readBuf;
+ int errCount;
+ double maxValue;
+ double minValue;
+ void setupRead(void);
+ void handleResponse(const boost::system::error_code &err);
+ void checkThresholds(void);
+ void updateValue(const double &newValue);
- void set_initial_properties(
+ void setInitialProperties(
std::shared_ptr<sdbusplus::asio::connection> &conn);
};
diff --git a/sensors/include/Thresholds.hpp b/sensors/include/Thresholds.hpp
index 1a6f752..4a07ca2 100644
--- a/sensors/include/Thresholds.hpp
+++ b/sensors/include/Thresholds.hpp
@@ -30,19 +30,19 @@
bool asserted = false;
};
-bool ParseThresholdsFromConfig(
+bool parseThresholdsFromConfig(
const SensorData &sensorData,
std::vector<thresholds::Threshold> &thresholdVector,
const std::string *matchLabel = nullptr);
-bool ParseThresholdsFromAttr(std::vector<thresholds::Threshold> &thresholds,
- const std::string &input_path,
- const double &scale_factor);
-bool HasCriticalInterface(
- const std::vector<thresholds::Threshold> &threshold_vector);
+bool parseThresholdsFromAttr(std::vector<thresholds::Threshold> &thresholds,
+ const std::string &inputPath,
+ const double &scaleFactor);
+bool hasCriticalInterface(
+ const std::vector<thresholds::Threshold> &thresholdVector);
-bool HasWarningInterface(
- const std::vector<thresholds::Threshold> &threshold_vector);
+bool hasWarningInterface(
+ const std::vector<thresholds::Threshold> &thresholdVector);
void persistThreshold(const std::string &baseInterface, const std::string &path,
const thresholds::Threshold &threshold,
diff --git a/sensors/include/Utils.hpp b/sensors/include/Utils.hpp
index 0f1a5db..8d9eac5 100644
--- a/sensors/include/Utils.hpp
+++ b/sensors/include/Utils.hpp
@@ -6,10 +6,10 @@
#include <sdbusplus/asio/connection.hpp>
#include <sdbusplus/message/types.hpp>
-const constexpr char* JSON_STORE = "/var/configuration/flattened.json";
-const constexpr char* INVENTORY_PATH = "/xyz/openbmc_project/inventory";
-const constexpr char* ENTITY_MANAGER_NAME = "xyz.openbmc_project.EntityManager";
-const std::regex ILLEGAL_DBUS_REGEX("[^A-Za-z0-9_]");
+const constexpr char* jsonStore = "/var/configuration/flattened.json";
+const constexpr char* inventoryPath = "/xyz/openbmc_project/inventory";
+const constexpr char* entityManagerName = "xyz.openbmc_project.EntityManager";
+const std::regex illegalDbusRegex("[^A-Za-z0-9_]");
using BasicVariantType =
sdbusplus::message::variant<std::string, int64_t, uint64_t, double, int32_t,
@@ -23,10 +23,10 @@
using SensorData = boost::container::flat_map<
std::string, boost::container::flat_map<std::string, BasicVariantType>>;
-bool find_files(const std::experimental::filesystem::path dir_path,
- const std::string& match_string,
- std::vector<std::experimental::filesystem::path>& found_paths,
- unsigned int symlink_depth = 1);
+bool findFiles(const std::experimental::filesystem::path dirPath,
+ const std::string& matchString,
+ std::vector<std::experimental::filesystem::path>& foundPaths,
+ unsigned int symlinkDepth = 1);
bool isPowerOn(const std::shared_ptr<sdbusplus::asio::connection>& conn);
bool getSensorConfiguration(
const std::string& type,