Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(869)

Unified Diff: device/generic_sensor/linux/platform_sensor_utils_linux.h

Issue 2480773002: Reland of [sensors] Ambient light sensor implementation for ChromeOS and Linux. (Closed)
Patch Set: remove parenthesis Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/generic_sensor/BUILD.gn ('k') | device/generic_sensor/linux/platform_sensor_utils_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/generic_sensor/linux/platform_sensor_utils_linux.h
diff --git a/device/generic_sensor/linux/platform_sensor_utils_linux.h b/device/generic_sensor/linux/platform_sensor_utils_linux.h
new file mode 100644
index 0000000000000000000000000000000000000000..593ba31c4670251b63b0287b1af35aab7931f7a6
--- /dev/null
+++ b/device/generic_sensor/linux/platform_sensor_utils_linux.h
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium 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 DEVICE_GENERIC_SENSOR_LINUX_PLATFORM_SENSOR_UTILS_LINUX_H_
+#define DEVICE_GENERIC_SENSOR_LINUX_PLATFORM_SENSOR_UTILS_LINUX_H_
+
+#include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
+#include "device/generic_sensor/generic_sensor_export.h"
+
+namespace device {
+
+struct SensorDataLinux;
+struct SensorReading;
+
+// Generic reader class that reads sensors data from
+// sensors files located in the base iio folder.
+class DEVICE_GENERIC_SENSOR_EXPORT SensorReader {
+ public:
+ ~SensorReader();
+
+ // Creates a new instance of SensorReader if sensor read files
+ // has been found and |sensor_paths_| are set.
+ static std::unique_ptr<SensorReader> Create(const SensorDataLinux& data);
+
+ // Reads sensor values into |*reading| from sensor files
+ // specified in |sensor_paths_|.
+ bool ReadSensorReading(SensorReading* reading);
+
+ private:
+ explicit SensorReader(std::vector<base::FilePath> sensor_paths);
+
+ // Contains paths to sensor files that are set when
+ // Create() is called.
+ const std::vector<base::FilePath> sensor_paths_;
+
+ DISALLOW_COPY_AND_ASSIGN(SensorReader);
+};
+
+} // namespace device
+
+#endif // DEVICE_GENERIC_SENSOR_LINUX_PLATFORM_SENSOR_UTILS_LINUX_H_
« no previous file with comments | « device/generic_sensor/BUILD.gn ('k') | device/generic_sensor/linux/platform_sensor_utils_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698