Index: device/generic_sensor/iio/sensor_data_iio.cc |
diff --git a/device/generic_sensor/iio/sensor_data_iio.cc b/device/generic_sensor/iio/sensor_data_iio.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ce42fd732893ff73f5d512a791d659823ab84197 |
--- /dev/null |
+++ b/device/generic_sensor/iio/sensor_data_iio.cc |
@@ -0,0 +1,49 @@ |
+// 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. |
+ |
+#include "device/generic_sensor/iio/sensor_data_iio.h" |
+#include "device/sensors/public/cpp/device_sensors_consts.h" |
+ |
+namespace device { |
+ |
+namespace { |
+ |
+using mojom::SensorType; |
+ |
+const char* kAmbientLightFileNames[][5] = { |
+ {"in_illuminance0_input", "in_illuminance_input", "in_illuminance0_raw", |
+ "in_illuminance_raw", "illuminance0_input"}}; |
+ |
+// An exampleaw_content_browser_client.cc of other sensor: |
+// |
+// const char* kAccelerometerFileNames[3][3] = { |
+// { "x1", "x2", "x3", }, |
+// { "y1", "y2", "y3", }, |
+// { "z1", "z2", "z3", }, |
+// }; |
+ |
+} // namespace |
+ |
+const char* SensorDataIio::base_path_sensor_iio = |
Mikhail
2016/10/17 10:34:11
FilePath::CharType != char*
maksims (do not use this acc)
2016/10/18 06:50:42
Done.
|
+ FILE_PATH_LITERAL("/sys/bus/iio/devices"); |
+ |
+bool CreateSensorData(SensorType type, SensorDataIio* data) { |
+ DCHECK(data); |
+ switch (type) { |
+ case SensorType::AMBIENT_LIGHT: |
+ data->sensor_file_names[0] = &kAmbientLightFileNames[0][0]; |
+ data->sensor_file_names_cols = arraysize(*kAmbientLightFileNames); |
+ data->sensor_file_names_rows = arraysize(kAmbientLightFileNames); |
+ data->reporting_mode = mojom::ReportingMode::ON_CHANGE; |
+ data->default_configuration = |
+ PlatformSensorConfiguration(kDefaultAmbientLightFrequencyHz); |
+ break; |
+ default: |
+ NOTIMPLEMENTED(); |
+ return false; |
+ } |
+ return true; |
+} |
+ |
+} // namespace device |