Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: device/generic_sensor/platform_sensor.h

Issue 2704123006: [Sensors] Clamp given sampling frequency to the minimum supported one (Closed)
Patch Set: rebased Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | device/generic_sensor/platform_sensor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ 5 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_
6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ 6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
(...skipping 30 matching lines...) Expand all
41 virtual mojom::ReportingMode GetReportingMode() = 0; 41 virtual mojom::ReportingMode GetReportingMode() = 0;
42 virtual PlatformSensorConfiguration GetDefaultConfiguration() = 0; 42 virtual PlatformSensorConfiguration GetDefaultConfiguration() = 0;
43 43
44 // Can be overriden to return the sensor maximum sampling frequency 44 // Can be overriden to return the sensor maximum sampling frequency
45 // value obtained from the platform if it is available. If platfrom 45 // value obtained from the platform if it is available. If platfrom
46 // does not provide maximum sampling frequency this method must 46 // does not provide maximum sampling frequency this method must
47 // return default frequency. 47 // return default frequency.
48 // The default implementation returns default frequency. 48 // The default implementation returns default frequency.
49 virtual double GetMaximumSupportedFrequency(); 49 virtual double GetMaximumSupportedFrequency();
50 50
51 // Can be overriden to return the sensor minimum sampling frequency.
52 // The default implementation returns '1.0 / (60 * 60)', i.e. once per hour.
53 virtual double GetMinimumSupportedFrequency();
54
51 mojom::SensorType GetType() const; 55 mojom::SensorType GetType() const;
52 56
53 bool StartListening(Client* client, 57 bool StartListening(Client* client,
54 const PlatformSensorConfiguration& config); 58 const PlatformSensorConfiguration& config);
55 bool StopListening(Client* client, const PlatformSensorConfiguration& config); 59 bool StopListening(Client* client, const PlatformSensorConfiguration& config);
56 60
57 void UpdateSensor(); 61 void UpdateSensor();
58 62
59 void AddClient(Client*); 63 void AddClient(Client*);
60 void RemoveClient(Client*); 64 void RemoveClient(Client*);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 base::ObserverList<Client, true> clients_; 101 base::ObserverList<Client, true> clients_;
98 ConfigMap config_map_; 102 ConfigMap config_map_;
99 PlatformSensorProvider* provider_; 103 PlatformSensorProvider* provider_;
100 base::WeakPtrFactory<PlatformSensor> weak_factory_; 104 base::WeakPtrFactory<PlatformSensor> weak_factory_;
101 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); 105 DISALLOW_COPY_AND_ASSIGN(PlatformSensor);
102 }; 106 };
103 107
104 } // namespace device 108 } // namespace device
105 109
106 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ 110 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_
OLDNEW
« no previous file with comments | « no previous file | device/generic_sensor/platform_sensor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698