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

Unified Diff: device/generic_sensor/platform_sensor_ambient_light_iio.h

Issue 2370343002: [sensors] Ambient light sensor implementation for ChromeOS and Linux. (Closed)
Patch Set: changed implementation 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 side-by-side diff with in-line comments
Download patch
Index: device/generic_sensor/platform_sensor_ambient_light_iio.h
diff --git a/device/generic_sensor/platform_sensor_ambient_light_iio.h b/device/generic_sensor/platform_sensor_ambient_light_iio.h
new file mode 100644
index 0000000000000000000000000000000000000000..e9afd6bf410fc2a74c7e27aa46db825c54bb3b31
--- /dev/null
+++ b/device/generic_sensor/platform_sensor_ambient_light_iio.h
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_IIO_H_
+#define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_IIO_H_
+
+#include <device/generic_sensor/platform_sensor_iio.h>
+#include <device/generic_sensor/platform_sensor_utils_iio.h>
+#include "base/memory/ref_counted.h"
+
+namespace device {
+
+class PlatformSensorAmbientLightIio : public PlatformSensorIio {
+ public:
+ PlatformSensorAmbientLightIio(
+ mojom::SensorType type,
+ mojo::ScopedSharedBufferMapping mapping,
+ PlatformSensorProvider* provider,
+ scoped_refptr<base::SingleThreadTaskRunner> polling_task_runner,
+ std::unique_ptr<SensorReader> sensor_reader);
+
+ // PollingPlatformSensor implements:
+ void UpdateReading() override;
+
+ // PlatformSensor implements:
+ mojom::ReportingMode GetReportingMode() override;
+
+ protected:
+ // PlatformSensor implements:
+ ~PlatformSensorAmbientLightIio() override;
+ PlatformSensorConfiguration GetDefaultConfiguration() override;
+
+ private:
+ double lux_value_;
+ std::unique_ptr<SensorReader> sensor_reader_;
+ base::WeakPtrFactory<PlatformSensorAmbientLightIio> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(PlatformSensorAmbientLightIio);
+};
+
+} // namespace device
+
+#endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_IIO_H_

Powered by Google App Engine
This is Rietveld 408576698