Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: device/generic_sensor/linux/sensor_data_linux.h

Issue 2533793002: [sensors](CrOS/Linux) Implement Sensor device manager for sensors (Closed)
Patch Set: fix build.gn Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 class PlatformSensorConfiguration;
13 struct SensorReading; 14 struct SensorReading;
14 15
15 // This structure represents a context that is used to 16 // This structure represents a context that is used to
16 // create a type specific SensorReader and a concrete 17 // create a type specific SensorReader and a concrete
17 // sensor that uses the SensorReader to read sensor 18 // sensor that uses the SensorReader to read sensor
18 // data from files specified in the |sensor_file_names|. 19 // data from files specified in the |sensor_file_names|.
19 struct DEVICE_GENERIC_SENSOR_EXPORT SensorDataLinux { 20 struct DEVICE_GENERIC_SENSOR_EXPORT SensorDataLinux {
20 using ReaderFunctor = 21 using ReaderFunctor = base::Callback<
21 base::Callback<void(double scaling, SensorReading& reading)>; 22 void(double scaling, double offset, SensorReading& reading)>;
22 23
23 SensorDataLinux(); 24 SensorDataLinux();
24 ~SensorDataLinux(); 25 ~SensorDataLinux();
25 SensorDataLinux(const SensorDataLinux& other); 26 SensorDataLinux(const SensorDataLinux& other);
26 // Provides a base path to all sensors. 27 // Provides a base path to all sensors.
27 const base::FilePath::CharType* base_path_sensor_linux; 28 const base::FilePath::CharType* base_path_sensor_linux;
28 // Provides an array of sensor file names to be searched for. 29 // Provides an array of sensor file names to be searched for.
29 // Different sensors might have up to 3 different file name arrays. 30 // Different sensors might have up to 3 different file name arrays.
30 // One file must be found from each array. 31 // One file must be found from each array.
31 std::vector<std::vector<std::string>> sensor_file_names; 32 std::vector<std::vector<std::string>> sensor_file_names;
32 // Scaling file to be found. 33 // Scaling file to be found.
33 std::string sensor_scale_name; 34 std::string sensor_scale_name;
35 // Frequency file to be found.
36 std::string sensor_frequency_file_name;
37 // Offset file to be found.
38 std::string sensor_offset_file_name;
34 // Used to apply scalings to raw sensor data. 39 // Used to apply scalings to raw sensor data.
35 ReaderFunctor apply_scaling_func; 40 ReaderFunctor apply_scaling_func;
36 // Reporting mode of a sensor. 41 // Sensor type
37 mojom::ReportingMode reporting_mode; 42 mojom::SensorType type;
38 // Default configuration of a sensor. 43 // Default configuration of a sensor.
39 PlatformSensorConfiguration default_configuration; 44 PlatformSensorConfiguration default_configuration;
40 }; 45 };
41 46
42 // Initializes a sensor type specific data. 47 // Initializes a sensor type specific data.
43 bool InitSensorData(mojom::SensorType type, SensorDataLinux* data); 48 bool DEVICE_GENERIC_SENSOR_EXPORT InitSensorData(mojom::SensorType type,
49 SensorDataLinux* data);
44 50
45 } // namespace device 51 } // namespace device
46 52
47 #endif // DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_ 53 #endif // DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698