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

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

Issue 2865263002: Move //device/generic_sensor to be part of the internal implementation of the Device Service. (Closed)
Patch Set: code rebase Created 3 years, 7 months 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 SERVICES_DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_
6 #define DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_ 6 #define SERVICES_DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_
7 7
8 #include "device/generic_sensor/generic_sensor_export.h" 8 #include "services/device/public/interfaces/sensor.mojom.h"
9 #include "device/generic_sensor/public/interfaces/sensor.mojom.h"
10 9
11 namespace device { 10 namespace device {
12 11
13 class PlatformSensorConfiguration; 12 class PlatformSensorConfiguration;
14 struct SensorReading; 13 struct SensorReading;
15 14
16 // This structure represents a context that is used to identify a udev device 15 // This structure represents a context that is used to identify a udev device
17 // and create a type specific SensorInfoLinux. For example, when a 16 // and create a type specific SensorInfoLinux. For example, when a
18 // SensorDeviceManager receives a udev device, it uses this structure to 17 // SensorDeviceManager receives a udev device, it uses this structure to
19 // identify what type of sensor that is and creates a SensorInfoLinux structure 18 // identify what type of sensor that is and creates a SensorInfoLinux structure
20 // that holds all the necessary information to create a PlatformSensorLinux. 19 // that holds all the necessary information to create a PlatformSensorLinux.
21 struct DEVICE_GENERIC_SENSOR_EXPORT SensorPathsLinux { 20 struct SensorPathsLinux {
22 using ReaderFunctor = base::Callback< 21 using ReaderFunctor = base::Callback<
23 void(double scaling, double offset, SensorReading& reading)>; 22 void(double scaling, double offset, SensorReading& reading)>;
24 23
25 SensorPathsLinux(); 24 SensorPathsLinux();
26 ~SensorPathsLinux(); 25 ~SensorPathsLinux();
27 SensorPathsLinux(const SensorPathsLinux& other); 26 SensorPathsLinux(const SensorPathsLinux& other);
28 // Provides an array of sensor file names to be searched for. 27 // Provides an array of sensor file names to be searched for.
29 // Different sensors might have up to 3 different file name arrays. 28 // Different sensors might have up to 3 different file name arrays.
30 // One file must be found from each array. 29 // One file must be found from each array.
31 std::vector<std::vector<std::string>> sensor_file_names; 30 std::vector<std::vector<std::string>> sensor_file_names;
32 // Scaling file to be found. 31 // Scaling file to be found.
33 std::string sensor_scale_name; 32 std::string sensor_scale_name;
34 // Frequency file to be found. 33 // Frequency file to be found.
35 std::string sensor_frequency_file_name; 34 std::string sensor_frequency_file_name;
36 // Offset file to be found. 35 // Offset file to be found.
37 std::string sensor_offset_file_name; 36 std::string sensor_offset_file_name;
38 // Used to apply scalings to raw sensor data. 37 // Used to apply scalings to raw sensor data.
39 ReaderFunctor apply_scaling_func; 38 ReaderFunctor apply_scaling_func;
40 // Sensor type 39 // Sensor type
41 mojom::SensorType type; 40 mojom::SensorType type;
42 // Default configuration of a sensor. 41 // Default configuration of a sensor.
43 PlatformSensorConfiguration default_configuration; 42 PlatformSensorConfiguration default_configuration;
44 }; 43 };
45 44
46 // Initializes sensor data according to |type|. 45 // Initializes sensor data according to |type|.
47 bool DEVICE_GENERIC_SENSOR_EXPORT InitSensorData(mojom::SensorType type, 46 bool InitSensorData(mojom::SensorType type, SensorPathsLinux* data);
48 SensorPathsLinux* data);
49 47
50 // This structure represents an iio device, which info is taken 48 // This structure represents an iio device, which info is taken
51 // from udev service. If a client requests a sensor from a provider, 49 // from udev service. If a client requests a sensor from a provider,
52 // the provider takes this initialized and stored structure and uses it to 50 // the provider takes this initialized and stored structure and uses it to
53 // create a requested PlatformSensorLinux of a certain type. 51 // create a requested PlatformSensorLinux of a certain type.
54 struct SensorInfoLinux { 52 struct SensorInfoLinux {
55 // Represents current sensor device node. 53 // Represents current sensor device node.
56 const std::string device_node; 54 const std::string device_node;
57 // Represents frequency of a sensor. 55 // Represents frequency of a sensor.
58 const double device_frequency; 56 const double device_frequency;
(...skipping 13 matching lines...) Expand all
72 double sensor_device_scaling_value, 70 double sensor_device_scaling_value,
73 double sensor_device_offset_value, 71 double sensor_device_offset_value,
74 mojom::ReportingMode mode, 72 mojom::ReportingMode mode,
75 SensorPathsLinux::ReaderFunctor scaling_func, 73 SensorPathsLinux::ReaderFunctor scaling_func,
76 std::vector<base::FilePath> iio_device_reading_files); 74 std::vector<base::FilePath> iio_device_reading_files);
77 ~SensorInfoLinux(); 75 ~SensorInfoLinux();
78 }; 76 };
79 77
80 } // namespace device 78 } // namespace device
81 79
82 #endif // DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_ 80 #endif // SERVICES_DEVICE_GENERIC_SENSOR_LINUX_SENSOR_DATA_LINUX_H_
OLDNEW
« no previous file with comments | « services/device/generic_sensor/generic_sensor_consts.h ('k') | services/device/generic_sensor/linux/sensor_data_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698