OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module device.mojom; | 5 module device.mojom; |
6 | 6 |
7 // Types of supported sensors | 7 // Types of supported sensors |
8 enum SensorType { | 8 enum SensorType { |
9 FIRST = 1, | 9 FIRST = 1, |
10 AMBIENT_LIGHT = FIRST, | 10 AMBIENT_LIGHT = FIRST, |
(...skipping 12 matching lines...) Expand all Loading... | |
23 // CONTINUOUS - sensor will continuously update its reading with frequency | 23 // CONTINUOUS - sensor will continuously update its reading with frequency |
24 // specified in SensorConfiguration.frequency. | 24 // specified in SensorConfiguration.frequency. |
25 // OnSensorReadingChanged() signal is not sent to the client for | 25 // OnSensorReadingChanged() signal is not sent to the client for |
26 // sensors with CONTINUOUS reporting mode. | 26 // sensors with CONTINUOUS reporting mode. |
27 enum ReportingMode { | 27 enum ReportingMode { |
28 ON_CHANGE, | 28 ON_CHANGE, |
29 CONTINUOUS | 29 CONTINUOUS |
30 }; | 30 }; |
31 | 31 |
32 struct SensorConfiguration { | 32 struct SensorConfiguration { |
33 // Requested frequency in Hz (max is 60 Hz). | 33 // Maximum allowed frequency is 60 Hz. |
34 const double kMaxAllowedFrequency = 60.0; | |
Tom Sepez
2016/09/20 16:41:06
nit: If we named this kMaxAllowedFrequencyHz, we c
| |
35 | |
36 // Requested frequency in Hz. | |
34 double frequency; | 37 double frequency; |
35 // TODO(shalamov): Add map<string, union> for sensor specific configuration. | 38 // TODO(shalamov): Add map<string, union> for sensor specific configuration. |
36 }; | 39 }; |
37 | 40 |
38 // Interface for controlling the Sensor. | 41 // Interface for controlling the Sensor. |
39 interface Sensor { | 42 interface Sensor { |
40 | 43 |
41 // Requests sensor to provide its default configuration. | 44 // Requests sensor to provide its default configuration. |
42 GetDefaultConfiguration() => (SensorConfiguration configuration); | 45 GetDefaultConfiguration() => (SensorConfiguration configuration); |
43 | 46 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 // Interface that client of the Sensor interface must implement to observe | 78 // Interface that client of the Sensor interface must implement to observe |
76 // sensor reading changes and error conditions. | 79 // sensor reading changes and error conditions. |
77 interface SensorClient { | 80 interface SensorClient { |
78 // Signals SensorClient when there is an error. | 81 // Signals SensorClient when there is an error. |
79 RaiseError(); | 82 RaiseError(); |
80 | 83 |
81 // Signals SensorClient when reading has been changed (only for sensors with | 84 // Signals SensorClient when reading has been changed (only for sensors with |
82 // ReportingMode::ON_CHANGE). | 85 // ReportingMode::ON_CHANGE). |
83 SensorReadingChanged(); | 86 SensorReadingChanged(); |
84 }; | 87 }; |
OLD | NEW |