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

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

Issue 2370343002: [sensors] Ambient light sensor implementation for ChromeOS and Linux. (Closed)
Patch Set: rebased on top of Mihail's cl Created 4 years, 2 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
OLDNEW
(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_AMBIENT_LIGHT_SENSOR_IIO_H_
6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_IIO_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "device/generic_sensor/ambient_light_reader_iio.h"
10 #include "device/generic_sensor/polling_platform_sensor.h"
11
12 namespace device {
13
14 class PlatformSensorAmbientLightIio : public PollingPlatformSensor {
15 public:
16 // Factory method.
17 static scoped_refptr<PlatformSensor> CreateSensor(
18 mojom::SensorType type,
19 mojo::ScopedSharedBufferMapping mapping,
20 PlatformSensorProvider* provider,
21 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
22
23 // PollingPlatformSensor implements:
24 void UpdateReading() override;
25
26 // PlatformSensor implements:
27 mojom::ReportingMode GetReportingMode() override;
28
29 bool sensor_exists() const { return sensor_exists_; }
30
31 protected:
32 // PlatformSensor implements:
33 ~PlatformSensorAmbientLightIio() override;
34 bool CheckSensorConfiguration(
35 const PlatformSensorConfiguration& configuration) override;
36 PlatformSensorConfiguration GetDefaultConfiguration() override;
37
38 private:
39 PlatformSensorAmbientLightIio(
40 mojom::SensorType type,
41 mojo::ScopedSharedBufferMapping mapping,
42 PlatformSensorProvider* provider,
43 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
44
45 void OnSensorReadFailed();
46
47 double lux_value_;
48 bool sensor_exists_;
49 std::unique_ptr<AmbientLightSensorReaderIio> ambient_light_reader_;
50 base::WeakPtrFactory<PlatformSensorAmbientLightIio> weak_factory_;
51
52 DISALLOW_COPY_AND_ASSIGN(PlatformSensorAmbientLightIio);
53 };
54
55 } // namespace device
56
57 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_IIO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698