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 module device.mojom; | 5 module device.mojom; |
6 | 6 |
7 import "sensor.mojom"; | 7 import "sensor.mojom"; |
8 | 8 |
9 struct SensorInitParams { | 9 struct SensorInitParams { |
10 // The shared memory handle used to fetch the sensor reading. | 10 // The shared memory handle used to fetch the sensor reading. |
11 handle<shared_buffer> memory; | 11 handle<shared_buffer> memory; |
12 | 12 |
13 // The offset at which shared buffer must be mapped. | 13 // The offset at which shared buffer must be mapped. |
14 uint64 buffer_offset; | 14 uint64 buffer_offset; |
15 | 15 |
16 // The ReportingMode supported by the sensor. | 16 // The ReportingMode supported by the sensor. |
17 ReportingMode mode; | 17 ReportingMode mode; |
18 | 18 |
19 // Default sensor configuration. | 19 // Default sensor configuration. |
20 SensorConfiguration default_configuration; | 20 SensorConfiguration default_configuration; |
21 | 21 |
| 22 // Maximum sampling frequency for the sensor: it considers both |
| 23 // |SensorConfiguration::kMaxAllowedFrequency| and actual sensor |
| 24 // capabilities. |
| 25 double maximum_frequency; |
| 26 |
22 // Each sensor's read buffer contains 4 tightly packed 64-bit floating | 27 // Each sensor's read buffer contains 4 tightly packed 64-bit floating |
23 // point fields (please see sensor_reading.h) and a seqlock, so its size is | 28 // point fields (please see sensor_reading.h) and a seqlock, so its size is |
24 // 5 * 8 = 40 bytes. | 29 // 5 * 8 = 40 bytes. |
25 const uint64 kReadBufferSizeForTests = 40; | 30 const uint64 kReadBufferSizeForTests = 40; |
26 }; | 31 }; |
27 | 32 |
28 interface SensorProvider { | 33 interface SensorProvider { |
29 // Gets the sensor interface by the given type. | 34 // Gets the sensor interface by the given type. |
30 // | 35 // |
31 // |type| type of the sensor. | 36 // |type| type of the sensor. |
32 // | 37 // |
33 // |sensor_request| the Sensor interface instance to be initialized. | 38 // |sensor_request| the Sensor interface instance to be initialized. |
34 // | 39 // |
35 // |init_params| on success will contain the SensorInitParams describing the | 40 // |init_params| on success will contain the SensorInitParams describing the |
36 // sensor details, | 41 // sensor details, |
37 // contains null on failure. | 42 // contains null on failure. |
38 // |client_request| on success contains a request to be bound by the client, | 43 // |client_request| on success contains a request to be bound by the client, |
39 // contains null on failure. | 44 // contains null on failure. |
40 GetSensor(SensorType type, Sensor& sensor_request) => ( | 45 GetSensor(SensorType type, Sensor& sensor_request) => ( |
41 SensorInitParams? init_params, | 46 SensorInitParams? init_params, |
42 SensorClient&? client_request); | 47 SensorClient&? client_request); |
43 }; | 48 }; |
OLD | NEW |