Chromium Code Reviews| 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 SensorReadBuffer { | 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 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. | |
| 20 SensorConfiguration default_configuration; | |
|
timvolodine
2016/09/12 16:37:08
curious how this is described in spec: does the pl
Mikhail
2016/09/12 17:08:10
That is not mentioned explicitly, however IMO it i
timvolodine
2016/09/13 13:17:10
sounds reasonable.. would you mind raising an issu
| |
| 21 | |
| 19 // Note: Each sensor's read buffer contains 4 tightly packed 64-bit floating | 22 // Note: Each sensor's read buffer contains 4 tightly packed 64-bit floating |
| 20 // point fields, its layout is: { double timestamp; double values[3] }. | 23 // point fields, its layout is: { double timestamp; double values[3] }. |
| 21 // So it has a fixed size 4*8 = 32 bytes. | 24 // So it has a fixed size 4*8 = 32 bytes. |
| 22 const uint64 kReadBufferSize = 32; | 25 const uint64 kReadBufferSize = 32; |
| 23 }; | 26 }; |
| 24 | 27 |
| 25 interface SensorProvider { | 28 interface SensorProvider { |
| 26 // Gets the sensor interface by the given type. | 29 // Gets the sensor interface by the given type. |
| 27 // | 30 // |
| 28 // |type| type of the sensor. | 31 // |type| type of the sensor. |
| 29 // | 32 // |
| 30 // |sensor_request| the Sensor interface instance to be initialized. | 33 // |sensor_request| the Sensor interface instance to be initialized. |
| 31 // | 34 // |
| 32 // |read_buffer| on success will contain the SensorReadBuffer describing the | 35 // |init_params| on success will contain the SensorInitParams describing the |
| 33 // sensor reading buffer details, | 36 // sensor details, |
| 34 // contains null on failure. | 37 // contains null on failure. |
| 35 // |client_request| on success contains a request to be bound by the client, | 38 // |client_request| on success contains a request to be bound by the client, |
| 36 // contains null on failure. | 39 // contains null on failure. |
| 37 GetSensor(SensorType type, Sensor& sensor_request) => ( | 40 GetSensor(SensorType type, Sensor& sensor_request) => ( |
| 38 SensorReadBuffer? read_buffer, | 41 SensorInitParams? init_params, |
| 39 SensorClient&? client_request); | 42 SensorClient&? client_request); |
| 40 }; | 43 }; |
| OLD | NEW |