blob: 84db5e56af0ced92ca73186d2860520ccabfe865 [file] [log] [blame]
#ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_SENSORS_PECI_HWMON_BASED_SENSOR_H_
#define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_SENSORS_PECI_HWMON_BASED_SENSOR_H_
#include <memory>
#include <optional>
#include <string>
#include "absl/status/statusor.h"
#include "boost/asio.hpp" //NOLINT: boost::asio is commonly used in BMC
#include "hal_common_config.pb.h"
#include "tlbmc/hal/sysfs/peci.h"
#include "sensor.pb.h"
#include "tlbmc/sensors/hwmon_based_sensor.h"
#include "tlbmc/sensors/sensor.h"
namespace milotic_tlbmc {
// This class is a base class for sensors that are based on Peci HWMon devices.
// All public interfaces are thread-safe.
// The `io_context` shall run only on a single thread.
class PeciHwmonBasedSensor : public HwmonBasedSensor {
public:
PeciHwmonBasedSensor(
const std::string& input_dev_path,
const std::shared_ptr<boost::asio::io_context>& io_context,
SensorAttributesStatic&& sensor_attributes_static,
const ThresholdConfigs& threshold_configs,
std::optional<NotificationCb> on_batch_notify,
const PeciSysfs& peci_sysfs);
absl::StatusOr<boost::filesystem::path> CreateDevice(
const HalCommonConfig& hal_config);
protected:
PeciHwmonBasedSensor() = default;
const PeciSysfs& peci_sysfs_;
};
} // namespace milotic_tlbmc
#endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_SENSORS_I2C_HWMON_BASED_SENSOR_H_