| #ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_SENSORS_IXC_HWMON_BASED_SENSOR_H_ |
| #define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_SENSORS_IXC_HWMON_BASED_SENSOR_H_ |
| |
| #include <memory> |
| #include <optional> |
| #include <string> |
| #include <string_view> |
| |
| #include "absl/status/statusor.h" |
| #include "boost/asio.hpp" //NOLINT: boost::asio is commonly used in BMC |
| #include "hal_common_config.pb.h" |
| #include "hwmon_temp_sensor_config.pb.h" |
| #include "tlbmc/hal/sysfs/hwmon.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 I2c or I3c HWMon |
| // devices. |
| // All public interfaces are thread-safe. |
| // The `io_context` shall run only on a single thread. |
| class IXcHwmonBasedSensor : public HwmonBasedSensor { |
| public: |
| IXcHwmonBasedSensor( |
| 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 HwmonSysfs& hwmon_sysfs); |
| |
| static absl::StatusOr<boost::filesystem::path> |
| CreateIXcDeviceAndReturnsHwmonPath(const HalCommonConfig& hal_config, |
| std::string_view driver_name, |
| const HwmonSysfs& hwmon_sysfs); |
| |
| protected: |
| IXcHwmonBasedSensor() = default; |
| explicit IXcHwmonBasedSensor( |
| const std::shared_ptr<boost::asio::io_context>& io_context) |
| : HwmonBasedSensor(io_context) {} |
| |
| const HwmonSysfs* hwmon_sysfs_ = nullptr; |
| }; |
| |
| } // namespace milotic_tlbmc |
| |
| #endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_SENSORS_IXC_HWMON_BASED_SENSOR_H_ |