OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ | 5 #ifndef DEVICE_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ |
6 #define CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ | 6 #define DEVICE_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ |
7 | 7 |
8 #include <IOKit/IOKitLib.h> | 8 #include <IOKit/IOKitLib.h> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 | 11 |
12 namespace content { | 12 namespace device { |
13 | 13 |
14 // Provides an interface to retrieve ambient light data from MacBooks. | 14 // Provides an interface to retrieve ambient light data from MacBooks. |
15 class AmbientLightSensor { | 15 class AmbientLightSensor { |
16 public: | 16 public: |
17 // Create AmbientLightSensor object, return NULL if no valid is sensor found. | 17 // Create AmbientLightSensor object, return NULL if no valid is sensor found. |
18 static scoped_ptr<AmbientLightSensor> Create(); | 18 static scoped_ptr<AmbientLightSensor> Create(); |
19 | 19 |
20 ~AmbientLightSensor(); | 20 ~AmbientLightSensor(); |
21 | 21 |
22 // Retrieve lux values from Ambient Light Sensor. | 22 // Retrieve lux values from Ambient Light Sensor. |
23 bool ReadSensorValue(uint64_t lux_value[2]); | 23 bool ReadSensorValue(uint64_t lux_value[2]); |
24 | 24 |
25 private: | 25 private: |
26 AmbientLightSensor(); | 26 AmbientLightSensor(); |
27 | 27 |
28 // Probe the local hardware looking for Ambient Light sensor and | 28 // Probe the local hardware looking for Ambient Light sensor and |
29 // initialize an I/O connection to it. | 29 // initialize an I/O connection to it. |
30 bool Init(); | 30 bool Init(); |
31 | 31 |
32 // IOKit connection to the local sensor. | 32 // IOKit connection to the local sensor. |
33 io_connect_t io_connection_; | 33 io_connect_t io_connection_; |
34 | 34 |
35 DISALLOW_COPY_AND_ASSIGN(AmbientLightSensor); | 35 DISALLOW_COPY_AND_ASSIGN(AmbientLightSensor); |
36 }; | 36 }; |
37 | 37 |
38 } // namespace content | 38 } // namespace device |
39 | 39 |
40 #endif // CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ | 40 #endif // DEVICE_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ |
OLD | NEW |