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 #include "device/generic_sensor/iio/sensor_data_iio.h" |
| 6 #include "device/sensors/public/cpp/device_sensors_consts.h" |
| 7 |
| 8 namespace device { |
| 9 |
| 10 namespace { |
| 11 |
| 12 using mojom::SensorType; |
| 13 |
| 14 const base::FilePath::CharType* kSensorsBasePath = |
| 15 FILE_PATH_LITERAL("/sys/bus/iio/devices"); |
| 16 |
| 17 const char* kAmbientLightFileNames[][5] = { |
| 18 {"in_illuminance0_input", "in_illuminance_input", "in_illuminance0_raw", |
| 19 "in_illuminance_raw", "illuminance0_input"}}; |
| 20 |
| 21 // An exampleaw_content_browser_client.cc of other sensor: |
| 22 // |
| 23 // const char* kAccelerometerFileNames[3][3] = { |
| 24 // { "x1", "x2", "x3", }, |
| 25 // { "y1", "y2", "y3", }, |
| 26 // { "z1", "z2", "z3", }, |
| 27 // }; |
| 28 |
| 29 } // namespace |
| 30 |
| 31 bool InitSensorData(SensorType type, SensorDataIio* data) { |
| 32 DCHECK(data); |
| 33 |
| 34 switch (type) { |
| 35 case SensorType::AMBIENT_LIGHT: |
| 36 data->sensor_file_names[0] = &kAmbientLightFileNames[0][0]; |
| 37 data->sensor_file_names_cols = arraysize(*kAmbientLightFileNames); |
| 38 data->sensor_file_names_rows = arraysize(kAmbientLightFileNames); |
| 39 data->reporting_mode = mojom::ReportingMode::ON_CHANGE; |
| 40 data->default_configuration = |
| 41 PlatformSensorConfiguration(kDefaultAmbientLightFrequencyHz); |
| 42 break; |
| 43 default: |
| 44 NOTIMPLEMENTED(); |
| 45 return false; |
| 46 } |
| 47 data->base_path_sensor_iio = kSensorsBasePath; |
| 48 return true; |
| 49 } |
| 50 |
| 51 } // namespace device |
OLD | NEW |