Index: device/sensors/public/interfaces/sensor_provider.mojom |
diff --git a/device/sensors/public/interfaces/sensor_provider.mojom b/device/sensors/public/interfaces/sensor_provider.mojom |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5f12c7f9fbad1ea1ac8319c732e7ab6c35321e2a |
--- /dev/null |
+++ b/device/sensors/public/interfaces/sensor_provider.mojom |
@@ -0,0 +1,39 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+module device.mojom; |
+ |
+import "sensor.mojom"; |
+ |
+struct SensorReadBuffer { |
+ // The shared memory handle used to fetch the sensor reading. |
+ handle<shared_buffer> memory; |
+ |
+ // The offset at which shared buffer must be mapped. |
+ uint64 offset; |
timvolodine
2016/07/04 11:32:46
why is this needed? isn't the handle to shared buf
shalamov
2016/07/04 12:11:46
Please check comment above, we use one sharedbuffe
|
+ |
+ // The ReportingMode supported by the sensor. |
+ ReportingMode mode; |
+ |
+ // Note: Each sensor's read buffer contains 4 tightly packed 64-bit floating |
+ // point fields, its layout is: { double timestamp; double values[3] }. |
timvolodine
2016/07/04 11:32:46
I am probably missing something, but where is this
shalamov
2016/07/04 12:11:46
For the sensors that are defined in SensorType enu
timvolodine
2016/07/05 11:45:08
I see, so is your plan to allocate the size of the
|
+ // So it has a fixed size 4*8 = 32 bytes. |
+ const uint64 kReadBufferSize = 32; |
+}; |
+ |
+interface SensorProvider { |
+ // Gets the sensor interface by the given type. |
+ // |
+ // |type| type of the sensor. |
+ // |
+ // |request| the Sensor interface instance to be initialized. |
+ // |read_buffer| on success will contain the SensorReadBuffer describing the |
+ // sensor reading buffer details, |
+ // contains null on failure. |
+ // |client_request| on success contains a request to be bound by the client, |
+ // contains null on failure. |
+ GetSensor(SensorType type, Sensor& sensor_request) => ( |
timvolodine
2016/07/04 11:32:46
why not have something like RegisterListener(Senso
shalamov
2016/07/04 12:11:46
Then we will need to add unregisterListener, in ad
timvolodine
2016/07/05 11:45:08
ok I am trying to understand how it would actually
|
+ SensorReadBuffer? read_buffer, |
+ SensorClient&? client_request); |
+}; |