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

Side by Side Diff: device/generic_sensor/platform_sensor_ambient_light_mac.h

Issue 2417643006: [sensors][mac] Make sure to update the sensor value when initializing the sensor. (Closed)
Patch Set: Last comments from Tim Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | device/generic_sensor/platform_sensor_ambient_light_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_ 5 #ifndef DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_
6 #define DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_ 6 #define DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_
7 7
8 #include <IOKit/IOKitLib.h> 8 #include <IOKit/IOKitLib.h>
9 9
10 #include "base/mac/scoped_ionotificationportref.h" 10 #include "base/mac/scoped_ionotificationportref.h"
(...skipping 22 matching lines...) Expand all
33 mojom::ReportingMode GetReportingMode() override; 33 mojom::ReportingMode GetReportingMode() override;
34 // Can only be called once, the first time or after a StopSensor call. 34 // Can only be called once, the first time or after a StopSensor call.
35 bool StartSensor(const PlatformSensorConfiguration& configuration) override; 35 bool StartSensor(const PlatformSensorConfiguration& configuration) override;
36 void StopSensor() override; 36 void StopSensor() override;
37 37
38 protected: 38 protected:
39 ~PlatformSensorAmbientLightMac() override; 39 ~PlatformSensorAmbientLightMac() override;
40 bool CheckSensorConfiguration( 40 bool CheckSensorConfiguration(
41 const PlatformSensorConfiguration& configuration) override; 41 const PlatformSensorConfiguration& configuration) override;
42 PlatformSensorConfiguration GetDefaultConfiguration() override; 42 PlatformSensorConfiguration GetDefaultConfiguration() override;
43 void UpdateReading(uint64_t lux_values[2]);
44 43
45 private: 44 private:
45 bool ReadAndUpdate();
46 static void IOServiceCallback(void* context, 46 static void IOServiceCallback(void* context,
47 io_service_t service, 47 io_service_t service,
48 natural_t message_type, 48 natural_t message_type,
49 void* message_argument); 49 void* message_argument);
50 50
51 // IOService representing the LMU sensor. 51 // IOService representing the LMU sensor.
52 base::mac::ScopedIOObject<io_service_t> light_sensor_service_; 52 base::mac::ScopedIOObject<io_service_t> light_sensor_service_;
53 // Port used to get the notifications from the sensor. 53 // Port used to get the notifications from the sensor.
54 base::mac::ScopedIONotificationPortRef light_sensor_port_; 54 base::mac::ScopedIONotificationPortRef light_sensor_port_;
55 // IO Object used to query the value of the sensor. 55 // IO Object used to query the value of the sensor.
56 base::mac::ScopedIOObject<io_object_t> light_sensor_object_; 56 base::mac::ScopedIOObject<io_object_t> light_sensor_object_;
57 // IO Notifications created by IOServiceAddInterestNotification. 57 // IO Notifications created by IOServiceAddInterestNotification.
58 base::mac::ScopedIOObject<io_object_t> light_sensor_notification_; 58 base::mac::ScopedIOObject<io_object_t> light_sensor_notification_;
59 double current_lux_; 59 double current_lux_;
60 60
61 DISALLOW_COPY_AND_ASSIGN(PlatformSensorAmbientLightMac); 61 DISALLOW_COPY_AND_ASSIGN(PlatformSensorAmbientLightMac);
62 }; 62 };
63 63
64 } // namespace device 64 } // namespace device
65 65
66 #endif // DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_ 66 #endif // DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | device/generic_sensor/platform_sensor_ambient_light_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698