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

Unified Diff: device/sensors/sensor.mojom

Issue 2051083002: WIP : Generic Sensor API implementation Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 4 years, 6 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/sensors/sensor.mojom
diff --git a/device/sensors/sensor.mojom b/device/sensors/sensor.mojom
new file mode 100644
index 0000000000000000000000000000000000000000..5d7c9e7e96ad992146d910231f2a5db75a29fb74
--- /dev/null
+++ b/device/sensors/sensor.mojom
@@ -0,0 +1,37 @@
+// 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.sensors;
+
+enum SensorType {
+ FIRST = 1,
+ AMBIENT_LIGHT = FIRST,
+ PROXIMITY,
+ LINEAR_ACCELERATION,
+ GYROSCOPE,
+ PRESSURE,
+ LAST = PRESSURE // Note: LAST is also equal to the types count.
+};
+
+
+// Sensor reading buffer is putting fields of 64-bit floating point type in the following order:
+// 1) timestamp, 2) other fields
+const uint8 kSensorReadingFieldsCount = 4;
+const uint8 kSensorReadingFieldSize = 8;
+
+struct SensorConfiguration {
+ double frequency;
+ // TODO(shalamov): Add map<string, union> for extra sensor specific configuration.
+};
+
+interface Sensor {
+ SetClient(SensorClient client);
+ Start(SensorConfiguration configuration) => (bool result);
+ Stop(SensorConfiguration configuration) => (bool result);
+};
+
+interface SensorClient {
+ OnSensorError();
+ OnSensorReadingChanged();
+};

Powered by Google App Engine
This is Rietveld 408576698