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 // When adding new sensor type, update the documentation of sensor data values | 8 // When adding new sensor type, update the documentation of sensor data values |
9 // in SensorReading struct at sensor_reading.h file. | 9 // in SensorReading struct at sensor_reading.h file. |
10 enum SensorType { | 10 enum SensorType { |
(...skipping 22 matching lines...) Expand all Loading... |
33 CONTINUOUS | 33 CONTINUOUS |
34 }; | 34 }; |
35 | 35 |
36 struct SensorConfiguration { | 36 struct SensorConfiguration { |
37 // Maximum allowed frequency is 60 Hz. | 37 // Maximum allowed frequency is 60 Hz. |
38 const double kMaxAllowedFrequency = 60.0; | 38 const double kMaxAllowedFrequency = 60.0; |
39 | 39 |
40 // Requested frequency in Hz. | 40 // Requested frequency in Hz. |
41 double frequency; | 41 double frequency; |
42 // TODO(shalamov): Add map<string, union> for sensor specific configuration. | 42 // TODO(shalamov): Add map<string, union> for sensor specific configuration. |
| 43 |
| 44 // For sensors with ON_CHANGE reporting mode: |
| 45 // If true, SensorClient::SensorReadingChanged() signal is sent to the |
| 46 // client; otherwise it is not. |
| 47 // For sensors with CONTINUOUS reporting mode: |
| 48 // This flag has no effect since SensorClient::SensorReadingChanged() is not |
| 49 // sent to the client. |
| 50 bool notify_client_on_reading_change = true; |
43 }; | 51 }; |
44 | 52 |
45 // Interface for controlling the Sensor. | 53 // Interface for controlling the Sensor. |
46 interface Sensor { | 54 interface Sensor { |
47 | 55 |
48 // Requests sensor to provide its default configuration. | 56 // Requests sensor to provide its default configuration. |
49 GetDefaultConfiguration() => (SensorConfiguration configuration); | 57 GetDefaultConfiguration() => (SensorConfiguration configuration); |
50 | 58 |
51 // Requests sensor to start reading sensor data with specified | 59 // Requests sensor to start reading sensor data with specified |
52 // SensorConfiguration. | 60 // SensorConfiguration. |
(...skipping 29 matching lines...) Expand all Loading... |
82 // Interface that client of the Sensor interface must implement to observe | 90 // Interface that client of the Sensor interface must implement to observe |
83 // sensor reading changes and error conditions. | 91 // sensor reading changes and error conditions. |
84 interface SensorClient { | 92 interface SensorClient { |
85 // Signals SensorClient when there is an error. | 93 // Signals SensorClient when there is an error. |
86 RaiseError(); | 94 RaiseError(); |
87 | 95 |
88 // Signals SensorClient when reading has been changed (only for sensors with | 96 // Signals SensorClient when reading has been changed (only for sensors with |
89 // ReportingMode::ON_CHANGE). | 97 // ReportingMode::ON_CHANGE). |
90 SensorReadingChanged(); | 98 SensorReadingChanged(); |
91 }; | 99 }; |
OLD | NEW |