| 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 available). |
| 46 // The default implementation returns default frequency. |
| 47 virtual double GetMaximumSupportedFrequency(); |
| 48 |
| 44 mojom::SensorType GetType() const; | 49 mojom::SensorType GetType() const; |
| 45 | 50 |
| 46 bool StartListening(Client* client, | 51 bool StartListening(Client* client, |
| 47 const PlatformSensorConfiguration& config); | 52 const PlatformSensorConfiguration& config); |
| 48 bool StopListening(Client* client, const PlatformSensorConfiguration& config); | 53 bool StopListening(Client* client, const PlatformSensorConfiguration& config); |
| 49 | 54 |
| 50 void UpdateSensor(); | 55 void UpdateSensor(); |
| 51 | 56 |
| 52 void AddClient(Client*); | 57 void AddClient(Client*); |
| 53 void RemoveClient(Client*); | 58 void RemoveClient(Client*); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 base::ObserverList<Client, true> clients_; | 95 base::ObserverList<Client, true> clients_; |
| 91 ConfigMap config_map_; | 96 ConfigMap config_map_; |
| 92 PlatformSensorProvider* provider_; | 97 PlatformSensorProvider* provider_; |
| 93 base::WeakPtrFactory<PlatformSensor> weak_factory_; | 98 base::WeakPtrFactory<PlatformSensor> weak_factory_; |
| 94 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); | 99 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); |
| 95 }; | 100 }; |
| 96 | 101 |
| 97 } // namespace device | 102 } // namespace device |
| 98 | 103 |
| 99 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ | 104 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ |
| OLD | NEW |