| 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();
|
| +};
|
|
|