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

Unified Diff: device/generic_sensor/public/interfaces/sensor_provider.mojom

Issue 2144623003: [sensors] Introduce Generic Sensor API interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from Tim and Ken Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: device/generic_sensor/public/interfaces/sensor_provider.mojom
diff --git a/device/generic_sensor/public/interfaces/sensor_provider.mojom b/device/generic_sensor/public/interfaces/sensor_provider.mojom
new file mode 100644
index 0000000000000000000000000000000000000000..4caf3483cdf87df3ee8b11c866befd54975b8d80
--- /dev/null
+++ b/device/generic_sensor/public/interfaces/sensor_provider.mojom
@@ -0,0 +1,40 @@
+// 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;
+
+ // 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] }.
+ // 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.
+ //
+ // |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) => (
+ SensorReadBuffer? read_buffer,
+ SensorClient&? client_request);
+};

Powered by Google App Engine
This is Rietveld 408576698