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_LINUX_PLATFORM_SENSOR_UTILS_LINUX_H_ | |
6 #define DEVICE_GENERIC_SENSOR_LINUX_PLATFORM_SENSOR_UTILS_LINUX_H_ | |
7 | |
8 #include "base/files/file_path.h" | |
9 #include "base/memory/ptr_util.h" | |
10 #include "device/generic_sensor/generic_sensor_export.h" | |
11 | |
12 namespace device { | |
13 | |
14 struct SensorDataLinux; | |
15 struct SensorReading; | |
16 | |
17 // Generic reader class that reads sensors data from | |
18 // sensors files located in the base iio folder. | |
19 class DEVICE_GENERIC_SENSOR_EXPORT SensorReader { | |
20 public: | |
21 ~SensorReader(); | |
22 | |
23 // Creates a new instance of SensorReader if sensor read files | |
24 // has been found and |sensor_paths_| are set. | |
25 static std::unique_ptr<SensorReader> Create(const SensorDataLinux& data); | |
26 | |
27 // Reads sensor values into |*reading| from sensor files | |
28 // specified in |sensor_paths_|. | |
29 bool ReadSensorReading(SensorReading* reading); | |
30 | |
31 private: | |
32 explicit SensorReader(std::vector<base::FilePath> sensor_paths); | |
33 | |
34 // Contains paths to sensor files that are set when | |
35 // Create() is called. | |
36 const std::vector<base::FilePath> sensor_paths_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(SensorReader); | |
39 }; | |
40 | |
41 } // namespace device | |
42 | |
43 #endif // DEVICE_GENERIC_SENSOR_LINUX_PLATFORM_SENSOR_UTILS_LINUX_H_ | |
OLD | NEW |