| 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 17 matching lines...) Expand all Loading... |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 struct SensorConfiguration { | 30 struct SensorConfiguration { |
| 31 // Requested frequency in Hz (max is 60 Hz). | 31 // Requested frequency in Hz (max is 60 Hz). |
| 32 double frequency; | 32 double frequency; |
| 33 // TODO(shalamov): Add map<string, union> for sensor specific configuration. | 33 // TODO(shalamov): Add map<string, union> for sensor specific configuration. |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 // Interface for controlling the Sensor. | 36 // Interface for controlling the Sensor. |
| 37 interface Sensor { | 37 interface Sensor { |
| 38 |
| 39 // Requests sensor to provide its default configuration. |
| 40 GetDefaultConfiguration() => (SensorConfiguration configuration); |
| 41 |
| 38 // Requests sensor to start reading sensor data with specified | 42 // Requests sensor to start reading sensor data with specified |
| 39 // SensorConfiguration. | 43 // SensorConfiguration. |
| 40 // Sensor holds the list of added configurations and it always polls | 44 // Sensor holds the list of added configurations and it always polls |
| 41 // the platform (and updates the shared buffer) at the maxiumum frequency | 45 // the platform (and updates the shared buffer) at the maxiumum frequency |
| 42 // among the obtained from the stored configurations, so that all clients | 46 // among the obtained from the stored configurations, so that all clients |
| 43 // can have sensor data in time. | 47 // can have sensor data in time. |
| 44 // Returns 'true' if |configuration| was successfully added. | 48 // Returns 'true' if |configuration| was successfully added. |
| 45 // Returns 'false' if |configuration| could not be added (is invalid | 49 // Returns 'false' if |configuration| could not be added (is invalid |
| 46 // or not supported). | 50 // or not supported). |
| 47 AddConfiguration(SensorConfiguration configuration) => (bool success); | 51 AddConfiguration(SensorConfiguration configuration) => (bool success); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 69 // Interface that client of the Sensor interface must implement to observe | 73 // Interface that client of the Sensor interface must implement to observe |
| 70 // sensor reading changes and error conditions. | 74 // sensor reading changes and error conditions. |
| 71 interface SensorClient { | 75 interface SensorClient { |
| 72 // Signals SensorClient when there is an error. | 76 // Signals SensorClient when there is an error. |
| 73 RaiseError(); | 77 RaiseError(); |
| 74 | 78 |
| 75 // Signals SensorClient when reading has been changed (only for sensors with | 79 // Signals SensorClient when reading has been changed (only for sensors with |
| 76 // ReportingMode::ON_CHANGE). | 80 // ReportingMode::ON_CHANGE). |
| 77 SensorReadingChanged(); | 81 SensorReadingChanged(); |
| 78 }; | 82 }; |
| OLD | NEW |