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_SENSOR_SENSOR_IMPL_H_ |
| 6 #define DEVICE_SENSOR_SENSOR_IMPL_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "device/sensor/sensor.mojom.h" |
| 10 #include "device/sensor/sensor_export.h" |
| 11 #include "device/sensor/sensor_service.h" |
| 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 13 |
| 14 namespace device { |
| 15 |
| 16 class SensorImpl : public AmbientLightSensor { |
| 17 public: |
| 18 DEVICE_SENSOR_EXPORT static void Create( |
| 19 mojo::InterfaceRequest<AmbientLightSensor> request); |
| 20 |
| 21 private: |
| 22 typedef mojo::Callback<void(AmbientLightSensorReadingPtr)> |
| 23 SensorReadingCallback; |
| 24 |
| 25 explicit SensorImpl(mojo::InterfaceRequest<AmbientLightSensor> request); |
| 26 ~SensorImpl() override; |
| 27 |
| 28 // AmbientLightSensor interface methods. |
| 29 void QueryNextReading(const SensorReadingCallback& callback) override; |
| 30 void StartReading() override; |
| 31 void StopReading() override; |
| 32 |
| 33 void DidChange(const AmbientLightSensorReading& als_reading); |
| 34 void ReportReading(); |
| 35 |
| 36 mojo::StrongBinding<AmbientLightSensor> binding_; |
| 37 scoped_ptr<SensorService::SensorUpdateSubscription> subscription_; |
| 38 SensorReadingCallback callback_; |
| 39 AmbientLightSensorReading reading_; |
| 40 bool reading_to_report_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(SensorImpl); |
| 43 }; |
| 44 |
| 45 } // namespace device |
| 46 |
| 47 #endif // DEVICE_SENSOR_SENSOR_IMPL_H_ |
OLD | NEW |