| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_ | 5 #ifndef DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_ |
| 6 #define DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_ | 6 #define DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_ |
| 7 | 7 |
| 8 #include "device/generic_sensor/generic_sensor_export.h" | 8 #include "device/generic_sensor/generic_sensor_export.h" |
| 9 #include "device/generic_sensor/public/interfaces/sensor.mojom.h" | 9 #include "device/generic_sensor/public/interfaces/sensor.mojom.h" |
| 10 | 10 |
| 11 namespace device { | 11 namespace device { |
| 12 | 12 |
| 13 struct SensorReading; |
| 14 |
| 13 // This structure represents a context that is used to | 15 // This structure represents a context that is used to |
| 14 // create a type specific SensorReader and a concrete | 16 // create a type specific SensorReader and a concrete |
| 15 // sensor that uses the SensorReader to read sensor | 17 // sensor that uses the SensorReader to read sensor |
| 16 // data from files specified in the |sensor_file_names|. | 18 // data from files specified in the |sensor_file_names|. |
| 17 struct DEVICE_GENERIC_SENSOR_EXPORT SensorDataLinux { | 19 struct DEVICE_GENERIC_SENSOR_EXPORT SensorDataLinux { |
| 20 using ReaderFunctor = |
| 21 base::Callback<void(double scaling, SensorReading& reading)>; |
| 22 |
| 18 SensorDataLinux(); | 23 SensorDataLinux(); |
| 19 ~SensorDataLinux(); | 24 ~SensorDataLinux(); |
| 20 SensorDataLinux(const SensorDataLinux& other); | 25 SensorDataLinux(const SensorDataLinux& other); |
| 21 // Provides a base path to all sensors. | 26 // Provides a base path to all sensors. |
| 22 const base::FilePath::CharType* base_path_sensor_linux; | 27 const base::FilePath::CharType* base_path_sensor_linux; |
| 23 // Provides an array of sensor file names to be searched for. | 28 // Provides an array of sensor file names to be searched for. |
| 24 // Different sensors might have up to 3 different file name arrays. | 29 // Different sensors might have up to 3 different file name arrays. |
| 25 // One file must be found from each array. | 30 // One file must be found from each array. |
| 26 std::vector<std::vector<std::string>> sensor_file_names; | 31 std::vector<std::vector<std::string>> sensor_file_names; |
| 32 // Scaling file to be found. |
| 33 std::string sensor_scale_name; |
| 34 // Used to apply scalings to raw sensor data. |
| 35 ReaderFunctor apply_scaling_func; |
| 27 // Reporting mode of a sensor. | 36 // Reporting mode of a sensor. |
| 28 mojom::ReportingMode reporting_mode; | 37 mojom::ReportingMode reporting_mode; |
| 29 // Default configuration of a sensor. | 38 // Default configuration of a sensor. |
| 30 PlatformSensorConfiguration default_configuration; | 39 PlatformSensorConfiguration default_configuration; |
| 31 }; | 40 }; |
| 32 | 41 |
| 33 // Initializes a sensor type specific data. | 42 // Initializes a sensor type specific data. |
| 34 bool InitSensorData(mojom::SensorType type, SensorDataLinux* data); | 43 bool InitSensorData(mojom::SensorType type, SensorDataLinux* data); |
| 35 | 44 |
| 36 } // namespace device | 45 } // namespace device |
| 37 | 46 |
| 38 #endif // DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_ | 47 #endif // DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_ |
| OLD | NEW |