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_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_ | |
| 6 #define DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "device/generic_sensor/platform_sensor.h" | |
| 10 | |
| 11 #include <IOKit/IOKitLib.h> | |
|
Robert Sesek
2016/09/29 22:51:27
System includes go first.
| |
| 12 | |
| 13 namespace base { | |
| 14 class SingleThreadTaskRunner; | |
| 15 } | |
| 16 | |
| 17 namespace device { | |
| 18 | |
| 19 class PlatformSensorAmbientLightMac : public PlatformSensor { | |
| 20 public: | |
| 21 PlatformSensorAmbientLightMac(mojom::SensorType type, | |
| 22 mojo::ScopedSharedBufferMapping mapping, | |
| 23 uint64_t buffer_size, | |
| 24 PlatformSensorProvider* provider); | |
| 25 | |
| 26 mojom::ReportingMode GetReportingMode() override; | |
| 27 bool StartSensor(const PlatformSensorConfiguration& configuration) override; | |
| 28 void StopSensor() override; | |
| 29 | |
| 30 protected: | |
| 31 ~PlatformSensorAmbientLightMac() override; | |
| 32 bool CheckSensorConfiguration( | |
| 33 const PlatformSensorConfiguration& configuration) override; | |
| 34 PlatformSensorConfiguration GetDefaultConfiguration() override; | |
| 35 void UpdateReading(uint64_t lux_values[2]); | |
| 36 | |
| 37 private: | |
| 38 static void IOServiceCallback(void* context, | |
| 39 io_service_t service, | |
| 40 natural_t message_type, | |
| 41 void*); | |
| 42 io_service_t light_sensor_service_; | |
| 43 IONotificationPortRef light_sensor_port_; | |
| 44 io_object_t light_sensor_object_; | |
| 45 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | |
| 46 double current_lux_; | |
| 47 DISALLOW_COPY_AND_ASSIGN(PlatformSensorAmbientLightMac); | |
| 48 }; | |
| 49 | |
| 50 } // namespace device | |
| 51 | |
| 52 #endif // DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_ | |
| OLD | NEW |