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