| // Copyright 2019 The Chromium OS Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef THERMALD_IIO_TEMPERATURE_SENSOR_H_ |
| #define THERMALD_IIO_TEMPERATURE_SENSOR_H_ |
| |
| #include <memory> |
| #include <string> |
| |
| #include "base/files/file_path.h" |
| #include "base/macros.h" |
| |
| #include "thermald/temperature_sensor_common.h" |
| |
| using std::string; |
| |
| namespace thermald { |
| |
| // Class to read the temperature from a sensor exposed as IIO sensor. |
| class IioTemperatureSensor : public TemperatureSensorCommon { |
| public: |
| explicit IioTemperatureSensor(const string &name, |
| const base::FilePath &iio_dev_path, |
| const string &iio_sensor_name); |
| bool ReadTemperature(int *value); |
| |
| static std::unique_ptr<IioTemperatureSensor> |
| Get(const string &name, const string &iio_device_name, |
| const string &iio_sensor_name); |
| |
| private: |
| const base::FilePath sysfs_attr_input_; |
| |
| DISALLOW_COPY_AND_ASSIGN(IioTemperatureSensor); |
| }; |
| |
| } // namespace thermald |
| |
| #endif // THERMALD_IIO_TEMPERATURE_SENSOR_H_ |