Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_IIO_H_ | |
| 6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_IIO_H_ | |
| 7 | |
| 8 #include "device/generic_sensor/platform_sensor.h" | |
| 9 | |
| 10 #include "base/timer/timer.h" | |
| 11 | |
| 12 namespace base { | |
| 13 class SingleThreadTaskRunner; | |
| 14 } | |
| 15 | |
| 16 namespace device { | |
| 17 | |
| 18 class PlatformSensorIio : public PlatformSensor { | |
| 19 public: | |
| 20 PlatformSensorIio( | |
| 21 mojom::SensorType type, | |
| 22 mojo::ScopedSharedBufferMapping mapping, | |
| 23 PlatformSensorProvider* provider, | |
| 24 scoped_refptr<base::SingleThreadTaskRunner> polling_task_runner); | |
| 25 | |
| 26 virtual void UpdateReading() = 0; | |
|
Mikhail
2016/10/11 14:46:47
rename to 'PollForReadingData()'. Can it be protec
maksims (do not use this acc)
2016/10/14 12:31:45
Done.
| |
| 27 | |
| 28 protected: | |
| 29 ~PlatformSensorIio() override; | |
| 30 bool StartSensor(const PlatformSensorConfiguration& configuration) override; | |
| 31 void StopSensor() override; | |
| 32 bool CheckSensorConfiguration( | |
| 33 const PlatformSensorConfiguration& configuration) override; | |
| 34 | |
| 35 void OnSensorReadFailed(); | |
| 36 | |
| 37 // Task runner that is used to poll sensor data from | |
| 38 // sensor files. | |
| 39 scoped_refptr<base::SingleThreadTaskRunner> polling_thread_task_runner_; | |
| 40 | |
| 41 private: | |
| 42 void BeginPoll(const PlatformSensorConfiguration& configuration); | |
| 43 void StopPoll(); | |
| 44 void OnStop(); | |
| 45 | |
| 46 // Owned timer to be deleted on polling thread. | |
| 47 base::RepeatingTimer* timer_; | |
| 48 | |
| 49 base::WeakPtrFactory<PlatformSensorIio> weak_factory_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(PlatformSensorIio); | |
| 52 }; | |
| 53 | |
| 54 } // namespace device | |
| 55 | |
| 56 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_IIO_H_ | |
| OLD | NEW |