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 #include "device/generic_sensor/platform_sensor.h" | 5 #include "device/generic_sensor/platform_sensor.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "device/generic_sensor/platform_sensor_provider.h" | 10 #include "device/generic_sensor/platform_sensor_provider.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 mojom::SensorType PlatformSensor::GetType() const { | 28 mojom::SensorType PlatformSensor::GetType() const { |
29 return type_; | 29 return type_; |
30 } | 30 } |
31 | 31 |
32 double PlatformSensor::GetMaximumSupportedFrequency() { | 32 double PlatformSensor::GetMaximumSupportedFrequency() { |
33 return GetDefaultConfiguration().frequency(); | 33 return GetDefaultConfiguration().frequency(); |
34 } | 34 } |
35 | 35 |
| 36 double PlatformSensor::GetMinimumSupportedFrequency() { |
| 37 return 1.0 / (60 * 60); |
| 38 } |
| 39 |
36 bool PlatformSensor::StartListening(Client* client, | 40 bool PlatformSensor::StartListening(Client* client, |
37 const PlatformSensorConfiguration& config) { | 41 const PlatformSensorConfiguration& config) { |
38 DCHECK(clients_.HasObserver(client)); | 42 DCHECK(clients_.HasObserver(client)); |
39 if (!CheckSensorConfiguration(config)) | 43 if (!CheckSensorConfiguration(config)) |
40 return false; | 44 return false; |
41 | 45 |
42 auto& config_list = config_map_[client]; | 46 auto& config_list = config_map_[client]; |
43 config_list.push_back(config); | 47 config_list.push_back(config); |
44 | 48 |
45 if (!UpdateSensorInternal(config_map_)) { | 49 if (!UpdateSensorInternal(config_map_)) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 133 |
130 if (!optimal_configuration) { | 134 if (!optimal_configuration) { |
131 StopSensor(); | 135 StopSensor(); |
132 return true; | 136 return true; |
133 } | 137 } |
134 | 138 |
135 return StartSensor(*optimal_configuration); | 139 return StartSensor(*optimal_configuration); |
136 } | 140 } |
137 | 141 |
138 } // namespace device | 142 } // namespace device |
OLD | NEW |