Chromium Code Reviews| 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 at least one configuration sets this flag to true, | |
| 46 // SensorClient::SensorReadingChanged() signal is not sent to the client; | |
| 47 // otherwise it is. | |
| 48 // For sensors with CONTINUOUS reporting mode: | |
| 49 // This flag has no effect since SensorClient::SensorReadingChanged() is not | |
| 50 // sent to the client. | |
| 51 bool suppress_on_change_events = false; | |
|
Mikhail
2017/06/12 11:01:10
Shouldn't it be rather added to SensorInitParams (
juncai
2017/06/12 17:32:10
If I understand it correctly, SensorInitParams is
Mikhail
2017/06/13 12:54:56
Oh I see. My only concern is that 'SensorConfigura
| |
| 43 }; | 52 }; |
| 44 | 53 |
| 45 // Interface for controlling the Sensor. | 54 // Interface for controlling the Sensor. |
| 46 interface Sensor { | 55 interface Sensor { |
| 47 | 56 |
| 48 // Requests sensor to provide its default configuration. | 57 // Requests sensor to provide its default configuration. |
| 49 GetDefaultConfiguration() => (SensorConfiguration configuration); | 58 GetDefaultConfiguration() => (SensorConfiguration configuration); |
| 50 | 59 |
| 51 // Requests sensor to start reading sensor data with specified | 60 // Requests sensor to start reading sensor data with specified |
| 52 // SensorConfiguration. | 61 // SensorConfiguration. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 82 // Interface that client of the Sensor interface must implement to observe | 91 // Interface that client of the Sensor interface must implement to observe |
| 83 // sensor reading changes and error conditions. | 92 // sensor reading changes and error conditions. |
| 84 interface SensorClient { | 93 interface SensorClient { |
| 85 // Signals SensorClient when there is an error. | 94 // Signals SensorClient when there is an error. |
| 86 RaiseError(); | 95 RaiseError(); |
| 87 | 96 |
| 88 // Signals SensorClient when reading has been changed (only for sensors with | 97 // Signals SensorClient when reading has been changed (only for sensors with |
| 89 // ReportingMode::ON_CHANGE). | 98 // ReportingMode::ON_CHANGE). |
| 90 SensorReadingChanged(); | 99 SensorReadingChanged(); |
| 91 }; | 100 }; |
| OLD | NEW |