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

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: ctor and dtor for deleter 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 uint64_t buffer_size,
21 PlatformSensorProvider* provider,
22 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
23
24 // PollingPlatformSensor implements:
25 void UpdateReading() override;
26
27 // PlatformSensor implements:
28 mojom::ReportingMode GetReportingMode() override;
29
30 bool sensor_exists() const { return sensor_exists_; }
31
32 protected:
33 // PlatformSensor implements:
34 ~PlatformSensorAmbientLightIio() override;
35 bool CheckSensorConfiguration(
36 const PlatformSensorConfiguration& configuration) override;
37 PlatformSensorConfiguration GetDefaultConfiguration() override;
38
39 private:
40 PlatformSensorAmbientLightIio(
41 mojom::SensorType type,
42 mojo::ScopedSharedBufferMapping mapping,
43 uint64_t buffer_size,
44 PlatformSensorProvider* provider,
45 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
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