Chromium Code Reviews| 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 "device/generic_sensor/iio/sensor_data_iio.h" | |
| 10 #include "device/generic_sensor/public/cpp/sensor_reading.h" | |
| 11 | |
| 12 namespace device { | |
| 13 | |
| 14 // Generic reader class that reads sensors data from | |
| 15 // sensors files located in the base iio folder. | |
| 16 class SensorReader { | |
| 
 
Mikhail
2016/10/17 10:34:11
needs unit tests
 
darktears
2016/10/17 20:35:29
Potentially tricky. Not all ChromeOS have the afor
 
maksims (do not use this acc)
2016/10/18 06:50:41
There is no problem at all. It's possible to creat
 
maksims (do not use this acc)
2016/10/18 06:50:41
Got it!
 
 | |
| 17 public: | |
| 18 ~SensorReader(); | |
| 19 | |
| 20 // Creates a new instance of SensorReader if sensor read files | |
| 21 // has been found and |sensor_paths_| are set. | |
| 22 static std::unique_ptr<SensorReader> Create(const SensorDataIio& data); | |
| 23 | |
| 24 // Reads sensor values into |*reading| from sensor files | |
| 25 // specified in |sensor_paths_|. | |
| 26 bool ReadSensorReading(SensorReading* reading); | |
| 27 | |
| 28 private: | |
| 29 explicit SensorReader(std::vector<base::FilePath> sensor_paths); | |
| 30 | |
| 31 // Contains paths to sensor files that are set when | |
| 32 // Create() is called. | |
| 33 const std::vector<base::FilePath> sensor_paths_; | |
| 34 | |
| 35 DISALLOW_COPY_AND_ASSIGN(SensorReader); | |
| 36 }; | |
| 37 | |
| 38 } // namespace device | |
| 39 | |
| 40 #endif // DEVICE_GENERIC_SENSOR_IIO_PLATFORM_SENSOR_UTILS_IIO_H_ | |
| OLD | NEW |