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 <IOKit/IOKitLib.h> | |
9 | |
10 #include "base/mac/scoped_ioobject.h" | |
11 #include "device/generic_sensor/platform_sensor.h" | |
12 | |
13 namespace base { | |
14 class SingleThreadTaskRunner; | |
15 } | |
16 | |
17 namespace device { | |
18 | |
19 class PlatformSensorAmbientLightMac : public PlatformSensor { | |
20 public: | |
21 PlatformSensorAmbientLightMac( | |
22 mojom::SensorType type, | |
23 mojo::ScopedSharedBufferMapping mapping, | |
24 uint64_t buffer_size, | |
25 PlatformSensorProvider* provider, | |
26 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | |
Robert Sesek
2016/10/04 15:28:18
There's no reason to explicitly name this for the
| |
27 | |
28 mojom::ReportingMode GetReportingMode() override; | |
29 bool StartSensor(const PlatformSensorConfiguration& configuration) override; | |
30 void StopSensor() override; | |
31 | |
32 protected: | |
33 ~PlatformSensorAmbientLightMac() override; | |
34 bool CheckSensorConfiguration( | |
35 const PlatformSensorConfiguration& configuration) override; | |
36 PlatformSensorConfiguration GetDefaultConfiguration() override; | |
37 void UpdateReading(uint64_t lux_values[2]); | |
38 | |
39 private: | |
40 static void IOServiceCallback(void* context, | |
41 io_service_t service, | |
42 natural_t message_type, | |
43 void*); | |
44 base::mac::ScopedIOObject<io_service_t> light_sensor_service_; | |
Reilly Grant (use Gerrit)
2016/10/04 07:11:27
nit: space between methods and fields
| |
45 IONotificationPortRef light_sensor_port_; | |
Reilly Grant (use Gerrit)
2016/10/04 07:11:27
Initialize this to nullptr.
| |
46 io_object_t light_sensor_object_; | |
47 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | |
48 double current_lux_; | |
49 DISALLOW_COPY_AND_ASSIGN(PlatformSensorAmbientLightMac); | |
Reilly Grant (use Gerrit)
2016/10/04 07:11:27
nit: space between fields and this macro
| |
50 }; | |
51 | |
52 } // namespace device | |
53 | |
54 #endif // DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_ | |
OLD | NEW |