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 #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 23 matching lines...) Expand all Loading... | |
| 34 virtual void OnSensorError() = 0; | 34 virtual void OnSensorError() = 0; |
| 35 virtual bool IsNotificationSuspended() = 0; | 35 virtual bool IsNotificationSuspended() = 0; |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 virtual ~Client() {} | 38 virtual ~Client() {} |
| 39 }; | 39 }; |
| 40 | 40 |
| 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 | |
| 45 // value obtained from the platfrom if it is available. If platfrom | |
|
timvolodine
2016/11/03 17:32:56
platfrom->platform
Mikhail
2016/11/04 21:17:44
Done.
| |
| 46 // does not provide maximum sampling frequency this method must | |
| 47 // return default frequency. | |
| 48 // The default implementation returns default frequency. | |
| 49 virtual double GetMaximumSupportedFrequency(); | |
|
timvolodine
2016/11/03 17:32:56
const? (or is that too restrictive?)
Mikhail
2016/11/04 21:17:44
would not like to put such a limit for implementat
| |
| 50 | |
| 44 mojom::SensorType GetType() const; | 51 mojom::SensorType GetType() const; |
| 45 | 52 |
| 46 bool StartListening(Client* client, | 53 bool StartListening(Client* client, |
| 47 const PlatformSensorConfiguration& config); | 54 const PlatformSensorConfiguration& config); |
| 48 bool StopListening(Client* client, const PlatformSensorConfiguration& config); | 55 bool StopListening(Client* client, const PlatformSensorConfiguration& config); |
| 49 | 56 |
| 50 void UpdateSensor(); | 57 void UpdateSensor(); |
| 51 | 58 |
| 52 void AddClient(Client*); | 59 void AddClient(Client*); |
| 53 void RemoveClient(Client*); | 60 void RemoveClient(Client*); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 base::ObserverList<Client, true> clients_; | 97 base::ObserverList<Client, true> clients_; |
| 91 ConfigMap config_map_; | 98 ConfigMap config_map_; |
| 92 PlatformSensorProvider* provider_; | 99 PlatformSensorProvider* provider_; |
| 93 base::WeakPtrFactory<PlatformSensor> weak_factory_; | 100 base::WeakPtrFactory<PlatformSensor> weak_factory_; |
| 94 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); | 101 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); |
| 95 }; | 102 }; |
| 96 | 103 |
| 97 } // namespace device | 104 } // namespace device |
| 98 | 105 |
| 99 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ | 106 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ |
| OLD | NEW |