| // Copyright 2015 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_ATH10K_TEMPERATURE_SENSOR_H_ |
| #define THERMALD_ATH10K_TEMPERATURE_SENSOR_H_ |
| |
| #include <memory> |
| #include <string> |
| |
| #include "base/macros.h" |
| |
| #include "thermald/ath10k_interface.h" |
| #include "thermald/hwmon_temperature_sensor.h" |
| #include "thermald/temperature_sensor_common.h" |
| |
| namespace thermald { |
| |
| // Class to interface with the temperature sensor of an ath10k wireless |
| // interface. |
| class Ath10kTemperatureSensor : public TemperatureSensorCommon { |
| public: |
| // Constructs a temperature sensor corresponding to the sensor of the ath10k |
| // interface with the given name. |
| explicit Ath10kTemperatureSensor(const std::string &interface_name); |
| |
| // Constructs a temperature sensor with a custom name corresponding |
| // to the sensor of the ath10k interface with the given interface name. |
| Ath10kTemperatureSensor(const std::string &interface_name, |
| const std::string &sensor_name); |
| |
| // Read the temperature from the sensor. |
| bool ReadTemperature(int *value) override; |
| |
| // Returns true if the sensor is operational, false otherwise. |
| // The temperarure sensor of an ath10k interface can only be read when |
| // the interface is active. |
| bool IsOperational() override; |
| |
| private: |
| bool Initialize(); |
| |
| const std::string interface_name_; |
| std::unique_ptr<Ath10kInterface> ath10k_interface_; |
| std::unique_ptr<HwmonTemperatureSensor> hwmon_sensor_; |
| bool no_thermal_support_; |
| |
| DISALLOW_COPY_AND_ASSIGN(Ath10kTemperatureSensor); |
| }; |
| |
| } // namespace thermald |
| |
| #endif // THERMALD_ATH10K_TEMPERATURE_SENSOR_H_ |