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 base::FilePath::CharType* kSensorsBasePath = | |
| 15 FILE_PATH_LITERAL("/sys/bus/iio/devices"); | |
| 16 | |
| 17 const std::string kAmbientLightFileNames[] = { | |
| 18 "in_illuminance0_input", "in_illuminance_input", "in_illuminance0_raw", | |
| 19 "in_illuminance_raw", "illuminance0_input"}; | |
| 20 | |
| 21 } // namespace | |
| 22 | |
| 23 SensorDataIio::SensorDataIio() : base_path_sensor_iio(kSensorsBasePath) {} | |
| 24 | |
| 25 SensorDataIio::~SensorDataIio() = default; | |
| 26 | |
| 27 SensorDataIio::SensorDataIio(const SensorDataIio& other) = default; | |
| 28 | |
| 29 bool InitSensorData(SensorType type, SensorDataIio* data) { | |
| 30 DCHECK(data); | |
| 31 | |
| 32 switch (type) { | |
| 33 case SensorType::AMBIENT_LIGHT: { | |
| 34 std::vector<std::string> file_names( | |
| 35 kAmbientLightFileNames, | |
| 36 kAmbientLightFileNames + arraysize(kAmbientLightFileNames)); | |
| 37 data->sensor_file_names.push_back(file_names); | |
|
Reilly Grant (use Gerrit)
2016/10/31 21:18:09
nit: use swap unless preserving any values already
maksims (do not use this acc)
2016/11/01 08:14:08
As I said. std::vector<std::string> != std::vector
Reilly Grant (use Gerrit)
2016/11/01 18:58:16
Ah, right. You can use std::move(file_names) to av
| |
| 38 data->reporting_mode = mojom::ReportingMode::ON_CHANGE; | |
| 39 data->default_configuration = | |
| 40 PlatformSensorConfiguration(kDefaultAmbientLightFrequencyHz); | |
| 41 break; | |
| 42 } | |
| 43 default: { | |
| 44 NOTIMPLEMENTED(); | |
| 45 return false; | |
| 46 } | |
| 47 } | |
| 48 return true; | |
| 49 } | |
| 50 | |
| 51 } // namespace device | |
| OLD | NEW |