OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 module device.sensors; |
| 6 |
| 7 enum SensorType { |
| 8 FIRST = 1, |
| 9 AMBIENT_LIGHT = FIRST, |
| 10 PROXIMITY, |
| 11 LINEAR_ACCELERATION, |
| 12 GYROSCOPE, |
| 13 PRESSURE, |
| 14 LAST = PRESSURE // Note: LAST is also equal to the types count. |
| 15 }; |
| 16 |
| 17 |
| 18 // Sensor reading buffer is putting fields of 64-bit floating point type in the
following order: |
| 19 // 1) timestamp, 2) other fields |
| 20 const uint8 kSensorReadingFieldsCount = 4; |
| 21 const uint8 kSensorReadingFieldSize = 8; |
| 22 |
| 23 struct SensorConfiguration { |
| 24 double frequency; |
| 25 // TODO(shalamov): Add map<string, union> for extra sensor specific configurat
ion. |
| 26 }; |
| 27 |
| 28 interface Sensor { |
| 29 SetClient(SensorClient client); |
| 30 Start(SensorConfiguration configuration) => (bool result); |
| 31 Stop(SensorConfiguration configuration) => (bool result); |
| 32 }; |
| 33 |
| 34 interface SensorClient { |
| 35 OnSensorError(); |
| 36 OnSensorReadingChanged(); |
| 37 }; |
OLD | NEW |