OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef DEVICE_GENERIC_SENSOR_IIO_PLATFORM_SENSOR_UTILS_IIO_H_ |
| 6 #define DEVICE_GENERIC_SENSOR_IIO_PLATFORM_SENSOR_UTILS_IIO_H_ |
| 7 |
| 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/ptr_util.h" |
| 10 |
| 11 namespace device { |
| 12 |
| 13 struct SensorDataIio; |
| 14 struct SensorReading; |
| 15 |
| 16 // Generic reader class that reads sensors data from |
| 17 // sensors files located in the base iio folder. |
| 18 class SensorReader { |
| 19 public: |
| 20 ~SensorReader(); |
| 21 |
| 22 // Creates a new instance of SensorReader if sensor read files |
| 23 // has been found and |sensor_paths_| are set. |
| 24 static std::unique_ptr<SensorReader> Create(const SensorDataIio& data); |
| 25 |
| 26 // Reads sensor values into |*reading| from sensor files |
| 27 // specified in |sensor_paths_|. |
| 28 bool ReadSensorReading(SensorReading* reading); |
| 29 |
| 30 private: |
| 31 explicit SensorReader(std::vector<base::FilePath> sensor_paths); |
| 32 |
| 33 // Contains paths to sensor files that are set when |
| 34 // Create() is called. |
| 35 const std::vector<base::FilePath> sensor_paths_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(SensorReader); |
| 38 }; |
| 39 |
| 40 } // namespace device |
| 41 |
| 42 #endif // DEVICE_GENERIC_SENSOR_IIO_PLATFORM_SENSOR_UTILS_IIO_H_ |
OLD | NEW |