OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ | |
6 #define CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ | |
7 | |
8 #include <IOKit/IOKitLib.h> | |
9 #include <stdint.h> | |
10 | |
11 #include <memory> | |
12 | |
13 #include "base/macros.h" | |
14 | |
15 namespace content { | |
16 | |
17 // Provides an interface to retrieve ambient light data from MacBooks. | |
18 class AmbientLightSensor { | |
19 public: | |
20 // Create AmbientLightSensor object, return NULL if no valid is sensor found. | |
21 static std::unique_ptr<AmbientLightSensor> Create(); | |
22 | |
23 ~AmbientLightSensor(); | |
24 | |
25 // Retrieve lux values from Ambient Light Sensor. | |
26 bool ReadSensorValue(uint64_t lux_value[2]); | |
27 | |
28 private: | |
29 AmbientLightSensor(); | |
30 | |
31 // Probe the local hardware looking for Ambient Light sensor and | |
32 // initialize an I/O connection to it. | |
33 bool Init(); | |
34 | |
35 // IOKit connection to the local sensor. | |
36 io_connect_t io_connection_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(AmbientLightSensor); | |
39 }; | |
40 | |
41 } // namespace content | |
42 | |
43 #endif // CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ | |
OLD | NEW |