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/linux/sensor_data_linux.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 void InitAmbientLightSensorData(SensorDataLinux* data) { | |
| 18 std::vector<std::string> file_names( | |
| 19 {"in_illuminance0_input", "in_illuminance_input", "in_illuminance0_raw", | |
| 20 "in_illuminance_raw"}); | |
|
Reilly Grant (use Gerrit)
2016/11/04 17:00:12
The parenthesis here are unnecessary.
| |
| 21 | |
| 22 data->sensor_file_names.push_back(std::move(file_names)); | |
| 23 data->reporting_mode = mojom::ReportingMode::ON_CHANGE; | |
| 24 data->default_configuration = | |
| 25 PlatformSensorConfiguration(kDefaultAmbientLightFrequencyHz); | |
| 26 } | |
| 27 | |
| 28 } // namespace | |
| 29 | |
| 30 SensorDataLinux::SensorDataLinux() : base_path_sensor_linux(kSensorsBasePath) {} | |
| 31 | |
| 32 SensorDataLinux::~SensorDataLinux() = default; | |
| 33 | |
| 34 SensorDataLinux::SensorDataLinux(const SensorDataLinux& other) = default; | |
| 35 | |
| 36 bool InitSensorData(SensorType type, SensorDataLinux* data) { | |
| 37 DCHECK(data); | |
| 38 | |
| 39 switch (type) { | |
| 40 case SensorType::AMBIENT_LIGHT: { | |
| 41 InitAmbientLightSensorData(data); | |
| 42 break; | |
| 43 } | |
| 44 default: { | |
| 45 NOTIMPLEMENTED(); | |
| 46 return false; | |
| 47 } | |
| 48 } | |
| 49 return true; | |
| 50 } | |
| 51 | |
| 52 } // namespace device | |
| OLD | NEW |